i think i can benefit from this project,at least i will take less time to do the remaining research over the next few days. best regard.
ReplyThis is nice work. However in the real world you will want to add zoom an translate to the drawing surface. This will change how you use the matrix. Each mouse point needs to be transformed to the zoomed world coordinate. I would setup a matrix stack. Something with a push and pop. The push would make a copy on the top of the stack. You could set your zoomed translated world up push the matrix use the top of the stack to do the stuff your doing now and then pop. That way the zoomed translated world stays intact. Maybe you could combine your QZoomview to this demo. It would be nice to see. My 2 cents.
ReplyCQTTDemoView: - Override OnEraseBackground to return TRUE. - Override OnDraw: where: Graphics g ( pDC->GetSafeHdc () ); to: QBufferDC bufferDC ( pDC ); Graphics g ( bufferDC.GetSafeHdc () ); QBufferDC: - On the constructor class QBufferDC: where: // Get the clipping boundary of the mother DC, in logical coordinates CRect rcClip; VERIFY ( pDC->GetClipBox ( rcClip ) != ERROR ); // Transform to device coordinates (pixels), and normalize pDC->LPtoDP ( rcClip); rcClip.NormalizeRect (); if ( m_bufferBitmap.ReserveBitmap ( pDC, rcClip.Size () ) ) { ... ... #ifdef QBUFFER_DEMO // In demo mode, change the color slightly so we can see which parts are updated if ( m_bDemoMode ) col ^= RGB ( rand () % 32, rand () % 32, rand () % 32 ); #endif // Get the mother DC's clipping boundary in logical coordinates and fill it. VERIFY ( pDC->GetClipBox ( rcClip ) != ERROR ); // Transform to device coordinates (pixels), and normalize pDC->LPtoDP ( rcClip ); if ( mapmode != MM_TEXT ) { // Other mapping modes may lead to roundof errors, causing artefacts // on the screen. To compensate, we inflate the bounding rectangle with two pixels. CSize szPixels ( 2, 2 ); DPtoLP ( &szPixels ); rcClip.InflateRect ( szPixels.cx, szPixels.cy ); } // DAKOT removed: //FillSolidRect ( rcClip, col ); // Initialize accumulation of boundary information SetBoundsRect ( NULL, DCB_ENABLE | DCB_ACCUMULATE | DCB_RESET ); // DAKOT added here: FillSolidRect ( rcClip, col ); } to: // Get the clipping boundary of the mother DC, in logical coordinates CRect rcClip, rcBitmap; VERIFY ( pDC->GetClipBox ( rcClip ) != ERROR ); // Transform to device coordinates (pixels), and normalize rcBitmap.CopyRect ( &rcClip ); pDC->LPtoDP ( rcBitmap ); rcBitmap.NormalizeRect (); if ( m_bufferBitmap.ReserveBitmap ( pDC, rcBitmap.Size () ) ) { ... ... #ifdef QBUFFER_DEMO // In demo mode, change the color slightly so we can see which parts are updated if ( m_bDemoMode ) col ^= RGB ( rand () % 32, rand () % 32, rand () % 32 ); #endif /************ COMMENTED by VMONSTER // Get the mother DC's clipping boundary in logical coordinates and fill it. VERIFY ( pDC->GetClipBox ( rcClip ) != ERROR ); // Transform to device coordinates (pixels), and normalize pDC->LPtoDP ( rcClip ); if ( mapmode != MM_TEXT ) { // Other mapping modes may lead to roundof errors, causing artefacts // on the screen. To compensate, we inflate the bounding rectangle with two pixels. CSize szPixels ( 2, 2 ); DPtoLP ( &szPixels ); rcClip.InflateRect ( szPixels.cx, szPixels.cy ); } ************/ // DAKOT removed: //FillSolidRect ( rcClip, col ); // Initialize accumulation of boundary information SetBoundsRect ( NULL, DCB_ENABLE | DCB_ACCUMULATE | DCB_RESET ); // DAKOT added here: FillSolidRect ( rcClip, col ); }
ReplyOriginally posted by: Jean Guillot
Hi,
Many thanks for your articles.
Is there a simple way to mix qttransformtracker and qzoomview ?
Best regards
Originally posted by: Alex Barket
In QTTDemo any operation like moving obj, pressing mouse key on tracker etc. goes to 100% CPU usage.
ReplyOriginally posted by: MartyCodeHo
I am very impressed with your work.
Thanks for the good work!
What a wonderful succinct tutorial. It is unusual to find such a large amount of functionality packed into such a small amount of code. The code compiles and works wonderfully, I had a minor problem with atan2 ambiguity in the compiler. I just cast the args to fix that. Works quickly and smoothly.
Originally posted by: Boris Monkey
This really is excellent. Not quite what i wanted, but hey, if i always found exactly what i wanted i wouldn't have to do any programming!
nice one.
Boris
Reply
Originally posted by: Zhifang Zhao
Thank you!
ReplyOriginally posted by: sunny
Great!
I'm working on some kind of object oriented drawing program, still having some issues with resizing of sheared rotated rectangles though ....
ReplyOriginally posted by: M.V.M.MuraliKrishna
Hai,
This really very good application.. . In my system if can execute your Exe no problem. But whenever if build the apllication i am getting an error "GdiplusMem.h" not found.
for that what i have to do? Pls tell me about this Problem