A destructor is present on this object, but not explicitly documented in the source.
Only valid if enableAlpha is true
for use with getDataPointer
for use with getDataPointer
warning: this is not portable across platforms because the data format can change
this is here for interop with arsd.image. where can be a TrueColorImage's data member if you pass in a buffer, it will put it right there. length must be width*height*4 already if you pass null, it will allocate a new one.
once you have the position of a pixel, use these to get to the proper color
this is here for interop with arsd.image. from can be a TrueColorImage's data member
On Windows, this means a device-independent bitmap. On X11, it is an XImage.
Drawing an image to screen is not necessarily fast, but applying algorithms to draw to the image itself should be fast. An Image is also the first step in loading and displaying images loaded from files.
If you intend to draw an image to screen several times, you will want to convert it into a Sprite.
It is possible for your user's system to run out of these handles over time, forcing them to clean it up with extraordinary measures - their GUI is liable to stop working!
Be sure these are cleaned up properly. simpledisplay will do its best to do the right thing, including cleaning them up in garbage collection sweeps (one of which is run at most normal program terminations) and catching some deadly signals. It will almost always do the right thing. But, this is no substitute for you managing the resource properly yourself. (And try not to segfault, as recovery from them is alway dicey!)
Please call destroy(image); when you are done with it. The easiest way to do this is with scope:
auto image = new Image(256, 256); scope(exit) destroy(image);
As long as you don't hold on to it outside the scope.
I might change it to be an owned pointer at some point in the future.
Drawing pixels on the image may be simple, using the opIndexAssign function, but you can also often get a fair amount of speedup by getting the raw data format and writing some custom code.
FIXME INSERT EXAMPLES HERE
Represents an in-memory image in the format that the GUI expects, but with its raw data available to your program.