My first project

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
MikeW72
In need of some credit
In need of some credit
Posts: 1
Joined: Sun Aug 01, 2021 11:17 am

My first project

Post by MikeW72 »

I'm new to wxWidgets. As of today, I have a whole one days experience...

I've decided to port a program I originally wrote with C++ Builder around 20 years ago to wxWdgets. I think I'm getting on top of the situation and have the basics of the program working fine. However, I've hit a problem.

My program builds a 256x256 1 bpp image in memory (It's stores in a block of memory 8192 bytes long - 256 * 256 / 8). What's the fastest way of transferring this image to the onscreen window? I don't care about scaling, just getting it to the screen initially. Is there a way of building my own DC pointing at the buffer, or am I thinking about things in the wrong manor?

Thanks,
Mike
User avatar
doublemax
Moderator
Moderator
Posts: 19115
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: My first project

Post by doublemax »

Hello and welcome to the forum.

In general, support for monochrome bitmaps in wxWidgets is low. But this constructor can at least create a bitmap from monochrome data:
https://docs.wxwidgets.org/trunk/classw ... c1de516f21

There are several ways to display a wxBitmap on screen, in your case i suspect you want something custom drawn. This should get you started:
https://wiki.wxwidgets.org/Drawing_on_a_panel_with_a_DC
Use the source, Luke!
Post Reply