m_logicalScaleY = 1.0;
m_userScaleX = 1.0;
m_userScaleY = 1.0;
+ m_signX = 1;
+ m_signY = 1;
m_systemScaleX = 1.0;
m_systemScaleY = 1.0;
m_mappingMode = MM_TEXT;
// returns TRUE for pixels in the color of the current pen
// and FALSE for all other pixels colors
// if col is non-NULL return the color of the pixel
-/*
- int xx1 = (int)x;
- int yy1 = (int)y;
- if (m_canvas)
- m_canvas->CalcScrolledPosition((int)x, (int)y, &xx1, &yy1);
-*/
// get the color of the pixel
COLORREF pixelcolor = ::GetPixel((HDC) m_hDC, XLOG2DEV(x), YLOG2DEV(y));
long y1 = y-2000;
long x2 = x+2000;
long y2 = y+2000;
-/*
- long xx1 = x1 ;
- long yy1 = y1 ;
- long xx2 = x2 ;
- long yy2 = y2 ;
- long xx = x ;
- long yy = y ;
-
- if (m_canvas)
- {
- m_canvas->CalcScrolledPosition(x1, y1, &xx1, &yy1);
- m_canvas->CalcScrolledPosition(x2, y2, &xx2, &yy2);
- m_canvas->CalcScrolledPosition(x, y, &xx, &yy);
- }
-*/
BeginDrawing();
// BUGBUG - is this necessary? YES YES YES YEs Yes yes ye....
if (m_pen.Ok() && m_autoSetting)
SetPen(m_pen);
-/*
- int xx1 = (int)x1;
- int yy1 = (int)y1;
- int xx2 = (int)x2;
- int yy2 = (int)y2;
- if (m_canvas)
- {
- m_canvas->CalcScrolledPosition((int)x1, (int)y1, &xx1, &yy1);
- m_canvas->CalcScrolledPosition((int)x2, (int)y2, &xx2, &yy2);
- }
-*/
BeginDrawing();
void wxDC::DrawArc(long x1,long y1,long x2,long y2,double xc,double yc)
{
-/*
- int xx1 = (int)x1;
- int yy1 = (int)y1;
- int xx2 = (int)x2;
- int yy2 = (int)y2;
- int xxc = (int)xc ;
- int yyc = (int)yc;
-*/
-
double dx = xc-x1 ;
double dy = yc-y1 ;
double radius = (double)sqrt(dx*dx+dy*dy) ;;
if (m_pen.Ok() && m_autoSetting)
SetPen(m_pen) ;
-/*
- if (m_canvas)
- {
- m_canvas->CalcScrolledPosition((int)x1, (int)y1, &xx1, &yy1);
- m_canvas->CalcScrolledPosition((int)x2, (int)y2, &xx2, &yy2);
- m_canvas->CalcScrolledPosition((int)xc, (int)yc, &xxc, &yyc);
- }
-*/
-
BeginDrawing();
long xx1 = XLOG2DEV(x1) ;
CalcBoundingBox((xc+radius), (yc+radius));
}
-void wxDC::DrawEllipticArc(long WXUNUSED(x),long WXUNUSED(y),long WXUNUSED(w),long WXUNUSED(h),double WXUNUSED(sa),double WXUNUSED(ea))
-{
- // Not implemented
-}
-
void wxDC::DrawPoint(long x, long y)
{
// BUGBUG - is this necessary?
if (m_pen.Ok() && m_autoSetting)
SetPen(m_pen) ;
-/*
- int xx1 = (int)x;
- int yy1 = (int)y;
- if (m_canvas)
- m_canvas->CalcScrolledPosition((int)x, (int)y, &xx1, &yy1);
-*/
-
BeginDrawing();
COLORREF color = 0x00ffffff;
color = m_pen.GetColour().GetPixel() ;
}
-/*
- color = RGB(m_pen->GetColour().Red(),
- m_pen->GetColour().Green(),
- m_pen->GetColour().Blue());
-*/
-
SetPixel((HDC) m_hDC, XLOG2DEV(x), YLOG2DEV(y), color);
EndDrawing();
// BUGBUG - is this necessary?
if (m_pen.Ok() && m_autoSetting)
SetPen(m_pen) ;
-/*
- int xoffset1 = 0;
- int yoffset1 = 0;
-
- if (m_canvas)
- m_canvas->CalcScrolledPosition(0, 0, &xoffset1, &yoffset1);
-
- xoffset1 += (int)xoffset; yoffset1 += (int)yoffset;
-*/
BeginDrawing();
int i;
for (i = 0; i < n; i++)
{
- cpoints[i].x = (int)(XLOG2DEV(points[i].x));
- cpoints[i].y = (int)(YLOG2DEV(points[i].y));
+ cpoints[i].x = (int)(XLOG2DEV(points[i].x + xoffset));
+ cpoints[i].y = (int)(YLOG2DEV(points[i].y + yoffset));
- CalcBoundingBox(points[i].x, points[i].y);
+ CalcBoundingBox(points[i].x + xoffset, points[i].y + yoffset);
}
int prev = SetPolyFillMode((HDC) m_hDC,fillStyle==wxODDEVEN_RULE?ALTERNATE:WINDING) ;
if (m_pen.Ok() && m_autoSetting)
SetPen(m_pen) ;
-/*
- int xoffset1 = 0;
- int yoffset1 = 0;
-
- if (m_canvas)
- {
- m_canvas->CalcScrolledPosition(0, 0, &xoffset1, &yoffset1);
- }
- xoffset1 += (int)xoffset; yoffset1 += (int)yoffset;
-*/
-
BeginDrawing();
POINT *cpoints = new POINT[n];
int i;
for (i = 0; i < n; i++)
{
- cpoints[i].x = (int)(XLOG2DEV(points[i].x));
- cpoints[i].y = (int)(YLOG2DEV(points[i].y));
+ cpoints[i].x = (int)(XLOG2DEV(points[i].x + xoffset));
+ cpoints[i].y = (int)(YLOG2DEV(points[i].y + yoffset));
- CalcBoundingBox(points[i].x, points[i].y);
+ CalcBoundingBox(points[i].x + xoffset, points[i].y + yoffset);
}
(void)Polyline((HDC) m_hDC, cpoints, n);
if (m_pen.Ok() && m_autoSetting)
SetPen(m_pen) ;
-/*
- int x1 = (int)x;
- int y1 = (int)y;
- int x2 = (int)(x+width);
- int y2 = (int)(y+height);
-
- if (m_canvas)
- {
- m_canvas->CalcScrolledPosition((int)x, (int)y, &x1, &y1);
- m_canvas->CalcScrolledPosition((int)(x+width), (int)(y+height), &x2, &y2);
- }
-*/
long x2 = x + width;
long y2 = y + height;
radius = (- radius * smallest);
}
-/*
- int x1 = (int)x;
- int y1 = (int)y;
-
- if (m_canvas)
- {
- m_canvas->CalcScrolledPosition((int)x, (int)y, &x1, &y1);
- m_canvas->CalcScrolledPosition((int)(x+width), (int)(y+height), &x2, &y2);
- }
-*/
-
long x2 = (x+width);
long y2 = (y+height);
if (m_pen.Ok() && m_autoSetting)
SetPen(m_pen) ;
-/*
- int x1 = (int)x;
- int y1 = (int)y;
-
- if (m_canvas)
- {
- m_canvas->CalcScrolledPosition((int)x, (int)y, &x1, &y1);
- m_canvas->CalcScrolledPosition((int)(x+width), (int)(y+height), &x2, &y2);
- }
-*/
-
long x2 = (x+width);
long y2 = (y+height);
CalcBoundingBox(x2, y2);
}
-void wxDC::DrawIcon(const wxIcon& icon, long x, long y)
+// Chris Breeze 20/5/98: first implementation of DrawEllipticArc on Windows
+void wxDC::DrawEllipticArc(long x,long y,long w,long h,double sa,double ea)
{
-/*
- int x1 = (int)x;
- int y1 = (int)y;
+// BUGBUG - is this necessary?
+ if (m_pen.Ok() && m_autoSetting)
+ SetPen(m_pen) ;
- if (m_canvas)
- m_canvas->CalcScrolledPosition(int)x, (int)y, &x1, &y1);
-*/
+ long x2 = (x+w);
+ long y2 = (y+h);
+
+ BeginDrawing();
+
+ const double deg2rad = 3.14159265359 / 180.0;
+ int rx1 = XLOG2DEV(x+w/2);
+ int ry1 = YLOG2DEV(y+h/2);
+ int rx2 = rx1;
+ int ry2 = ry1;
+ rx1 += (int)(100.0 * abs(w) * cos(sa * deg2rad));
+ ry1 -= (int)(100.0 * abs(h) * m_signY * sin(sa * deg2rad));
+ rx2 += (int)(100.0 * abs(w) * cos(ea * deg2rad));
+ ry2 -= (int)(100.0 * abs(h) * m_signY * sin(ea * deg2rad));
+
+ // draw pie with NULL_PEN first and then outline otherwise a line is
+ // drawn from the start and end points to the centre
+ HPEN orig_pen = ::SelectObject((HDC) m_hDC, ::GetStockObject(NULL_PEN));
+ if (m_signY > 0)
+ {
+ (void)Pie((HDC) m_hDC, XLOG2DEV(x), YLOG2DEV(y), XLOG2DEV(x2)+1, YLOG2DEV(y2)+1,
+ rx1, ry1, rx2, ry2);
+ }
+ else
+ {
+ (void)Pie((HDC) m_hDC, XLOG2DEV(x), YLOG2DEV(y)-1, XLOG2DEV(x2)+1, YLOG2DEV(y2),
+ rx1, ry1-1, rx2, ry2-1);
+ }
+ ::SelectObject((HDC) m_hDC, orig_pen);
+ (void)Arc((HDC) m_hDC, XLOG2DEV(x), YLOG2DEV(y), XLOG2DEV(x2), YLOG2DEV(y2),
+ rx1, ry1, rx2, ry2);
+
+ EndDrawing();
+
+ CalcBoundingBox(x, y);
+ CalcBoundingBox(x2, y2);
+}
+void wxDC::DrawIcon(const wxIcon& icon, long x, long y)
+{
BeginDrawing();
::DrawIcon((HDC) m_hDC, XLOG2DEV(x), YLOG2DEV(y), (HICON) icon.GetHICON());
void wxDC::DrawText(const wxString& text, long x, long y, bool use16bit)
{
-/*
- int xx1 = (int)x;
- int yy1 = (int)y;
-
- if (m_canvas)
- m_canvas->CalcScrolledPosition((int)x, (int)y, &xx1, &yy1);
-*/
-
BeginDrawing();
if (m_font.Ok() && m_font.GetResourceHandle())
SetMapMode(m_mappingMode);
}
+void wxDC::SetAxisOrientation(bool xLeftRight, bool yBottomUp)
+{
+ m_signX = xLeftRight ? 1 : -1;
+ m_signY = yBottomUp ? -1 : 1;
+
+ SetMapMode(m_mappingMode);
+}
+
void wxDC::SetSystemScale(double x, double y)
{
m_systemScaleX = x;
long wxDC::DeviceToLogicalX(long x) const
{
- return (long) (((x) - m_deviceOriginX)/(m_logicalScaleX*m_userScaleX*m_systemScaleX) - m_logicalOriginX) ;
+ return (long) (((x) - m_deviceOriginX)/(m_logicalScaleX*m_userScaleX*m_signX*m_systemScaleX) - m_logicalOriginX) ;
}
long wxDC::DeviceToLogicalXRel(long x) const
{
- return (long) ((x)/(m_logicalScaleX*m_userScaleX*m_systemScaleX)) ;
+ return (long) ((x)/(m_logicalScaleX*m_userScaleX*m_signX*m_systemScaleX)) ;
}
long wxDC::DeviceToLogicalY(long y) const
{
- return (long) (((y) - m_deviceOriginY)/(m_logicalScaleY*m_userScaleY*m_systemScaleY) - m_logicalOriginY) ;
+ return (long) (((y) - m_deviceOriginY)/(m_logicalScaleY*m_userScaleY*m_signY*m_systemScaleY) - m_logicalOriginY) ;
}
long wxDC::DeviceToLogicalYRel(long y) const
{
- return (long) ((y)/(m_logicalScaleY*m_userScaleY*m_systemScaleY)) ;
+ return (long) ((y)/(m_logicalScaleY*m_userScaleY*m_signY*m_systemScaleY)) ;
}
long wxDC::LogicalToDeviceX(long x) const
{
- return (long) (floor((x) - m_logicalOriginX)*m_logicalScaleX*m_userScaleX*m_systemScaleX + m_deviceOriginX) ;
+ return (long) (floor((x) - m_logicalOriginX)*m_logicalScaleX*m_userScaleX*m_signX*m_systemScaleX + m_deviceOriginX) ;
}
long wxDC::LogicalToDeviceXRel(long x) const
{
- return (long) (floor(x)*m_logicalScaleX*m_userScaleX*m_systemScaleX) ;
+ return (long) (floor(x)*m_logicalScaleX*m_userScaleX*m_signX*m_systemScaleX) ;
}
long wxDC::LogicalToDeviceY(long y) const
{
- return (long) (floor((y) - m_logicalOriginY)*m_logicalScaleY*m_userScaleY*m_systemScaleY + m_deviceOriginY);
+ return (long) (floor((y) - m_logicalOriginY)*m_logicalScaleY*m_userScaleY*m_signY*m_systemScaleY + m_deviceOriginY);
}
long wxDC::LogicalToDeviceYRel(long y) const
{
- return (long) (floor(y)*m_logicalScaleY*m_userScaleY*m_systemScaleY) ;
+ return (long) (floor(y)*m_logicalScaleY*m_userScaleY*m_signY*m_systemScaleY) ;
}
// This group of functions may not do any conversion
long xsrc1 = xsrc;
long ysrc1 = ysrc;
+ // Chris Breeze 18/5/98: use text foreground/background colours
+ // when blitting from 1-bit bitmaps
+ COLORREF old_textground = ::GetTextColor((HDC)m_hDC);
+ COLORREF old_background = ::GetBkColor((HDC)m_hDC);
+ if (m_textForegroundColour.Ok())
+ {
+ ::SetTextColor((HDC) m_hDC, m_textForegroundColour.GetPixel() ) ;
+ }
+ if (m_textBackgroundColour.Ok())
+ {
+ ::SetBkColor((HDC) m_hDC, m_textBackgroundColour.GetPixel() ) ;
+ }
+
DWORD dwRop = rop == wxCOPY ? SRCCOPY :
rop == wxCLEAR ? WHITENESS :
rop == wxSET ? BLACKNESS :
success = (BitBlt((HDC) m_hDC, xdest1, ydest1, (int)width, (int)height, (HDC) source->m_hDC,
xsrc1, ysrc1, dwRop) != 0);
}
+ ::SetTextColor((HDC)m_hDC, old_textground);
+ ::SetBkColor((HDC)m_hDC, old_background);
source->EndDrawing();
EndDrawing();
*height = h;
}
+/*
#if USE_SPLINES
# if USE_XFIG_SPLINE_CODE
# include "../common/xfspline.inc"
# include "../common/wxspline.inc"
# endif
#endif // USE_SPLINES
+*/
+
+#if USE_SPLINES
+#include "xfspline.inc"
+#endif // USE_SPLINES
void wxDC::DrawPolygon(wxList *list, long xoffset, long yoffset,int fillStyle)
{