Module Bitmap.Make
Parameters
Signature
val create : int -> int -> bytes option -> t
create width height initopt
creates a bitmap of sizewidth
xheight
. You can setinitopt
the value to fill the bitmap.create
has no check of the size ofinitopt
.
val create_with : int -> int -> bytes -> t
create_with width height initdata
creates a bitmap whose initial data isinitdata
.create_with
has no check of the input size.
val create_with_scanlines : int -> int -> bytes array -> t
create_with_scanlines width height scanlines
creates a bitmap whose initial data consists ofscanlines
.scanlines
are raw data of each row of the image.create_with_scanlines
has no check of the input size.
val destroy : t -> unit
Destroy bitmaps
val access : t -> int -> int -> bytes * int
access t x y
is the raw access to the image buffer. It returns the byte image and its offset to the point (x,y).access
has no boundary check.
val get_strip : t -> int -> int -> int -> bytes
val set_strip : t -> int -> int -> int -> bytes -> unit
Strip access
Here, "strip" means a rectangle region with height 1.
get_strip t x y w
returns the bytes reprensentation of strip oft
at (x, y) - (x + w - 1, y).set_strip t x y w str
writestr
to the strip oft
at (x, y) - (x + w - 1, y).
val get_scanline : t -> int -> bytes
val set_scanline : t -> int -> bytes -> unit
Scanline access
get_scanline t y
returns the bytes representation of the scanline oft
aty
.set_scanline t y str
writesstr
to the scanline oft
aty
.
val get_scanline_ptr : t -> (int -> (bytes * int) * int) option
get_scanline_ptr t
returns a function to get a scanline of giveny
coordinate and the number of scanlines betweeny
and the bottom of the image. It returnsNone
if the internal image partitioning cannot provide such function efficiently.
val dump : t -> bytes
Create a bytes representation of a bitmap. It may easily raise an exception Out_of_memory for large images.
val sub : t -> int -> int -> int -> int -> t
sub src x y width height
returns sub-bitmap ofsrc
, at (x, y) - (x + width - 1, y + height - 1).
val blit : t -> int -> int -> t -> int -> int -> int -> int -> unit
blit src sx sy dst dx dy width height
copies the rectangle region ofsrc
at (sx, sy) - (sx + width - 1, sy + height - 1) todst
, at (dx, dy) - (dx + width - 1, dy + height - 1)
val blocks : t -> int * int
returns number of blocks in row and column