Module type Image_intf.IMAGE
val create : int -> int -> t
create w h
creates an image with a sizew
xh
. The content is the image is not initialized.
val make : int -> int -> elt -> t
make w h c
creates an image with a sizew
xh
. The content is the image is initialized to the colorc
.
val destroy : t -> unit
destroy t
explicitly frees the image content oft
. If you do not use bitmap swap files, you do not need to call this function, since GC will free unreachable image data automatically. Read bitmap.mli for more details.
val get : t -> int -> int -> elt
get t x y
gets image pixel oft
atx
,y
. Ifx
,y
is outside of the image size, Images.Out_of_image exception is raised.
val set : t -> int -> int -> elt -> unit
set t x y c
sets image pixel oft
atx
,y
by the colorc
. Ifx
,y
is outside of the image size, Images.Out_of_image exception is raised.
val unsafe_get : t -> int -> int -> elt
val unsafe_set : t -> int -> int -> elt -> unit
Unsafe versions of
get
andset
. It does not perform any image boundary check. If the coordinates are out of the given image, the result is undefined. Use carefully.
val sub : t -> int -> int -> int -> int -> t
sub t x y w h
duplicates a subimage oft
of sizew
xh
, whose origin (0,0) is at (x,y) oft
.
val blit : t -> int -> int -> t -> int -> int -> int -> int -> unit
blit src x y dst x' y' w h
copies rectangular area ofsrc
atx
,y
with sizew
xh
, to an imagedst
. The origin of the subimage comes atx'
,y'
ofdst
.
val map : (elt -> elt -> elt) -> t -> int -> int -> t -> int -> int -> int -> int -> unit
map f src x y dst x' y' w h
maps pixels of the rectangular area ofsrc
atx
,y
with sizew
xh
, to an imagedst
, using color conversion functionf
. The origin of the subimage comes atx'
,y'
ofdst
.
val dump : t -> bytes
functions for internal use
val unsafe_access : t -> int -> int -> bytes * int
val get_strip : t -> int -> int -> int -> bytes
val set_strip : t -> int -> int -> int -> bytes -> unit
val get_scanline : t -> int -> bytes
val get_scanline_ptr : t -> (int -> (bytes * int) * int) option
val set_scanline : t -> int -> bytes -> unit
val blocks : t -> int * int
val dump_block : t -> int -> int -> Bitmap.Block.t