public class BitmapImage extends RasterImage
Editable straight-alpha RGBA bitmap, independent of a window or a file. Each update publishes an immutable snapshot: already recorded Painter commands keep their pixels until that frame is released. Pixels use R,G,B,A byte order. Dimensions are limited to 4096 on each axis (64 MiB per image).
import klyn.gui.images
image = BitmapImage(640, 480)
pixels = image.getPixels()
pixels[3] = Byte(255)
image.setPixels(pixels)
image.save("drawing.png")| Modifier and Type | Member | Description |
|---|---|---|
| public | BitmapImageBitmapImage(file as String) |
Decodes the first frame/page without modifying the source file. |
| public | BitmapImageBitmapImage(width as Int, height as Int) |
Creates a transparent bitmap. |
| Modifier and Type | Member | Description |
|---|---|---|
| public override | crop | Bitmap pixel dimensions cannot be changed by a display-only operation. |
| public static | frameCount | Reads GIF frame count / TIFF page count, 1 for other image families. |
| public | getPixelsgetPixels() as Byte[] |
Returns a copy of all RGBA bytes. |
| public override | loadload(fileName as String) as Void |
Loading into an existing mutable bitmap is not supported; create one. |
| public override | resize | Bitmap pixel dimensions cannot be changed by a display-only operation. |
| public | save | Atomically exports PNG, JPEG, GIF, BMP or TIFF, selected by extension. |
| public | setPixelssetPixels(pixels as Byte[]) as Void |
Publishes exactly width*height*4 bytes; copies the caller's buffer. |
| public | setText | Replaces pixels with antialiased text, on a transparent background. |