Page 1 of 1

Bitmap, Bitmap.Save() and BitmapResource

PostPosted: Tue Feb 09, 2010 8:37 pm
by sacrebleu
Please explain Bitmap, Bitmap.Save() (specifically why it would return false and why it would fail) and BitmapResource.

Re: Bitmap, Bitmap.Save() and BitmapResource

PostPosted: Thu Feb 11, 2010 1:33 am
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

Re: Bitmap, Bitmap.Save() and BitmapResource

PostPosted: Thu Sep 08, 2011 11:20 pm
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-)