An image is a rectangular area of pixels. The actual representation of the pixel data is completely left to the plaform specific layer. An OpenGL driver most likely will have a memory buffer with the raw RGBA data of the image attached to each LandImage, along with a texture id for displaying it and an FBO id for drawing to it.
A sub-image is an image sharing all of its pixels with some other image. If the other image is changed, then also the sub-image changes.
Parameters: void(* cb)(char const * path, LandImage * image)
Parameters: char const * filename
Returns: LandImage*
Parameters: LandImage * self
Returns: bool
Load an image that was previously declared “on demand”.
Parameters: int w, int h
Creates a new image. If w or h are 0, the image will have no contents at all (this can be useful if the contents are to be added later). The image will always be a simple memory rectangle of pixels, with no driver specific optimizations.
Parameters: int w, int h, int flags
Creates a new image. If w and h are 0, the image will have no contents at all (this can be useful if the contents are to be added later).
Like land_image_new, but clears the image to all 0 initially.
Parameters: LandImage * self, int x, int y, int w, int h
Crops an image to the specified rectangle. All image contents outside the rectangle will be lost. You can also use this to make an image larger, in which case the additional borders are filled with transparency. The offset need not lie within the image.
This will optimize an image by cropping away any completely transparent borders it may have.
Parameters: LandImage * self, int new_w, int new_h, int flags
Parameters: LandImage * copy, int x, int y, int w, int h
Create a new image, copying pixel data from a rectangle in an existing image.
Parameters: LandImage * self, float * red, float * green, float * blue, float * alpha
Returns: int
Returns the number of pixels in the image, and the average red, green, blue and alpha component.
Parameters: LandImage * self, int r255, int g255, int b255, int a255, int **_r255, int _g255, int _b255, int _a255**
Replaces a color with another.
Parameters: LandImage * self, int r255, int g255, int b255
Replaces all pixels in the image matching the given RGB triplet (in 0..255 format) with full transparency.
Parameters: LandImage * self, int allegro_color
Like land_image_colorkey, but even more hackish, you directly specify the color in Allegro’s format. The only use for this is if you load paletted pictures and want to colorkey by index.
Parameters: LandImage * self, LandImage * colormask
Colorizes the part of the image specified by the mask with the current color. The mask uses (1, 0, 1) for transparent, and the intensity is otherwise used as intensity of the replacement color.
Parameters: LandImage * self, int n, int * rgb
This takes a list of colors and replaces all colors in the image corresponding to one of them with the current color.
The colors use integer 0..255 format, since exact comparison with the usual floating point colors would be difficult otherwise. The array ''rgb'' should have 3 * n integers, consisting of consecutive R, G, B triplets to replace. The first rgb triplet has a special meaning - it determines the image color which is mapped to the current color. All matching colors with a larger rgb sum then are mapped to a color between the first color and pure weight, depending on their rgb sum. All colors with a smaller rgb sum are mapped to a range from total black to the first color.
Parameters: LandImage * self, int n_rgb, int * rgb
Takes the same parameters as land_image_colorize_replace - but instead of recoloring the image itself, creates a separate image of the same size, which is transparent except where mask colors have been found in the given image. Here, it is colored in graylevels with the intensity corresponding to the mask colors. In the original image, all mask colors are replaced by transparency. The use of this function is to always draw the mask over the original image, but tint the white mask to other colors.
Parameters: char const * pattern, void(* cb)(LandImage * image, void * data), void * data
Returns: LandArray*
Load all images matching the file name pattern, and create an array referencing them all, in alphabetic filename order. The callback function is called on each image along the way.
Parameters: char const * pattern, int center, int auto_crop
Load all images matching the file name pattern, and create an array referencing them all.
Parameters: LandImage * parent, float x, float y, float w, float h
Parameters: char const * filename, int offset_x, int offset_y, int grid_w, int grid_h, int x_gap, int y_gap, int x_count, int y_count, int auto_crop
Parameters: LandImage * self, float x, float y, float sx, float sy, float angle, float r, float g, float b, float alpha, int flip
Parameters: LandImage * self, float x, float y, float sx, float sy, float angle, float r, float g, float b, float alpha
Parameters: LandImage * self, float x, float y, float sx, float sy, float angle
Parameters: LandImage * self, float x, float y, float sx, float sy
Parameters: LandImage * self, float x, float y, float a
Parameters: LandImage * self, float x, float y, float a, float r, float g, float b, float alpha
Parameters: LandImage * self, float x, float y, float sx, float sy, float r, float g, float b, float alpha
Parameters: LandImage * self, float x, float y
Parameters: LandImage * self, float x, float y, float r, float g, float b, float alpha
Parameters: LandImage * self, int x, int y
Parameters: LandImage * self, float x, float y, float tx, float ty, float tw, float th
no parameters
Parameters: LandImage * self, float x, float y, float x_, float y_
Parameters: LandImage * self, float x, float y, float sx, float sy, float sw, float sh
Parameters: LandImage * self, unsigned char * rgba
Copies rgba data into the specified buffer. It has to be large enough (w * h * 4 bytes) to hold all the data.
Parameters: LandImage * self, unsigned char const * rgba
Copies the rgba data, overwriting the image contents. Since data are copied rgba can be safely deleted after returning from the function.
Parameters: LandImage * self, char const * filename
Parameters: char const * (* xpm)
Parameters: LandImage * self, void(* cb)(int x, int y, unsigned char * rgba, void * user), void * user
Run a callback for each pixel of a picture. The pointer passed to the callback must be assigned 4 8-bit values in the range 0..255. It must not be read from.
Run a callback for each pixel of a picture. The rgba pointer passed to the callback will contain the current color as 4 consecutive bytes and may be modified.
Parameters: LandImage * self, void(* cb)(int x, int y, int w, int h, unsigned char * rgba_in, unsigned char * rgba_out, void * user), void * user
Same as land_image_read_write_callback but the previous image is kept in a backup buffer and a separate pointer for reading is provided. This is useful if you also want to read from neighboring pixels. As a convenience the width and height of the buffers is also passed to the callback to allow handling border conditions.