Canvas

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
j0k3r
In need of some credit
In need of some credit
Posts: 1
Joined: Wed Sep 08, 2004 9:26 am

Canvas

Post by j0k3r »

Hi,

i am developing an application prototype and i would like to use wxWindows ( i tried Fox - nice but not much useful in my case - and QT - lovely, but no free edition under Windows, so goodbye ).

The most important component of my application ( a neural network that works on images to produce data for a BDI agent ) wil be an image-showing control on which i have to draw polygons and detect the underlying pixels.

Now i spent not much time looking at docs ( maybe tonight i'll find few time ), so i would like to know if there's any wx control that works this way ( something like a canvas ) and if there are sample apps / tutorials.

I am quite sure they exist, but little help will be appreciated.

Thanks in advance,
j0k3r
upCASE
Moderator
Moderator
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Post by upCASE »

Hi!
For a canvas, there is no such specific class, but a wxPanel will just be fine. Then construct a wxDC derived class like wxClientDC and use that for doing the actual drawing.
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg »

Or a wxScrolledWindow which is also good for your purpose. Check the Life demo it contains a lot of custom drawing, although no pixel detection.

If you are going to detect pixels directly off the canvas be aware that after an expose event, things get redrawn. I think the best solution is keeping a x,y array in memory and using the control only for display .. this is to minimize the risk of colour displacement (256 colors dithering etc) exposure events or overlaps.

If I misinderstood that part about pixel detection, then never mind ;-)

- Jorgen
Post Reply