Using Canvas Class

Class TImagingCanvas in ImagingCanvases.pas unit allows library user to draw onto image and apply various effects. Base canvas class works for all image data formats with direct pixel access (so not for compressed formats). Because of this some operations are slower (sometimes a lot) than implementation optimized for just one data format (as it is done for example in Graphics32 library).

Descendants optimized for specific data formats can be created. Currently there is only most basic TFastARGB32Canvas class for ifA8R8G8B8 images.

Canvas can be created for both low and high level images. Image data is only referenced by canvas. If you change image data size (like format conversion or resizing) you must update canvas by calling UpdateCanvasState method so that canvas can update its helper structures depending on size of the data (like scanline pointers). You only need to update the canvas when size of image data changes, not after setting pixels or drawing outside of the canvas (like using CopyRect function).

Currently Canvas class has these features:

You can find some canvas usage code in Tips article linked bellow and in the demos. There is still a lot of functions that can be added to canvas and hopefully they will be.