Smooth Resampling/Resizing of wxBitmap or Image? Topic is solved

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
ionstream
Earned a small fee
Earned a small fee
Posts: 23
Joined: Wed Jan 05, 2005 6:49 pm

Smooth Resampling/Resizing of wxBitmap or Image?

Post by ionstream » Mon Aug 15, 2005 10:29 pm

I want to do some 2D antialiasing for my drawing app. I read online that the best way to do this is to make some memory (a memoryDC, i'd presume) that is bigger than the drawing area, draw to that memory, resize and resample that memory to fit onto the drawing area, and blit that onto the drawing area.

The problem is that wxWidgets doesnt have any smooth scaling or resampling functions that I know of. The example that I read online uses GDI to do the smooth rescale, is there any way to access that through wxWidgets (while still making it cross platform)? Or is there any way around the lack of resampling functions?

Thanks a lot!

User avatar
Ryan Norton
Moderator
Moderator
Posts: 1319
Joined: Mon Aug 30, 2004 6:01 pm

Re: Smooth Resampling/Resizing of wxBitmap or Image?

Post by Ryan Norton » Mon Aug 15, 2005 11:15 pm

That's a good question. The way I do it is just run images that need drastic resizing through wxMediaCtrl, but that's a rather unpredictable and roundabout way to do it.
[Mostly retired moderator, still check in to clean up some stuff]

ionstream
Earned a small fee
Earned a small fee
Posts: 23
Joined: Wed Jan 05, 2005 6:49 pm

Post by ionstream » Tue Aug 16, 2005 12:07 am

I hope I marked that "Assisting answer" thing right.

wxMediaCtrl might be the key, but its probably too slow to do real time, I'll check it out. Thanks.

User avatar
Ryan Norton
Moderator
Moderator
Posts: 1319
Joined: Mon Aug 30, 2004 6:01 pm

Post by Ryan Norton » Tue Aug 16, 2005 12:37 am

ionstream wrote:I hope I marked that "Assisting answer" thing right.

wxMediaCtrl might be the key, but its probably too slow to do real time, I'll check it out. Thanks.
Don't worry about it - the answer system is new :).

Hopefully someone has a better answer here, as its something I'm curious of too...
[Mostly retired moderator, still check in to clean up some stuff]

ionstream
Earned a small fee
Earned a small fee
Posts: 23
Joined: Wed Jan 05, 2005 6:49 pm

Post by ionstream » Tue Aug 16, 2005 4:08 pm

Arg, noone knows? Maybe the only way to do this is through OpenGL? That would decrease portability, but I guess it would make it alot faster (for a drawing app).

Does anyone have any thoughts on this?[/quote]

leio
Can't get richer than this
Can't get richer than this
Posts: 802
Joined: Mon Dec 27, 2004 10:46 am
Location: Estonia, Tallinn
Contact:

Post by leio » Tue Aug 16, 2005 4:29 pm

There are image libraries out there that are capable of doing good downscaling.
imagemagick, etc.
wxImage unfortunately doesn't yet support good scaling. Would love to see patches :P
Compilers: gcc-3.3.6, gcc-3.4.5, gcc-4.0.2, gcc-4.1.0 and MSVC6
OS's: Gentoo Linux, WinXP; WX: CVS HEAD

Project Manager of wxMUD - http://wxmud.sf.net/
Developer of wxGTK;
gtk+ port maintainer of OMGUI - http://www.omgui.org/

ionstream
Earned a small fee
Earned a small fee
Posts: 23
Joined: Wed Jan 05, 2005 6:49 pm

Post by ionstream » Tue Aug 16, 2005 8:00 pm

I think I'm gonna go to OpenGL, its nice and fast, and its fairly easy to set up in linux (as long as you know what your doing).


Thanks for all your help!

Post Reply