exception Image_error of string
Raised when an error occur in this module
This module provides a safe way to load and access images stored in the RAM. Images stored this way are uncompressed arrays of bytes and are therefore not meant to be stored in large quantities.
exception Image_error of string
type t
val create : [ `File of string | `Empty of (OgamlMath.Vector2i.t * Color.t) | `Data of (OgamlMath.Vector2i.t * Bytes.t)] -> t
Image_error
if the loading fails val size : t -> OgamlMath.Vector2i.t
val set : t -> OgamlMath.Vector2i.t -> Color.t -> unit
val get : t -> OgamlMath.Vector2i.t -> Color.RGB.t
val blit : t -> ?rect:OgamlMath.IntRect.t -> t -> OgamlMath.Vector2i.t -> unit
blit src ~rect dest offset
blits the subimage of src
defined by rect
on the image dest
at position offset
(relative to the top-left pixel).rect
is not provided then the whole image src
is used.val mipmap : t -> int -> t
mipmap img lvl
returns a new, fresh image that is the lvl
-th reduction of the image img
val pad : t -> ?offset:OgamlMath.Vector2i.t -> ?color:Color.t -> OgamlMath.Vector2i.t -> t
pad img offset color size
returns a new image of size size
, which contains img
placed at position offset
, and where the empty pixels are filled with color