Hi
I'm trying to do some drawing in my plugin window using the gui, and I was hoping to use GetLoc to give me my current pen position, but in the example 'where' is always 0,0.
CDrawContext *DC,
CPoint where;
DC->moveTo(20, 20); // works
DC->getLoc (where); // always 0,0
So what would actually move the pen? I was even hoping that DC->drawString () would move the pen so I can find out where the string has ended. Any ideas?
As usual any help appreciated.
Greg Chapman
Newby drawing question
- KVRAF
- 12555 posts since 7 Dec, 2004
you should probably check the documentation for gdi if you're using vstgui in windows. i think those functions are just wrappers directly to the functions for gdi/quartz.
http://msdn.microsoft.com/library/defau ... t_9ezp.asp
ok, they're actually not. read vstgui.cpp from line 542 to see which functions modify ("CPoint penLoc")
for example
notice the very important #if GDIPLUS
obviously you must define GDIPLUS if you want getLoc() to work.
http://msdn.microsoft.com/library/defau ... v_4660.asp
here you can see, the implementation in vstgui is bugged and should be, in the getLoc() function:
you can do this modification yourself if you like, of course.
http://msdn.microsoft.com/library/defau ... t_9ezp.asp
ok, they're actually not. read vstgui.cpp from line 542 to see which functions modify ("CPoint penLoc")
for example
Code: Select all
920 void CDrawContext::moveTo (const CPoint &_point)
921 {
922 CPoint point (_point);
923 point.offset (offset.h, offset.v);
924
925 #if WINDOWS
926 #if GDIPLUS
927 penLoc = point;
928 #else
929 MoveToEx ((HDC)pSystemContext, point.h, point.v, NULL);
930 #endif
931
932 #elif MAC
933 penLoc = point;
934
935 #endif
936 }
obviously you must define GDIPLUS if you want getLoc() to work.
http://msdn.microsoft.com/library/defau ... v_4660.asp
here you can see, the implementation in vstgui is bugged and should be, in the getLoc() function:
Code: Select all
#ifdef WINDOWS
#ifdef GDIPLUS
return penLoc;
#else
::POINT p;
MoveToEx(hDC, 0, 0, &p);
MoveToEx(hDC, p.x, p.y, 0);
return CPoint(p.x, p.y);
#endif
#endif
... etc