| superclass(es) | object |
| subclass(es) | - |
| description | The image class can be used for loading and displaying of bitmap images.![]() |
| see also | canvas - imageButton |
With the image class internal
bitmaps and external bitmap files can be loaded. It is
possible to resize and change the colors
of the image, to convert an image to monochrome and back to color. Pasting and copying
from and to the clipboard is also possible. A distribution of Trinc-Prolog always contains the following bitmap images:
These images can be loaded with the method load/2.
|
| func | Determine if an image was loaded or if the instance is empty. |
| pre | TRUE. |
| post | If the image instance contains no picture then true is assigned to the variable Output, else false is assigned. |
| func | Copy the contents of the image instance refered to by the variable Image to the instance that executes the method. |
| pre | The variable Image must refer to an instance of the image class. |
| post | If the copying was successful then true is assigned to the variable Output, else false is assigned. |
| func | Load an image from the own executable file. |
| pre | The variable Name must contain a string value. |
| post | If the loading was successful then true is assigned to the variable Output, else false is assigned. |
The following images are always included in a distribution of
Trinc-Prolog:
|
loadExternal(FileName, Output)
| func | Load an image from an external bitmap file. The current format supported is Windows bitmap, usually these files have the .bmp extension. |
| pre | The variable Name must contain a string value. |
| post | If the loading was successful then true is assigned to the variable Output, else false is assigned. |
| func | Invert the image. |
| pre | TRUE. |
| post | If inverting the image successful then true is assigned to the variable Output, else false is assigned. |
| func | Convert a color image to a monochrome image. All pixels with the color equal to (R, G, B) are converted to white pixels, the rest of the pixels are made black. |
| pre | The variables R, G and B must contain integer values which must be in the range [0, 255]. |
| post | If converting the image successful then true is assigned to the variable Output, else false is assigned. |
| func | Determine if the image is a monochrome image or not. |
| pre | TRUE. |
| post | If the image is a monochrome image then true is assigned to the variable Output, else false is assigned. |
toColor(R1, G1, B1, R0, G0, B0, Output)
| func | Convert a monochrome image to a color image, all 1 pixels in the monochrome image are converted to color pixels with the color( R1, G1, B1) and all 0 pixels are converted to (R0, G0, B0) pixels. |
| pre | The variables R1, G1, B1, R0, G0 and B0 must contain integer values which must be in the range [0, 255]. |
| post | If converting the image successful then true is assigned to the variable Output, else false is assigned. |
removeColor(R, G, B, RNew, GNew, BNew, Output)
| func | Remove a single color from the image, all pixels with the color (R, G, B) are replaced by pixels with the color (RNew, GNew, BNew). |
| pre | The variables R, G, B, RNew, GNew and BNew must contain integer values which must be in the range [0, 255]. |
| post | If removing the color was successful then true is assigned to the variable Output, else false is assigned. |
| func | Copy the image to the clipboard. |
| pre | TRUE. |
| post | If copying the image to the clipboard was successful then true is assigned to the variable Output, else false is assigned. |
| func | Paste the image from the clipboard into the image instance. |
| pre | The clipboard must contain a bitmap image. |
| post | If pasting the image from the clipboard was successful then true is assigned to the variable Output, else false is assigned. |
| func | Retrieve the dimensions of the image. |
| pre | TRUE. |
| post | The width and height of the image were assigned to the variables X and Y. |
| func | Change the dimensions of the image. |
| pre | The variables X and Y must contain integer values. |
| post | If resizing the image was successful then true is assigned to the variable Output, else false is assigned. |