XML Resource Files: Adding bitmaps to the resource files

XML Resource Files: Adding bitmaps to the resource files

Post by Tim Fine » Wed, 25 Dec 2002 12:11:00






>> I was wondering if it's possible (like in the Windows
>> bitmaps) to add bitmaps (well, more appropriately GIF
>> images) to the wxXmlResource system out side of dialog
>> and tool bar definitions.

> Yes:
> <object class="wxBitmap">filename.png</object>

Thanks!  My only problem is that the png is still external when run through
wxrc.  I'll take a look into wxrc's source to see if I can't hack in
something.

Regards,
Tim

 
 
 

XML Resource Files: Adding bitmaps to the resource files

Post by Tim Fine » Wed, 25 Dec 2002 13:18:32







>>> I was wondering if it's possible (like in the Windows
>>> bitmaps) to add bitmaps (well, more appropriately GIF
>>> images) to the wxXmlResource system out side of dialog
>>> and tool bar definitions.

>> Yes:
>> <object class="wxBitmap">filename.png</object>

> Thanks!  My only problem is that the png is still external when run
> through wxrc.  I'll take a look into wxrc's source to see if I can't
> hack in something.

In wxrc.cpp, function FindFilesInXML( 266 ), change:

        if ((node->GetType() == wxXML_ELEMENT_NODE) &&
            // parent is an element, i.e. has subnodes...
            (n->GetType() == wxXML_TEXT_NODE ||
            n->GetType() == wxXML_CDATA_SECTION_NODE) &&
            // ...it is textnode...
            ((node/*not n!*/->GetName() == "bitmap") ||
                        (node/*not n!*/->GetName() == "url")))

to:

        if ((node->GetType() == wxXML_ELEMENT_NODE) &&
            // parent is an element, i.e. has subnodes...
            (n->GetType() == wxXML_TEXT_NODE ||
            n->GetType() == wxXML_CDATA_SECTION_NODE) &&
            // ...it is textnode...
            ((node/*not n!*/->GetName() == "bitmap") ||
                        (node/*not n!*/->GetName() == "url") ||
                        (node->GetName() == "object" && node->GetPropVal("class",
wxEmptyString) == "wxBitmap")))

This will grab the embedded wxBitmaps.

Regards,
Tim

 
 
 

1. bitmaps - how to load a bitmap image from a file, not a resource

I hope someone can help me with this or at least point me in the right
direction.

I need to load a bitmap into a buffer.  The bitmap is not a resource
within the application.  The user will select a path
to a .bmp file on their system.  I will have to load the image data
intomy app.  When the user saves the application
file I will need to stream the user selected bitmap image out to file
using the WriteFile API command.  When the
user opens up an existing application file I will need to read the
bitmap image data in using ReadFile.  The bitmap
data will not be the only data saved out to the file.  I will be saving
other info as well.

All the MFC and Windows stuff I have come across assumes that the bitmap

is a resource within the app.

So, can anybody point me in the right direction?

Ira Idelson
PLATINUM technology
Princeton, NJ

2. I need Key board help having lost some keys

3. Howto: Split mfc resources across multiple resource files?

4. Is it safe to delete the local settings/temp?

5. New Resource: Add-ins and Resources

6. Slip under Win95 solution.....

7. Win 95 Compatibility info here

8. Using Bitmaps in resource files

9. Bitmap in resource file

10. Loading bitmaps from a wxr resource file

11. QUESTION: How to restore palette from 256 color bitmap in resource file ???

12. How can I obtain a list of bitmaps in my resource file?