Bitmap, Bitmap.Save() and BitmapResource

General help with the Ecere Cross Platform GUI toolkit: Window, common controls, events, etc.
Help with the 2D Graphics library: Surface, Display, Bitmap, Font and others.
Post Reply
sacrebleu
Posts: 27
Joined: Sun Jan 17, 2010 12:37 pm

Bitmap, Bitmap.Save() and BitmapResource

Post by sacrebleu »

Please explain Bitmap, Bitmap.Save() (specifically why it would return false and why it would fail) and BitmapResource.
jerome
Site Admin
Posts: 608
Joined: Sat Jan 16, 2010 11:16 pm

Re: Bitmap, Bitmap.Save() and BitmapResource

Post by jerome »

Hi Herb,

Just a quick answer for now, but I will try to find some time to answer all these questions of yours on the forums after I set up a desk and chair over here, and the hot air of Viet Nam cool down :D

Bitmap is the core object to hold picture data, in a variety of pixel color formats. It can hold both device independent and device dependent bitmaps (Depending on whether or not you pass a display system to the Bitmap::Load method, or whether you call MakeDD or not).

BitmapResource is a higher level utility function for automatically managing the loading and unloading of bitmap data when entering or exiting a specific display driver/graphics mode. It is akin to the Window::OnLoadGraphics and Window::OnUnloadGraphics events.

Bitmap::Save() returns false if it was unable to save the bitmap to the file, if e.g. it was not able to open the specified file name for writing or if the underlying picture format library call failed. It will return false on failure and true on success.

NOTE: You want to use Save() on display independent bitmaps only (a bitmap on which MakeDD has NOT been called and initialized with a null display system).

Please let me know if you have any other specific question(s) about these.

Cheers,

Jerome
jerome
Site Admin
Posts: 608
Joined: Sat Jan 16, 2010 11:16 pm

Re: Bitmap, Bitmap.Save() and BitmapResource

Post by jerome »

Sam,

Have you come across the sdk/samples/guiAndGfx/bitmapsAndKB sample?
It comes with a little PowerPoint tutorial as well.
You moves bitmaps around with the keyboard. The PowerPoint talks about the audio/piano sample also :)

Cool stuff 8-)
Post Reply