diff --git a/reactos/base/applications/paint/drawing.c b/reactos/base/applications/paint/drawing.c index b7a787cd291..2bae28bce53 100644 --- a/reactos/base/applications/paint/drawing.c +++ b/reactos/base/applications/paint/drawing.c @@ -20,13 +20,13 @@ void Line(HDC hdc, short x1, short y1, short x2, short y2, int color, int thickn DeleteObject(SelectObject(hdc, oldPen)); } -void Rect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness, BOOL filled) +void Rect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness, int style) { HBRUSH oldBrush; LOGBRUSH logbrush; HPEN oldPen = SelectObject(hdc, CreatePen(PS_SOLID, thickness, fg)); - if (filled) logbrush.lbStyle = BS_SOLID; else logbrush.lbStyle = BS_HOLLOW; - logbrush.lbColor = bg; + if (style==0) logbrush.lbStyle = BS_HOLLOW; else logbrush.lbStyle = BS_SOLID; + if (style==2) logbrush.lbColor = fg; else logbrush.lbColor = bg; logbrush.lbHatch = 0; oldBrush = SelectObject(hdc, CreateBrushIndirect(&logbrush)); Rectangle(hdc, x1, y1, x2, y2); @@ -34,13 +34,13 @@ void Rect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int t DeleteObject(SelectObject(hdc, oldPen)); } -void Ellp(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness, BOOL filled) +void Ellp(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness, int style) { HBRUSH oldBrush; LOGBRUSH logbrush; HPEN oldPen = SelectObject(hdc, CreatePen(PS_SOLID, thickness, fg)); - if (filled) logbrush.lbStyle = BS_SOLID; else logbrush.lbStyle = BS_HOLLOW; - logbrush.lbColor = bg; + if (style==0) logbrush.lbStyle = BS_HOLLOW; else logbrush.lbStyle = BS_SOLID; + if (style==2) logbrush.lbColor = fg; else logbrush.lbColor = bg; logbrush.lbHatch = 0; oldBrush = SelectObject(hdc, CreateBrushIndirect(&logbrush)); Ellipse(hdc, x1, y1, x2, y2); @@ -48,13 +48,13 @@ void Ellp(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int t DeleteObject(SelectObject(hdc, oldPen)); } -void RRect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness, BOOL filled) +void RRect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness, int style) { LOGBRUSH logbrush; HBRUSH oldBrush; HPEN oldPen = SelectObject(hdc, CreatePen(PS_SOLID, thickness, fg)); - if (filled) logbrush.lbStyle = BS_SOLID; else logbrush.lbStyle = BS_HOLLOW; - logbrush.lbColor = bg; + if (style==0) logbrush.lbStyle = BS_HOLLOW; else logbrush.lbStyle = BS_SOLID; + if (style==2) logbrush.lbColor = fg; else logbrush.lbColor = bg; logbrush.lbHatch = 0; oldBrush = SelectObject(hdc, CreateBrushIndirect(&logbrush)); RoundRect(hdc, x1, y1, x2, y2, 16, 16); @@ -62,6 +62,35 @@ void RRect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int DeleteObject(SelectObject(hdc, oldPen)); } +void Poly(HDC hdc, POINT *lpPoints, int nCount, int fg, int bg, int thickness, int style, BOOL closed) +{ + LOGBRUSH logbrush; + HBRUSH oldBrush; + HPEN oldPen = SelectObject(hdc, CreatePen(PS_SOLID, thickness, fg)); + if (style==0) logbrush.lbStyle = BS_HOLLOW; else logbrush.lbStyle = BS_SOLID; + if (style==2) logbrush.lbColor = fg; else logbrush.lbColor = bg; + logbrush.lbHatch = 0; + oldBrush = SelectObject(hdc, CreateBrushIndirect(&logbrush)); + if (closed) + Polygon(hdc, lpPoints, nCount); + else + Polyline(hdc, lpPoints, nCount); + DeleteObject(SelectObject(hdc, oldBrush)); + DeleteObject(SelectObject(hdc, oldPen)); +} + +void Bezier(HDC hdc, POINT p1, POINT p2, POINT p3, POINT p4, int color, int thickness) +{ + POINT fourPoints[4]; + fourPoints[0] = p1; + fourPoints[1] = p2; + fourPoints[2] = p3; + fourPoints[3] = p4; + HPEN oldPen = SelectObject(hdc, CreatePen(PS_SOLID, thickness, color)); + PolyBezier(hdc, fourPoints, 4); + DeleteObject(SelectObject(hdc, oldPen)); +} + void Fill(HDC hdc, int x, int y, int color) { HBRUSH oldBrush = SelectObject(hdc, CreateSolidBrush(color)); @@ -81,6 +110,15 @@ void Erase(HDC hdc, short x1, short y1, short x2, short y2, int color, int radiu DeleteObject(SelectObject(hdc, oldPen)); } +void Replace(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int radius) +{ + short a, x, y; + for (a=0; a<=100; a++) + for (y=(y1*(100-a)+y2*a)/100-radius+1; y<(y1*(100-a)+y2*a)/100+radius+1; y++) + for (x=(x1*(100-a)+x2*a)/100-radius+1; x<(x1*(100-a)+x2*a)/100+radius+1; x++) + if (GetPixel(hdc, x, y)==fg) SetPixel(hdc, x, y, bg); +} + void Airbrush(HDC hdc, short x, short y, int color, int r) { short a; diff --git a/reactos/base/applications/paint/drawing.h b/reactos/base/applications/paint/drawing.h index 5b3390e6eba..71671d93384 100644 --- a/reactos/base/applications/paint/drawing.h +++ b/reactos/base/applications/paint/drawing.h @@ -8,16 +8,22 @@ void Line(HDC hdc, short x1, short y1, short x2, short y2, int color, int thickness); -void Rect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness, BOOL filled); +void Rect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness, int style); -void Ellp(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness, BOOL filled); +void Ellp(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness, int style); -void RRect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness, BOOL filled); +void RRect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness, int style); + +void Poly(HDC hdc, POINT *lpPoints, int nCount, int fg, int bg, int thickness, int style, BOOL closed); + +void Bezier(HDC hdc, POINT p1, POINT p2, POINT p3, POINT p4, int color, int thickness); void Fill(HDC hdc, int x, int y, int color); void Erase(HDC hdc, short x1, short y1, short x2, short y2, int color, int radius); +void Replace(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int radius); + void Airbrush(HDC hdc, short x, short y, int color, int r); void Brush(HDC hdc, short x1, short y1, short x2, short y2, int color, int style); diff --git a/reactos/base/applications/paint/globalvar.h b/reactos/base/applications/paint/globalvar.h index a0df72fa065..b864586a169 100644 --- a/reactos/base/applications/paint/globalvar.h +++ b/reactos/base/applications/paint/globalvar.h @@ -85,3 +85,8 @@ extern HWND hSizeboxRightCenter; extern HWND hSizeboxLeftBottom; extern HWND hSizeboxCenterBottom; extern HWND hSizeboxRightBottom; + +/* VARIABLES declared in mouse.c *************************************/ + +extern POINT pointStack[256]; +extern short pointSP; diff --git a/reactos/base/applications/paint/mouse.c b/reactos/base/applications/paint/mouse.c index 61aef297fb6..5328c796525 100644 --- a/reactos/base/applications/paint/mouse.c +++ b/reactos/base/applications/paint/mouse.c @@ -23,37 +23,70 @@ void placeSelWin() //SendMessage(hSelection, WM_PAINT, 0, 0); } -void startPainting(HDC hdc, short x, short y, int fg, int bg) +POINT pointStack[256]; +short pointSP; + +void startPaintingL(HDC hdc, short x, short y, int fg, int bg) { startX = x; startY = y; lastX = x; lastY = y; - if ((activeTool!=5)&&(activeTool!=6)) newReversible(); switch (activeTool) { + case 1: + case 10: + case 11: + case 15: + case 16: + newReversible(); case 2: + newReversible(); ShowWindow(hSelection, SW_HIDE); break; case 3: + newReversible(); Erase(hdc, x, y, x, y, bg, rubberRadius); break; case 4: + newReversible(); Fill(hdc, x, y, fg); break; case 7: + newReversible(); SetPixel(hdc, x, y, fg); break; case 8: + newReversible(); Brush(hdc, x, y, x, y, fg, brushStyle); break; case 9: + newReversible(); Airbrush(hdc, x, y, fg, airBrushWidth); break; + case 12: + pointStack[pointSP].x = x; + pointStack[pointSP].y = y; + if (pointSP==0) + { + newReversible(); + pointSP++; + } + break; + case 14: + pointStack[pointSP].x = x; + pointStack[pointSP].y = y; + if (pointSP+1>=2) Poly(hdc, pointStack, pointSP+1, fg, bg, lineWidth, shapeStyle, FALSE); + if (pointSP==0) + { + newReversible(); + pointSP++; + } + break; } } -void whilePainting(HDC hdc, short x, short y, int fg, int bg) +void whilePaintingL(HDC hdc, short x, short y, int fg, int bg) { switch (activeTool) { @@ -87,50 +120,34 @@ void whilePainting(HDC hdc, short x, short y, int fg, int bg) resetToU1(); Line(hdc, startX, startY, x, y, fg, lineWidth); break; + case 12: + resetToU1(); + pointStack[pointSP].x = x; + pointStack[pointSP].y = y; + switch (pointSP) + { + case 1: Line(hdc, pointStack[0].x, pointStack[0].y, pointStack[1].x, pointStack[1].y, fg, lineWidth); break; + case 2: Bezier(hdc, pointStack[0], pointStack[2], pointStack[2], pointStack[1], fg, lineWidth); break; + case 3: Bezier(hdc, pointStack[0], pointStack[2], pointStack[3], pointStack[1], fg, lineWidth); break; + } + break; case 13: resetToU1(); - switch (shapeStyle) - { - case 0: - Rect(hdc, startX, startY, x, y, fg, bg, lineWidth, FALSE); - break; - case 1: - Rect(hdc, startX, startY, x, y, fg, bg, lineWidth, TRUE); - break; - case 2: - Rect(hdc, startX, startY, x, y, fg, fg, lineWidth, TRUE); - break; - } + Rect(hdc, startX, startY, x, y, fg, bg, lineWidth, shapeStyle); + break; + case 14: + resetToU1(); + pointStack[pointSP].x = x; + pointStack[pointSP].y = y; + if (pointSP+1>=2) Poly(hdc, pointStack, pointSP+1, fg, bg, lineWidth, shapeStyle, FALSE); break; case 15: resetToU1(); - switch (shapeStyle) - { - case 0: - Ellp(hdc, startX, startY, x, y, fg, bg, lineWidth, FALSE); - break; - case 1: - Ellp(hdc, startX, startY, x, y, fg, bg, lineWidth, TRUE); - break; - case 2: - Ellp(hdc, startX, startY, x, y, fg, fg, lineWidth, TRUE); - break; - } + Ellp(hdc, startX, startY, x, y, fg, bg, lineWidth, shapeStyle); break; case 16: resetToU1(); - switch (shapeStyle) - { - case 0: - RRect(hdc, startX, startY, x, y, fg, bg, lineWidth, FALSE); - break; - case 1: - RRect(hdc, startX, startY, x, y, fg, bg, lineWidth, TRUE); - break; - case 2: - RRect(hdc, startX, startY, x, y, fg, fg, lineWidth, TRUE); - break; - } + RRect(hdc, startX, startY, x, y, fg, bg, lineWidth, shapeStyle); break; } @@ -138,7 +155,7 @@ void whilePainting(HDC hdc, short x, short y, int fg, int bg) lastY = y; } -void endPainting(HDC hdc, short x, short y, int fg, int bg) +void endPaintingL(HDC hdc, short x, short y, int fg, int bg) { switch (activeTool) { @@ -163,50 +180,204 @@ void endPainting(HDC hdc, short x, short y, int fg, int bg) resetToU1(); Line(hdc, startX, startY, x, y, fg, lineWidth); break; + case 12: + pointSP++; + if (pointSP==4) pointSP = 0; + break; case 13: resetToU1(); - switch (shapeStyle) + Rect(hdc, startX, startY, x, y, fg, bg, lineWidth, shapeStyle); + break; + case 14: + resetToU1(); + pointStack[pointSP].x = x; + pointStack[pointSP].y = y; + pointSP++; + if (pointSP>=2) { - case 0: - Rect(hdc, startX, startY, x, y, fg, bg, lineWidth, FALSE); - break; - case 1: - Rect(hdc, startX, startY, x, y, fg, bg, lineWidth, TRUE); - break; - case 2: - Rect(hdc, startX, startY, x, y, fg, fg, lineWidth, TRUE); - break; + if ( (pointStack[0].x-x)*(pointStack[0].x-x) + (pointStack[0].y-y)*(pointStack[0].y-y) <= lineWidth*lineWidth+1) + { + Poly(hdc, pointStack, pointSP, fg, bg, lineWidth, shapeStyle, TRUE); + pointSP = 0; + } + else + { + Poly(hdc, pointStack, pointSP, fg, bg, lineWidth, shapeStyle, FALSE); + } } + if (pointSP==255) pointSP--; break; case 15: resetToU1(); - switch (shapeStyle) - { - case 0: - Ellp(hdc, startX, startY, x, y, fg, bg, lineWidth, FALSE); - break; - case 1: - Ellp(hdc, startX, startY, x, y, fg, bg, lineWidth, TRUE); - break; - case 2: - Ellp(hdc, startX, startY, x, y, fg, fg, lineWidth, TRUE); - break; - } + Ellp(hdc, startX, startY, x, y, fg, bg, lineWidth, shapeStyle); break; case 16: resetToU1(); - switch (shapeStyle) + RRect(hdc, startX, startY, x, y, fg, bg, lineWidth, shapeStyle); + break; + } +} + +void startPaintingR(HDC hdc, short x, short y, int fg, int bg) +{ + startX = x; + startY = y; + lastX = x; + lastY = y; + switch (activeTool) + { + case 1: + case 10: + case 11: + case 15: + case 16: + newReversible(); + case 3: + newReversible(); + Replace(hdc, x, y, x, y, fg, bg, rubberRadius); + break; + case 4: + newReversible(); + Fill(hdc, x, y, bg); + break; + case 7: + newReversible(); + SetPixel(hdc, x, y, bg); + break; + case 8: + newReversible(); + Brush(hdc, x, y, x, y, bg, brushStyle); + break; + case 9: + newReversible(); + Airbrush(hdc, x, y, bg, airBrushWidth); + break; + case 12: + pointStack[pointSP].x = x; + pointStack[pointSP].y = y; + if (pointSP==0) { - case 0: - RRect(hdc, startX, startY, x, y, fg, bg, lineWidth, FALSE); - break; - case 1: - RRect(hdc, startX, startY, x, y, fg, bg, lineWidth, TRUE); - break; - case 2: - RRect(hdc, startX, startY, x, y, fg, fg, lineWidth, TRUE); - break; + newReversible(); + pointSP++; + } + break; + case 14: + pointStack[pointSP].x = x; + pointStack[pointSP].y = y; + if (pointSP+1>=2) Poly(hdc, pointStack, pointSP+1, bg, fg, lineWidth, shapeStyle, FALSE); + if (pointSP==0) + { + newReversible(); + pointSP++; } break; } } + +void whilePaintingR(HDC hdc, short x, short y, int fg, int bg) +{ + switch (activeTool) + { + case 3: + Replace(hdc, lastX, lastY, x, y, fg, bg, rubberRadius); + break; + case 7: + Line(hdc, lastX, lastY, x, y, bg, 1); + break; + case 8: + Brush(hdc, lastX, lastY, x, y, bg, brushStyle); + break; + case 9: + Airbrush(hdc, x, y, bg, airBrushWidth); + break; + case 11: + resetToU1(); + Line(hdc, startX, startY, x, y, bg, lineWidth); + break; + case 12: + resetToU1(); + pointStack[pointSP].x = x; + pointStack[pointSP].y = y; + switch (pointSP) + { + case 1: Line(hdc, pointStack[0].x, pointStack[0].y, pointStack[1].x, pointStack[1].y, bg, lineWidth); break; + case 2: Bezier(hdc, pointStack[0], pointStack[2], pointStack[2], pointStack[1], bg, lineWidth); break; + case 3: Bezier(hdc, pointStack[0], pointStack[2], pointStack[3], pointStack[1], bg, lineWidth); break; + } + break; + case 13: + resetToU1(); + Rect(hdc, startX, startY, x, y, bg, fg, lineWidth, shapeStyle); + break; + case 14: + resetToU1(); + pointStack[pointSP].x = x; + pointStack[pointSP].y = y; + if (pointSP+1>=2) Poly(hdc, pointStack, pointSP+1, bg, fg, lineWidth, shapeStyle, FALSE); + break; + case 15: + resetToU1(); + Ellp(hdc, startX, startY, x, y, bg, fg, lineWidth, shapeStyle); + break; + case 16: + resetToU1(); + RRect(hdc, startX, startY, x, y, bg, fg, lineWidth, shapeStyle); + break; + } + + lastX = x; + lastY = y; +} + +void endPaintingR(HDC hdc, short x, short y, int fg, int bg) +{ + switch (activeTool) + { + case 3: + Replace(hdc, lastX, lastY, x, y, fg, bg, rubberRadius); + break; + case 7: + Line(hdc, lastX, lastY, x, y, bg, 1); + SetPixel(hdc, x, y, bg); + break; + case 11: + resetToU1(); + Line(hdc, startX, startY, x, y, bg, lineWidth); + break; + case 12: + pointSP++; + if (pointSP==4) pointSP = 0; + break; + case 13: + resetToU1(); + Rect(hdc, startX, startY, x, y, bg, fg, lineWidth, shapeStyle); + break; + case 14: + resetToU1(); + pointStack[pointSP].x = x; + pointStack[pointSP].y = y; + pointSP++; + if (pointSP>=2) + { + if ( (pointStack[0].x-x)*(pointStack[0].x-x) + (pointStack[0].y-y)*(pointStack[0].y-y) <= lineWidth*lineWidth+1) + { + Poly(hdc, pointStack, pointSP, bg, fg, lineWidth, shapeStyle, TRUE); + pointSP = 0; + } + else + { + Poly(hdc, pointStack, pointSP, bg, fg, lineWidth, shapeStyle, FALSE); + } + } + if (pointSP==255) pointSP--; + break; + case 15: + resetToU1(); + Ellp(hdc, startX, startY, x, y, bg, fg, lineWidth, shapeStyle); + break; + case 16: + resetToU1(); + RRect(hdc, startX, startY, x, y, bg, fg, lineWidth, shapeStyle); + break; + } +} diff --git a/reactos/base/applications/paint/mouse.h b/reactos/base/applications/paint/mouse.h index c7223e2228a..878715efa21 100644 --- a/reactos/base/applications/paint/mouse.h +++ b/reactos/base/applications/paint/mouse.h @@ -8,8 +8,14 @@ void placeSelWin(); -void startPainting(HDC hdc, short x, short y, int fg, int bg); +void startPaintingL(HDC hdc, short x, short y, int fg, int bg); -void whilePainting(HDC hdc, short x, short y, int fg, int bg); +void whilePaintingL(HDC hdc, short x, short y, int fg, int bg); -void endPainting(HDC hdc, short x, short y, int fg, int bg); +void endPaintingL(HDC hdc, short x, short y, int fg, int bg); + +void startPaintingR(HDC hdc, short x, short y, int fg, int bg); + +void whilePaintingR(HDC hdc, short x, short y, int fg, int bg); + +void endPaintingR(HDC hdc, short x, short y, int fg, int bg); diff --git a/reactos/base/applications/paint/sizebox.c b/reactos/base/applications/paint/sizebox.c index 8324123e8fd..60d0a033189 100644 --- a/reactos/base/applications/paint/sizebox.c +++ b/reactos/base/applications/paint/sizebox.c @@ -9,10 +9,10 @@ /* INCLUDES *********************************************************/ #include +#include +#include #include "globalvar.h" -#include "drawing.h" #include "history.h" -#include "mouse.h" /* FUNCTIONS ********************************************************/ @@ -43,7 +43,31 @@ LRESULT CALLBACK SizeboxWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM SetCapture(hwnd); break; case WM_MOUSEMOVE: - // TODO: print things in the status bar + if (resizing) + { + TCHAR sizeStr[100]; + short xRel; + short yRel; + xRel = ((short)LOWORD(lParam)-xOrig)*1000/zoom; + yRel = ((short)HIWORD(lParam)-yOrig)*1000/zoom; + if (hwnd==hSizeboxLeftTop) + _stprintf(sizeStr, _T("%d x %d"), imgXRes-xRel, imgYRes-yRel); + if (hwnd==hSizeboxCenterTop) + _stprintf(sizeStr, _T("%d x %d"), imgXRes, imgYRes-yRel); + if (hwnd==hSizeboxRightTop) + _stprintf(sizeStr, _T("%d x %d"), imgXRes+xRel, imgYRes-yRel); + if (hwnd==hSizeboxLeftCenter) + _stprintf(sizeStr, _T("%d x %d"), imgXRes-xRel, imgYRes); + if (hwnd==hSizeboxRightCenter) + _stprintf(sizeStr, _T("%d x %d"), imgXRes+xRel, imgYRes); + if (hwnd==hSizeboxLeftBottom) + _stprintf(sizeStr, _T("%d x %d"), imgXRes-xRel, imgYRes+yRel); + if (hwnd==hSizeboxCenterBottom) + _stprintf(sizeStr, _T("%d x %d"), imgXRes, imgYRes+yRel); + if (hwnd==hSizeboxRightBottom) + _stprintf(sizeStr, _T("%d x %d"), imgXRes+xRel, imgYRes+yRel); + SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM)sizeStr); + } break; case WM_LBUTTONUP: if (resizing) @@ -70,6 +94,7 @@ LRESULT CALLBACK SizeboxWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM cropReversible(imgXRes, imgYRes+yRel, 0, 0); if (hwnd==hSizeboxRightBottom) cropReversible(imgXRes+xRel, imgYRes+yRel, 0, 0); + SendMessage(hStatusBar, SB_SETTEXT, 2, (LPARAM)_T("")); } break; diff --git a/reactos/base/applications/paint/toolsettings.c b/reactos/base/applications/paint/toolsettings.c index b5141eb7c64..8f7de9eb1d3 100644 --- a/reactos/base/applications/paint/toolsettings.c +++ b/reactos/base/applications/paint/toolsettings.c @@ -148,14 +148,14 @@ LRESULT CALLBACK SettingsWinProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM } } if (shapeStyle==0) - Rect(hdc, 5, 6, 37, 16, GetSysColor(COLOR_HIGHLIGHTTEXT), GetSysColor(COLOR_APPWORKSPACE), 1, FALSE); + Rect(hdc, 5, 6, 37, 16, GetSysColor(COLOR_HIGHLIGHTTEXT), GetSysColor(COLOR_APPWORKSPACE), 1, 0); else - Rect(hdc, 5, 6, 37, 16, GetSysColor(COLOR_WINDOWTEXT), GetSysColor(COLOR_APPWORKSPACE), 1, FALSE); + Rect(hdc, 5, 6, 37, 16, GetSysColor(COLOR_WINDOWTEXT), GetSysColor(COLOR_APPWORKSPACE), 1, 0); if (shapeStyle==1) - Rect(hdc, 5, 26, 37, 36, GetSysColor(COLOR_HIGHLIGHTTEXT), GetSysColor(COLOR_APPWORKSPACE), 1, TRUE); + Rect(hdc, 5, 26, 37, 36, GetSysColor(COLOR_HIGHLIGHTTEXT), GetSysColor(COLOR_APPWORKSPACE), 1, 1); else - Rect(hdc, 5, 26, 37, 36, GetSysColor(COLOR_WINDOWTEXT), GetSysColor(COLOR_APPWORKSPACE), 1, TRUE); - Rect(hdc, 5, 46, 37, 56, GetSysColor(COLOR_APPWORKSPACE), GetSysColor(COLOR_APPWORKSPACE), 1, TRUE); + Rect(hdc, 5, 26, 37, 36, GetSysColor(COLOR_WINDOWTEXT), GetSysColor(COLOR_APPWORKSPACE), 1, 1); + Rect(hdc, 5, 46, 37, 56, GetSysColor(COLOR_APPWORKSPACE), GetSysColor(COLOR_APPWORKSPACE), 1, 1); for (i=0; i<5; i++) { if (lineWidth==i+1) diff --git a/reactos/base/applications/paint/winproc.c b/reactos/base/applications/paint/winproc.c index 0160bf690e4..4e72294a99b 100644 --- a/reactos/base/applications/paint/winproc.c +++ b/reactos/base/applications/paint/winproc.c @@ -29,6 +29,7 @@ void selectTool(int tool) { ShowWindow(hSelection, SW_HIDE); activeTool = tool; + pointSP = 0; // resets the point-buffer of the polygon and bezier functions SendMessage(hToolSettings, WM_PAINT, 0, 0); } @@ -354,7 +355,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM { SetCapture(hImageArea); drawing = TRUE; - startPainting(hDrawingDC, LOWORD(lParam)*1000/zoom, HIWORD(lParam)*1000/zoom, fgColor, bgColor); + startPaintingL(hDrawingDC, LOWORD(lParam)*1000/zoom, HIWORD(lParam)*1000/zoom, fgColor, bgColor); }else { SendMessage(hwnd, WM_LBUTTONUP, wParam, lParam); @@ -371,7 +372,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM { SetCapture(hImageArea); drawing = TRUE; - startPainting(hDrawingDC, LOWORD(lParam)*1000/zoom, HIWORD(lParam)*1000/zoom, bgColor, fgColor); + startPaintingR(hDrawingDC, LOWORD(lParam)*1000/zoom, HIWORD(lParam)*1000/zoom, fgColor, bgColor); }else { SendMessage(hwnd, WM_RBUTTONUP, wParam, lParam); @@ -386,7 +387,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM { ReleaseCapture(); drawing = FALSE; - endPainting(hDrawingDC, LOWORD(lParam)*1000/zoom, HIWORD(lParam)*1000/zoom, fgColor, bgColor); + endPaintingL(hDrawingDC, LOWORD(lParam)*1000/zoom, HIWORD(lParam)*1000/zoom, fgColor, bgColor); SendMessage(hImageArea, WM_PAINT, 0, 0); if (activeTool==5) { @@ -402,7 +403,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM { ReleaseCapture(); drawing = FALSE; - endPainting(hDrawingDC, LOWORD(lParam)*1000/zoom, HIWORD(lParam)*1000/zoom, bgColor, fgColor); + endPaintingR(hDrawingDC, LOWORD(lParam)*1000/zoom, HIWORD(lParam)*1000/zoom, fgColor, bgColor); SendMessage(hImageArea, WM_PAINT, 0, 0); if (activeTool==5) { @@ -426,7 +427,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM { if ((wParam&MK_LBUTTON)!=0) { - whilePainting(hDrawingDC, LOWORD(lParam)*1000/zoom, HIWORD(lParam)*1000/zoom, fgColor, bgColor); + whilePaintingL(hDrawingDC, (short)LOWORD(lParam)*1000/zoom, (short)HIWORD(lParam)*1000/zoom, fgColor, bgColor); SendMessage(hImageArea, WM_PAINT, 0, 0); if ((activeTool>=10)||(activeTool==2)) { @@ -437,7 +438,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM } if ((wParam&MK_RBUTTON)!=0) { - whilePainting(hDrawingDC, LOWORD(lParam)*1000/zoom, HIWORD(lParam)*1000/zoom, bgColor, fgColor); + whilePaintingR(hDrawingDC, (short)LOWORD(lParam)*1000/zoom, (short)HIWORD(lParam)*1000/zoom, fgColor, bgColor); SendMessage(hImageArea, WM_PAINT, 0, 0); if (activeTool>=10) { @@ -564,9 +565,9 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM case IDM_EDITSELECTALL: if (activeTool==2) { - startPainting(hDrawingDC, 0, 0, fgColor, bgColor); - whilePainting(hDrawingDC, imgXRes, imgYRes, fgColor, bgColor); - endPainting(hDrawingDC, imgXRes, imgYRes, fgColor, bgColor); + startPaintingL(hDrawingDC, 0, 0, fgColor, bgColor); + whilePaintingL(hDrawingDC, imgXRes, imgYRes, fgColor, bgColor); + endPaintingL(hDrawingDC, imgXRes, imgYRes, fgColor, bgColor); } break; case IDM_EDITCOPYTO: