ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

mouse.c
Go to the documentation of this file.
00001 /*
00002  * PROJECT:     PAINT for ReactOS
00003  * LICENSE:     LGPL
00004  * FILE:        base/applications/paint/mouse.c
00005  * PURPOSE:     Things which should not be in the mouse event handler itself
00006  * PROGRAMMERS: Benedikt Freisen
00007  */
00008 
00009 /* INCLUDES *********************************************************/
00010 
00011 #include "precomp.h"
00012 
00013 /* FUNCTIONS ********************************************************/
00014 
00015 void
00016 placeSelWin()
00017 {
00018     MoveWindow(hSelection, rectSel_dest[0] * zoom / 1000, rectSel_dest[1] * zoom / 1000,
00019                rectSel_dest[2] * zoom / 1000 + 6, rectSel_dest[3] * zoom / 1000 + 6, TRUE);
00020     BringWindowToTop(hSelection);
00021     SendMessage(hImageArea, WM_PAINT, 0, 0);
00022     //SendMessage(hSelection, WM_PAINT, 0, 0);
00023 }
00024 
00025 void
00026 regularize(LONG x0, LONG y0, LONG *x1, LONG *y1)
00027 {
00028     if (abs(*x1 - x0) >= abs(*y1 - y0))
00029         *y1 = y0 + (*y1 > y0 ? abs(*x1 - x0) : -abs(*x1 - x0));
00030     else
00031         *x1 = x0 + (*x1 > x0 ? abs(*y1 - y0) : -abs(*y1 - y0));
00032 }
00033 
00034 void
00035 roundTo8Directions(LONG x0, LONG y0, LONG *x1, LONG *y1)
00036 {
00037     if (abs(*x1 - x0) >= abs(*y1 - y0))
00038     {
00039         if (abs(*y1 - y0) * 5 < abs(*x1 - x0) * 2)
00040             *y1 = y0;
00041         else
00042             *y1 = y0 + (*y1 > y0 ? abs(*x1 - x0) : -abs(*x1 - x0));
00043     }
00044     else
00045     {
00046         if (abs(*x1 - x0) * 5 < abs(*y1 - y0) * 2)
00047             *x1 = x0;
00048         else
00049             *x1 = x0 + (*x1 > x0 ? abs(*y1 - y0) : -abs(*y1 - y0));
00050     }
00051 }
00052 
00053 POINT pointStack[256];
00054 short pointSP;
00055 POINT *ptStack = NULL;
00056 int ptSP = 0;
00057 
00058 void
00059 startPaintingL(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg)
00060 {
00061     startX = x;
00062     startY = y;
00063     lastX = x;
00064     lastY = y;
00065     switch (activeTool)
00066     {
00067         case TOOL_FREESEL:
00068             ShowWindow(hSelection, SW_HIDE);
00069             if (ptStack != NULL)
00070                 HeapFree(GetProcessHeap(), 0, ptStack);
00071             ptStack = HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, sizeof(POINT) * 1024);
00072             ptSP = 0;
00073             ptStack[0].x = x;
00074             ptStack[0].y = y;
00075             break;
00076         case TOOL_TEXT:
00077         case TOOL_LINE:
00078         case TOOL_RECT:
00079         case TOOL_ELLIPSE:
00080         case TOOL_RRECT:
00081             newReversible();
00082             break;
00083         case TOOL_RECTSEL:
00084             newReversible();
00085             ShowWindow(hSelection, SW_HIDE);
00086             rectSel_src[2] = rectSel_src[3] = 0;
00087             break;
00088         case TOOL_RUBBER:
00089             newReversible();
00090             Erase(hdc, x, y, x, y, bg, rubberRadius);
00091             break;
00092         case TOOL_FILL:
00093             newReversible();
00094             Fill(hdc, x, y, fg);
00095             break;
00096         case TOOL_PEN:
00097             newReversible();
00098             SetPixel(hdc, x, y, fg);
00099             break;
00100         case TOOL_BRUSH:
00101             newReversible();
00102             Brush(hdc, x, y, x, y, fg, brushStyle);
00103             break;
00104         case TOOL_AIRBRUSH:
00105             newReversible();
00106             Airbrush(hdc, x, y, fg, airBrushWidth);
00107             break;
00108         case TOOL_BEZIER:
00109             pointStack[pointSP].x = x;
00110             pointStack[pointSP].y = y;
00111             if (pointSP == 0)
00112             {
00113                 newReversible();
00114                 pointSP++;
00115             }
00116             break;
00117         case TOOL_SHAPE:
00118             pointStack[pointSP].x = x;
00119             pointStack[pointSP].y = y;
00120             if (pointSP + 1 >= 2)
00121                 Poly(hdc, pointStack, pointSP + 1, fg, bg, lineWidth, shapeStyle, FALSE);
00122             if (pointSP == 0)
00123             {
00124                 newReversible();
00125                 pointSP++;
00126             }
00127             break;
00128     }
00129 }
00130 
00131 void
00132 whilePaintingL(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg)
00133 {
00134     switch (activeTool)
00135     {
00136         case TOOL_FREESEL:
00137             if (ptSP == 0)
00138                 newReversible();
00139             ptSP++;
00140             if (ptSP % 1024 == 0)
00141                 ptStack = HeapReAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, ptStack, sizeof(POINT) * (ptSP + 1024));
00142             ptStack[ptSP].x = max(0, min(x, imgXRes));
00143             ptStack[ptSP].y = max(0, min(y, imgYRes));
00144             resetToU1();
00145             Poly(hdc, ptStack, ptSP + 1, 0, 0, 2, 0, FALSE);
00146             break;
00147         case TOOL_RECTSEL:
00148         {
00149             int tempX;
00150             int tempY;
00151             resetToU1();
00152             tempX = max(0, min(x, imgXRes));
00153             tempY = max(0, min(y, imgYRes));
00154             rectSel_dest[0] = rectSel_src[0] = min(startX, tempX);
00155             rectSel_dest[1] = rectSel_src[1] = min(startY, tempY);
00156             rectSel_dest[2] = rectSel_src[2] = max(startX, tempX) - min(startX, tempX);
00157             rectSel_dest[3] = rectSel_src[3] = max(startY, tempY) - min(startY, tempY);
00158             RectSel(hdc, startX, startY, tempX, tempY);
00159             break;
00160         }
00161         case TOOL_RUBBER:
00162             Erase(hdc, lastX, lastY, x, y, bg, rubberRadius);
00163             break;
00164         case TOOL_PEN:
00165             Line(hdc, lastX, lastY, x, y, fg, 1);
00166             break;
00167         case TOOL_BRUSH:
00168             Brush(hdc, lastX, lastY, x, y, fg, brushStyle);
00169             break;
00170         case TOOL_AIRBRUSH:
00171             Airbrush(hdc, x, y, fg, airBrushWidth);
00172             break;
00173         case TOOL_LINE:
00174             resetToU1();
00175             if (GetAsyncKeyState(VK_SHIFT) < 0)
00176                 roundTo8Directions(startX, startY, &x, &y);
00177             Line(hdc, startX, startY, x, y, fg, lineWidth);
00178             break;
00179         case TOOL_BEZIER:
00180             resetToU1();
00181             pointStack[pointSP].x = x;
00182             pointStack[pointSP].y = y;
00183             switch (pointSP)
00184             {
00185                 case 1:
00186                     Line(hdc, pointStack[0].x, pointStack[0].y, pointStack[1].x, pointStack[1].y, fg,
00187                          lineWidth);
00188                     break;
00189                 case 2:
00190                     Bezier(hdc, pointStack[0], pointStack[2], pointStack[2], pointStack[1], fg, lineWidth);
00191                     break;
00192                 case 3:
00193                     Bezier(hdc, pointStack[0], pointStack[2], pointStack[3], pointStack[1], fg, lineWidth);
00194                     break;
00195             }
00196             break;
00197         case TOOL_RECT:
00198             resetToU1();
00199             if (GetAsyncKeyState(VK_SHIFT) < 0)
00200                 regularize(startX, startY, &x, &y);
00201             Rect(hdc, startX, startY, x, y, fg, bg, lineWidth, shapeStyle);
00202             break;
00203         case TOOL_SHAPE:
00204             resetToU1();
00205             pointStack[pointSP].x = x;
00206             pointStack[pointSP].y = y;
00207             if ((pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0))
00208                 roundTo8Directions(pointStack[pointSP - 1].x, pointStack[pointSP - 1].y,
00209                                    &pointStack[pointSP].x, &pointStack[pointSP].y);
00210             if (pointSP + 1 >= 2)
00211                 Poly(hdc, pointStack, pointSP + 1, fg, bg, lineWidth, shapeStyle, FALSE);
00212             break;
00213         case TOOL_ELLIPSE:
00214             resetToU1();
00215             if (GetAsyncKeyState(VK_SHIFT) < 0)
00216                 regularize(startX, startY, &x, &y);
00217             Ellp(hdc, startX, startY, x, y, fg, bg, lineWidth, shapeStyle);
00218             break;
00219         case TOOL_RRECT:
00220             resetToU1();
00221             if (GetAsyncKeyState(VK_SHIFT) < 0)
00222                 regularize(startX, startY, &x, &y);
00223             RRect(hdc, startX, startY, x, y, fg, bg, lineWidth, shapeStyle);
00224             break;
00225     }
00226 
00227     lastX = x;
00228     lastY = y;
00229 }
00230 
00231 void
00232 endPaintingL(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg)
00233 {
00234     switch (activeTool)
00235     {
00236         case TOOL_FREESEL:
00237         {
00238             POINT *ptStackCopy;
00239             int i;
00240             rectSel_src[0] = rectSel_src[1] = 0x7fffffff;
00241             rectSel_src[2] = rectSel_src[3] = 0;
00242             for (i = 0; i <= ptSP; i++)
00243             {
00244                 if (ptStack[i].x < rectSel_src[0])
00245                     rectSel_src[0] = ptStack[i].x;
00246                 if (ptStack[i].y < rectSel_src[1])
00247                     rectSel_src[1] = ptStack[i].y;
00248                 if (ptStack[i].x > rectSel_src[2])
00249                     rectSel_src[2] = ptStack[i].x;
00250                 if (ptStack[i].y > rectSel_src[3])
00251                     rectSel_src[3] = ptStack[i].y;
00252             }
00253             rectSel_src[2] += 1 - rectSel_src[0];
00254             rectSel_src[3] += 1 - rectSel_src[1];
00255             rectSel_dest[0] = rectSel_src[0];
00256             rectSel_dest[1] = rectSel_src[1];
00257             rectSel_dest[2] = rectSel_src[2];
00258             rectSel_dest[3] = rectSel_src[3];
00259             if (ptSP != 0)
00260             {
00261                 DeleteObject(hSelMask);
00262                 hSelMask = CreateBitmap(rectSel_src[2], rectSel_src[3], 1, 1, NULL);
00263                 DeleteObject(SelectObject(hSelDC, hSelMask));
00264                 ptStackCopy = HeapAlloc(GetProcessHeap(), HEAP_GENERATE_EXCEPTIONS, sizeof(POINT) * (ptSP + 1));
00265                 for (i = 0; i <= ptSP; i++)
00266                 {
00267                     ptStackCopy[i].x = ptStack[i].x - rectSel_src[0];
00268                     ptStackCopy[i].y = ptStack[i].y - rectSel_src[1];
00269                 }
00270                 Poly(hSelDC, ptStackCopy, ptSP + 1, 0x00ffffff, 0x00ffffff, 1, 2, TRUE);
00271                 HeapFree(GetProcessHeap(), 0, ptStackCopy);
00272                 SelectObject(hSelDC, hSelBm = CreateDIBWithProperties(rectSel_src[2], rectSel_src[3]));
00273                 resetToU1();
00274                 MaskBlt(hSelDC, 0, 0, rectSel_src[2], rectSel_src[3], hDrawingDC, rectSel_src[0],
00275                         rectSel_src[1], hSelMask, 0, 0, MAKEROP4(SRCCOPY, WHITENESS));
00276                 Poly(hdc, ptStack, ptSP + 1, bg, bg, 1, 2, TRUE);
00277                 newReversible();
00278 
00279                 MaskBlt(hDrawingDC, rectSel_src[0], rectSel_src[1], rectSel_src[2], rectSel_src[3], hSelDC, 0,
00280                         0, hSelMask, 0, 0, MAKEROP4(SRCCOPY, SRCAND));
00281 
00282                 placeSelWin();
00283                 ShowWindow(hSelection, SW_SHOW);
00284                 /* force refresh of selection contents */
00285                 SendMessage(hSelection, WM_LBUTTONDOWN, 0, 0);
00286                 SendMessage(hSelection, WM_MOUSEMOVE, 0, 0);
00287                 SendMessage(hSelection, WM_LBUTTONUP, 0, 0);
00288             }
00289             HeapFree(GetProcessHeap(), 0, ptStack);
00290             ptStack = NULL;
00291             break;
00292         }
00293         case TOOL_RECTSEL:
00294             resetToU1();
00295             if ((rectSel_src[2] != 0) && (rectSel_src[3] != 0))
00296             {
00297                 DeleteObject(hSelMask);
00298                 hSelMask = CreateBitmap(rectSel_src[2], rectSel_src[3], 1, 1, NULL);
00299                 DeleteObject(SelectObject(hSelDC, hSelMask));
00300                 Rect(hSelDC, 0, 0, rectSel_src[2], rectSel_src[3], 0x00ffffff, 0x00ffffff, 1, 2);
00301                 SelectObject(hSelDC, hSelBm = CreateDIBWithProperties(rectSel_src[2], rectSel_src[3]));
00302                 resetToU1();
00303                 BitBlt(hSelDC, 0, 0, rectSel_src[2], rectSel_src[3], hDrawingDC, rectSel_src[0],
00304                        rectSel_src[1], SRCCOPY);
00305                 Rect(hdc, rectSel_src[0], rectSel_src[1], rectSel_src[0] + rectSel_src[2],
00306                      rectSel_src[1] + rectSel_src[3], bgColor, bgColor, 0, TRUE);
00307                 newReversible();
00308 
00309                 BitBlt(hDrawingDC, rectSel_src[0], rectSel_src[1], rectSel_src[2], rectSel_src[3], hSelDC, 0,
00310                        0, SRCCOPY);
00311 
00312                 placeSelWin();
00313                 ShowWindow(hSelection, SW_SHOW);
00314                 /* force refresh of selection contents */
00315                 SendMessage(hSelection, WM_LBUTTONDOWN, 0, 0);
00316                 SendMessage(hSelection, WM_MOUSEMOVE, 0, 0);
00317                 SendMessage(hSelection, WM_LBUTTONUP, 0, 0);
00318             }
00319             break;
00320         case TOOL_RUBBER:
00321             Erase(hdc, lastX, lastY, x, y, bg, rubberRadius);
00322             break;
00323         case TOOL_PEN:
00324             Line(hdc, lastX, lastY, x, y, fg, 1);
00325             SetPixel(hdc, x, y, fg);
00326             break;
00327         case TOOL_LINE:
00328             resetToU1();
00329             if (GetAsyncKeyState(VK_SHIFT) < 0)
00330                 roundTo8Directions(startX, startY, &x, &y);
00331             Line(hdc, startX, startY, x, y, fg, lineWidth);
00332             break;
00333         case TOOL_BEZIER:
00334             pointSP++;
00335             if (pointSP == 4)
00336                 pointSP = 0;
00337             break;
00338         case TOOL_RECT:
00339             resetToU1();
00340             if (GetAsyncKeyState(VK_SHIFT) < 0)
00341                 regularize(startX, startY, &x, &y);
00342             Rect(hdc, startX, startY, x, y, fg, bg, lineWidth, shapeStyle);
00343             break;
00344         case TOOL_SHAPE:
00345             resetToU1();
00346             pointStack[pointSP].x = x;
00347             pointStack[pointSP].y = y;
00348             if ((pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0))
00349                 roundTo8Directions(pointStack[pointSP - 1].x, pointStack[pointSP - 1].y,
00350                                    &pointStack[pointSP].x, &pointStack[pointSP].y);
00351             pointSP++;
00352             if (pointSP >= 2)
00353             {
00354                 if ((pointStack[0].x - x) * (pointStack[0].x - x) +
00355                     (pointStack[0].y - y) * (pointStack[0].y - y) <= lineWidth * lineWidth + 1)
00356                 {
00357                     Poly(hdc, pointStack, pointSP, fg, bg, lineWidth, shapeStyle, TRUE);
00358                     pointSP = 0;
00359                 }
00360                 else
00361                 {
00362                     Poly(hdc, pointStack, pointSP, fg, bg, lineWidth, shapeStyle, FALSE);
00363                 }
00364             }
00365             if (pointSP == 255)
00366                 pointSP--;
00367             break;
00368         case TOOL_ELLIPSE:
00369             resetToU1();
00370             if (GetAsyncKeyState(VK_SHIFT) < 0)
00371                 regularize(startX, startY, &x, &y);
00372             Ellp(hdc, startX, startY, x, y, fg, bg, lineWidth, shapeStyle);
00373             break;
00374         case TOOL_RRECT:
00375             resetToU1();
00376             if (GetAsyncKeyState(VK_SHIFT) < 0)
00377                 regularize(startX, startY, &x, &y);
00378             RRect(hdc, startX, startY, x, y, fg, bg, lineWidth, shapeStyle);
00379             break;
00380     }
00381 }
00382 
00383 void
00384 startPaintingR(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg)
00385 {
00386     startX = x;
00387     startY = y;
00388     lastX = x;
00389     lastY = y;
00390     switch (activeTool)
00391     {
00392         case TOOL_FREESEL:
00393         case TOOL_TEXT:
00394         case TOOL_LINE:
00395         case TOOL_RECT:
00396         case TOOL_ELLIPSE:
00397         case TOOL_RRECT:
00398             newReversible();
00399             break;
00400         case TOOL_RUBBER:
00401             newReversible();
00402             Replace(hdc, x, y, x, y, fg, bg, rubberRadius);
00403             break;
00404         case TOOL_FILL:
00405             newReversible();
00406             Fill(hdc, x, y, bg);
00407             break;
00408         case TOOL_PEN:
00409             newReversible();
00410             SetPixel(hdc, x, y, bg);
00411             break;
00412         case TOOL_BRUSH:
00413             newReversible();
00414             Brush(hdc, x, y, x, y, bg, brushStyle);
00415             break;
00416         case TOOL_AIRBRUSH:
00417             newReversible();
00418             Airbrush(hdc, x, y, bg, airBrushWidth);
00419             break;
00420         case TOOL_BEZIER:
00421             pointStack[pointSP].x = x;
00422             pointStack[pointSP].y = y;
00423             if (pointSP == 0)
00424             {
00425                 newReversible();
00426                 pointSP++;
00427             }
00428             break;
00429         case TOOL_SHAPE:
00430             pointStack[pointSP].x = x;
00431             pointStack[pointSP].y = y;
00432             if (pointSP + 1 >= 2)
00433                 Poly(hdc, pointStack, pointSP + 1, bg, fg, lineWidth, shapeStyle, FALSE);
00434             if (pointSP == 0)
00435             {
00436                 newReversible();
00437                 pointSP++;
00438             }
00439             break;
00440     }
00441 }
00442 
00443 void
00444 whilePaintingR(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg)
00445 {
00446     switch (activeTool)
00447     {
00448         case TOOL_RUBBER:
00449             Replace(hdc, lastX, lastY, x, y, fg, bg, rubberRadius);
00450             break;
00451         case TOOL_PEN:
00452             Line(hdc, lastX, lastY, x, y, bg, 1);
00453             break;
00454         case TOOL_BRUSH:
00455             Brush(hdc, lastX, lastY, x, y, bg, brushStyle);
00456             break;
00457         case TOOL_AIRBRUSH:
00458             Airbrush(hdc, x, y, bg, airBrushWidth);
00459             break;
00460         case TOOL_LINE:
00461             resetToU1();
00462             if (GetAsyncKeyState(VK_SHIFT) < 0)
00463                 roundTo8Directions(startX, startY, &x, &y);
00464             Line(hdc, startX, startY, x, y, bg, lineWidth);
00465             break;
00466         case TOOL_BEZIER:
00467             resetToU1();
00468             pointStack[pointSP].x = x;
00469             pointStack[pointSP].y = y;
00470             switch (pointSP)
00471             {
00472                 case 1:
00473                     Line(hdc, pointStack[0].x, pointStack[0].y, pointStack[1].x, pointStack[1].y, bg,
00474                          lineWidth);
00475                     break;
00476                 case 2:
00477                     Bezier(hdc, pointStack[0], pointStack[2], pointStack[2], pointStack[1], bg, lineWidth);
00478                     break;
00479                 case 3:
00480                     Bezier(hdc, pointStack[0], pointStack[2], pointStack[3], pointStack[1], bg, lineWidth);
00481                     break;
00482             }
00483             break;
00484         case TOOL_RECT:
00485             resetToU1();
00486             if (GetAsyncKeyState(VK_SHIFT) < 0)
00487                 regularize(startX, startY, &x, &y);
00488             Rect(hdc, startX, startY, x, y, bg, fg, lineWidth, shapeStyle);
00489             break;
00490         case TOOL_SHAPE:
00491             resetToU1();
00492             pointStack[pointSP].x = x;
00493             pointStack[pointSP].y = y;
00494             if ((pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0))
00495                 roundTo8Directions(pointStack[pointSP - 1].x, pointStack[pointSP - 1].y,
00496                                    &pointStack[pointSP].x, &pointStack[pointSP].y);
00497             if (pointSP + 1 >= 2)
00498                 Poly(hdc, pointStack, pointSP + 1, bg, fg, lineWidth, shapeStyle, FALSE);
00499             break;
00500         case TOOL_ELLIPSE:
00501             resetToU1();
00502             if (GetAsyncKeyState(VK_SHIFT) < 0)
00503                 regularize(startX, startY, &x, &y);
00504             Ellp(hdc, startX, startY, x, y, bg, fg, lineWidth, shapeStyle);
00505             break;
00506         case TOOL_RRECT:
00507             resetToU1();
00508             if (GetAsyncKeyState(VK_SHIFT) < 0)
00509                 regularize(startX, startY, &x, &y);
00510             RRect(hdc, startX, startY, x, y, bg, fg, lineWidth, shapeStyle);
00511             break;
00512     }
00513 
00514     lastX = x;
00515     lastY = y;
00516 }
00517 
00518 void
00519 endPaintingR(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg)
00520 {
00521     switch (activeTool)
00522     {
00523         case TOOL_RUBBER:
00524             Replace(hdc, lastX, lastY, x, y, fg, bg, rubberRadius);
00525             break;
00526         case TOOL_PEN:
00527             Line(hdc, lastX, lastY, x, y, bg, 1);
00528             SetPixel(hdc, x, y, bg);
00529             break;
00530         case TOOL_LINE:
00531             resetToU1();
00532             if (GetAsyncKeyState(VK_SHIFT) < 0)
00533                 roundTo8Directions(startX, startY, &x, &y);
00534             Line(hdc, startX, startY, x, y, bg, lineWidth);
00535             break;
00536         case TOOL_BEZIER:
00537             pointSP++;
00538             if (pointSP == 4)
00539                 pointSP = 0;
00540             break;
00541         case TOOL_RECT:
00542             resetToU1();
00543             if (GetAsyncKeyState(VK_SHIFT) < 0)
00544                 regularize(startX, startY, &x, &y);
00545             Rect(hdc, startX, startY, x, y, bg, fg, lineWidth, shapeStyle);
00546             break;
00547         case TOOL_SHAPE:
00548             resetToU1();
00549             pointStack[pointSP].x = x;
00550             pointStack[pointSP].y = y;
00551             if ((pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0))
00552                 roundTo8Directions(pointStack[pointSP - 1].x, pointStack[pointSP - 1].y,
00553                                    &pointStack[pointSP].x, &pointStack[pointSP].y);
00554             pointSP++;
00555             if (pointSP >= 2)
00556             {
00557                 if ((pointStack[0].x - x) * (pointStack[0].x - x) +
00558                     (pointStack[0].y - y) * (pointStack[0].y - y) <= lineWidth * lineWidth + 1)
00559                 {
00560                     Poly(hdc, pointStack, pointSP, bg, fg, lineWidth, shapeStyle, TRUE);
00561                     pointSP = 0;
00562                 }
00563                 else
00564                 {
00565                     Poly(hdc, pointStack, pointSP, bg, fg, lineWidth, shapeStyle, FALSE);
00566                 }
00567             }
00568             if (pointSP == 255)
00569                 pointSP--;
00570             break;
00571         case TOOL_ELLIPSE:
00572             resetToU1();
00573             if (GetAsyncKeyState(VK_SHIFT) < 0)
00574                 regularize(startX, startY, &x, &y);
00575             Ellp(hdc, startX, startY, x, y, bg, fg, lineWidth, shapeStyle);
00576             break;
00577         case TOOL_RRECT:
00578             resetToU1();
00579             if (GetAsyncKeyState(VK_SHIFT) < 0)
00580                 regularize(startX, startY, &x, &y);
00581             RRect(hdc, startX, startY, x, y, bg, fg, lineWidth, shapeStyle);
00582             break;
00583     }
00584 }

Generated on Sat May 26 2012 04:15:58 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.