package camlimages

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Genimage.MakeSource

Parameters

module CON : Image_intf.CONTAINER with type rawimage = RI.t

Signature

Sourcetype elt = RI.elt

Image creation

Sourceval create : int -> int -> t

create w h creates an image with a size wxh. The content is the image is not initialized.

Sourceval make : int -> int -> elt -> t

make w h c creates an image with a size wxh. The content is the image is initialized to the color c.

Sourceval destroy : t -> unit

destroy t explicitly frees the image content of t. 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.

Pixel access

Sourceval get : t -> int -> int -> elt

get t x y gets image pixel of t at x,y. If x,y is outside of the image size, Images.Out_of_image exception is raised.

Sourceval set : t -> int -> int -> elt -> unit

set t x y c sets image pixel of t at x,y by the color c. If x,y is outside of the image size, Images.Out_of_image exception is raised.

Sourceval unsafe_get : t -> int -> int -> elt
Sourceval unsafe_set : t -> int -> int -> elt -> unit

Unsafe versions of get and set. It does not perform any image boundary check. If the coordinates are out of the given image, the result is undefined. Use carefully.

Image copy

Sourceval copy : t -> t

copy t duplicates the image t.

Sourceval sub : t -> int -> int -> int -> int -> t

sub t x y w h duplicates a subimage of t of size wxh, whose origin (0,0) is at (x,y) of t.

Sourceval blit : t -> int -> int -> t -> int -> int -> int -> int -> unit

blit src x y dst x' y' w h copies rectangular area of src at x,y with size wxh, to an image dst. The origin of the subimage comes at x',y' of dst.

Sourceval 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 of src at x,y with size wxh, to an image dst, using color conversion function f. The origin of the subimage comes at x',y' of dst.

Sourceval dump : t -> bytes

functions for internal use

Sourceval unsafe_access : t -> int -> int -> bytes * int
Sourceval get_strip : t -> int -> int -> int -> bytes
Sourceval set_strip : t -> int -> int -> int -> bytes -> unit
Sourceval get_scanline : t -> int -> bytes
Sourceval get_scanline_ptr : t -> (int -> (bytes * int) * int) option
Sourceval set_scanline : t -> int -> bytes -> unit
Sourceval blocks : t -> int * int
Sourceval dump_block : t -> int -> int -> Bitmap.Block.t
OCaml

Innovation. Community. Security.