Re: Loading images from memory streams

"Bryan Bulten" <[email protected]> Tue, 29 Mar 2005 10:57:04 -0800 (PST)
Newsgroups gmane.comp.lib.wxwindows.wxnet
Message-ID <[email protected]>
Hello,

> What I'm trying to do:
>
> Embed icons into the assembly, and load them out at runtime into a
> BitmapButton.
>
> <snip>
>
> Is there currently a way to do this? Is there a way that just hasn't
> been checked in to CVS yet? Or is there a good place for me to start
> patching? I'm not entirely sure how to convert a C# Stream to a C++/wx
> Stream, so if it someone could nudge me in the right direction, I'd
> appreciate it.

If you are able to load the raw image data from the exe into a form that
can be passed as an IntPtr, or a unsigned char*, then I can think of
two ways:

 1. Pass it to wxImage::SetData, or the appropriate wxBitmap constructor
    (this requires that the data be already in the format supported by
    these classes).

 2. Use a wxMemoryInputStream, which is derived from wxInputStream, to
    take the data, and use the wxImage constructor that you mentioned.

None of this is implemented in wx.NET yet, so you have a bit of work
ahead.  All you'd really have to implement is an additional method to
wxImage to handle reading an image resource from an exe -
wxMemoryInputStream wouldn't need to be ported, and would just be used
in libwx-c.


Hope that helps.

-- 
Bryan Bulten
http://bulten.ca/
http://wxnet.sourceforge.net/


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id396&op=click