package bimage

  1. Overview
  2. Docs

Module Bimage.PixelSource

Pixel defines operations on individual pixels, which are stored as floatarray

Sourcetype 'a t
Sourceval empty : 'a Color.t -> 'a t

Create a new pixel with all channels set to 0

Sourceval v : 'a Color.t -> float list -> 'a t

Create a new pixel filled using the values from a list

Sourceval fill : 'a t -> float -> unit
Sourceval length : 'a t -> int

Get the number of channels in a pixel

Sourceval get : 'a t -> int -> float

Get value at index

Sourceval set : 'a t -> int -> float -> unit

Set value at index

Sourceval compare : 'a t -> 'a t -> int

Compare two pixels

Sourceval equal : 'a t -> 'a t -> bool

Returns true when two pixels are equal

Sourceval of_data : 'c Color.t -> ('a, 'b) Data.t -> 'c t

Create a new pixel from existing image data

Sourceval to_data : dest:('a, 'b) Data.t -> 'c t -> unit

Copy pixel data to existing image data

Sourceval data : 'a t -> floatarray

Returns the underlying pixel data

Sourceval color : 'a t -> 'a Color.t

Get pixel color

Sourceval to_rgb : 'a t -> Color.rgb t

Convert pixel to RGB

Sourceval of_rgb : 'a Color.t -> Color.rgb t -> 'a t

Convert pixel from RGB

Sourceval iter : (int -> float -> unit) -> 'a t -> unit

Iterate over pixel values

Sourceval map : ?ignore_alpha:bool -> (float -> float) -> 'a t -> 'a t

map f x executes f for each value in x, returning a new Pixel.t

Sourceval map_inplace : ?ignore_alpha:bool -> (float -> float) -> 'a t -> 'a t

map_inplace f x executes f for each value in x, assigning the new value to the same * index

Sourceval map2_inplace : ?ignore_alpha:bool -> (float -> float -> float) -> 'a t -> 'a t -> 'a t

Executes a function over each item in two pixels

Sourceval fold : ?ignore_alpha:bool -> (float -> 'a -> 'a) -> 'b t -> 'a -> 'a

Reduction over a pixel

Sourceval clamp : 'a t -> 'a t
Sourceval pp : Format.formatter -> 'a t -> unit
Sourcemodule Infix : sig ... end
OCaml

Innovation. Community. Security.