/* FUNCTIONS ********************************************************/
void
-Line(HDC hdc, short x1, short y1, short x2, short y2, int color, int thickness)
+Line(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, int thickness)
{
HPEN oldPen = SelectObject(hdc, CreatePen(PS_SOLID, thickness, color));
MoveToEx(hdc, x1, y1, NULL);
}
void
-Rect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness, int style)
+Rect(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, int thickness, int style)
{
HBRUSH oldBrush;
LOGBRUSH logbrush;
}
void
-Ellp(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness, int style)
+Ellp(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, int thickness, int style)
{
HBRUSH oldBrush;
LOGBRUSH logbrush;
}
void
-RRect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness, int style)
+RRect(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, int thickness, int style)
{
LOGBRUSH logbrush;
HBRUSH oldBrush;
}
void
-Poly(HDC hdc, POINT * lpPoints, int nCount, int fg, int bg, int thickness, int style, BOOL closed)
+Poly(HDC hdc, POINT * lpPoints, int nCount, COLORREF fg, COLORREF bg, int thickness, int style, BOOL closed)
{
LOGBRUSH logbrush;
HBRUSH oldBrush;
}
void
-Bezier(HDC hdc, POINT p1, POINT p2, POINT p3, POINT p4, int color, int thickness)
+Bezier(HDC hdc, POINT p1, POINT p2, POINT p3, POINT p4, COLORREF color, int thickness)
{
HPEN oldPen;
POINT fourPoints[4];
}
void
-Fill(HDC hdc, int x, int y, int color)
+Fill(HDC hdc, LONG x, LONG y, COLORREF color)
{
HBRUSH oldBrush = SelectObject(hdc, CreateSolidBrush(color));
ExtFloodFill(hdc, x, y, GetPixel(hdc, x, y), FLOODFILLSURFACE);
}
void
-Erase(HDC hdc, short x1, short y1, short x2, short y2, int color, int radius)
+Erase(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG radius)
{
short a;
HPEN oldPen;
}
void
-Replace(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int radius)
+Replace(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, LONG radius)
{
- short a, x, y;
+ LONG 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++)
}
void
-Airbrush(HDC hdc, short x, short y, int color, int r)
+Airbrush(HDC hdc, LONG x, LONG y, COLORREF color, LONG r)
{
- short a;
- short b;
+ LONG a, b;
+
for(b = -r; b <= r; b++)
for(a = -r; a <= r; a++)
if ((a * a + b * b <= r * r) && (rand() % 4 == 0))
}
void
-Brush(HDC hdc, short x1, short y1, short x2, short y2, int color, int style)
+Brush(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, COLORREF style)
{
HPEN oldPen = SelectObject(hdc, CreatePen(PS_SOLID, 1, color));
HBRUSH oldBrush = SelectObject(hdc, CreateSolidBrush(color));
}
void
-RectSel(HDC hdc, short x1, short y1, short x2, short y2)
+RectSel(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2)
{
HBRUSH oldBrush;
LOGBRUSH logbrush;
}
void
-SelectionFrame(HDC hdc, int x1, int y1, int x2, int y2)
+SelectionFrame(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2)
{
HBRUSH oldBrush;
LOGBRUSH logbrush;
* PROGRAMMERS: Benedikt Freisen
*/
-void Line(HDC hdc, short x1, short y1, short x2, short y2, int color, int thickness);
+void Line(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, int thickness);
-void Rect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness, int style);
+void Rect(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, int thickness, int style);
-void Ellp(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness, int style);
+void Ellp(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, int thickness, int style);
-void RRect(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int thickness, int style);
+void RRect(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, int thickness, int style);
-void Poly(HDC hdc, POINT *lpPoints, int nCount, int fg, int bg, int thickness, int style, BOOL closed);
+void Poly(HDC hdc, POINT *lpPoints, int nCount, COLORREF fg, COLORREF bg, int thickness, int style, BOOL closed);
-void Bezier(HDC hdc, POINT p1, POINT p2, POINT p3, POINT p4, int color, int thickness);
+void Bezier(HDC hdc, POINT p1, POINT p2, POINT p3, POINT p4, COLORREF color, int thickness);
-void Fill(HDC hdc, int x, int y, int color);
+void Fill(HDC hdc, LONG x, LONG y, COLORREF color);
-void Erase(HDC hdc, short x1, short y1, short x2, short y2, int color, int radius);
+void Erase(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG radius);
-void Replace(HDC hdc, short x1, short y1, short x2, short y2, int fg, int bg, int radius);
+void Replace(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, LONG radius);
-void Airbrush(HDC hdc, short x, short y, int color, int r);
+void Airbrush(HDC hdc, LONG x, LONG y, COLORREF color, LONG r);
-void Brush(HDC hdc, short x1, short y1, short x2, short y2, int color, int style);
+void Brush(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, int style);
-void RectSel(HDC hdc, short x1, short y1, short x2, short y2);
+void RectSel(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2);
-void SelectionFrame(HDC hdc, int x1, int y1, int x2, int y2);
+void SelectionFrame(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2);
extern int redoSteps;
extern BOOL imageSaved;
-extern short startX;
-extern short startY;
-extern short lastX;
-extern short lastY;
+extern LONG startX;
+extern LONG startY;
+extern LONG lastX;
+extern LONG lastY;
extern int lineWidth;
extern int shapeStyle;
extern int brushStyle;
int redoSteps = 0;
BOOL imageSaved = TRUE;
-short startX;
-short startY;
-short lastX;
-short lastY;
+LONG startX;
+LONG startY;
+LONG lastX;
+LONG lastY;
int lineWidth = 1;
int shapeStyle = 0;
int brushStyle = 0;
}
void
-regularize(short x0, short y0, short *x1, short *y1)
+regularize(LONG x0, LONG y0, LONG *x1, LONG *y1)
{
if (abs(*x1 - x0) >= abs(*y1 - y0))
*y1 = y0 + (*y1 > y0 ? abs(*x1 - x0) : -abs(*x1 - x0));
}
void
-roundTo8Directions(short x0, short y0, short *x1, short *y1)
+roundTo8Directions(LONG x0, LONG y0, LONG *x1, LONG *y1)
{
if (abs(*x1 - x0) >= abs(*y1 - y0))
{
int ptSP = 0;
void
-startPaintingL(HDC hdc, short x, short y, int fg, int bg)
+startPaintingL(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg)
{
startX = x;
startY = y;
}
void
-whilePaintingL(HDC hdc, short x, short y, int fg, int bg)
+whilePaintingL(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg)
{
switch (activeTool)
{
break;
case TOOL_RECTSEL:
{
- short tempX;
- short tempY;
+ int tempX;
+ int tempY;
resetToU1();
tempX = max(0, min(x, imgXRes));
tempY = max(0, min(y, imgYRes));
pointStack[pointSP].y = y;
if ((pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0))
roundTo8Directions(pointStack[pointSP - 1].x, pointStack[pointSP - 1].y,
- (short *)&pointStack[pointSP].x, (short *)&pointStack[pointSP].y);
+ &pointStack[pointSP].x, &pointStack[pointSP].y);
if (pointSP + 1 >= 2)
Poly(hdc, pointStack, pointSP + 1, fg, bg, lineWidth, shapeStyle, FALSE);
break;
}
void
-endPaintingL(HDC hdc, short x, short y, int fg, int bg)
+endPaintingL(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg)
{
switch (activeTool)
{
pointStack[pointSP].y = y;
if ((pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0))
roundTo8Directions(pointStack[pointSP - 1].x, pointStack[pointSP - 1].y,
- (short *)&pointStack[pointSP].x, (short *)&pointStack[pointSP].y);
+ &pointStack[pointSP].x, &pointStack[pointSP].y);
pointSP++;
if (pointSP >= 2)
{
}
void
-startPaintingR(HDC hdc, short x, short y, int fg, int bg)
+startPaintingR(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg)
{
startX = x;
startY = y;
}
void
-whilePaintingR(HDC hdc, short x, short y, int fg, int bg)
+whilePaintingR(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg)
{
switch (activeTool)
{
pointStack[pointSP].y = y;
if ((pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0))
roundTo8Directions(pointStack[pointSP - 1].x, pointStack[pointSP - 1].y,
- (short *)&pointStack[pointSP].x, (short *)&pointStack[pointSP].y);
+ &pointStack[pointSP].x, &pointStack[pointSP].y);
if (pointSP + 1 >= 2)
Poly(hdc, pointStack, pointSP + 1, bg, fg, lineWidth, shapeStyle, FALSE);
break;
}
void
-endPaintingR(HDC hdc, short x, short y, int fg, int bg)
+endPaintingR(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg)
{
switch (activeTool)
{
pointStack[pointSP].y = y;
if ((pointSP > 0) && (GetAsyncKeyState(VK_SHIFT) < 0))
roundTo8Directions(pointStack[pointSP - 1].x, pointStack[pointSP - 1].y,
- (short *)&pointStack[pointSP].x, (short *)&pointStack[pointSP].y);
+ &pointStack[pointSP].x, &pointStack[pointSP].y);
pointSP++;
if (pointSP >= 2)
{
void placeSelWin(void);
-void startPaintingL(HDC hdc, short x, short y, int fg, int bg);
+void startPaintingL(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg);
-void whilePaintingL(HDC hdc, short x, short y, int fg, int bg);
+void whilePaintingL(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg);
-void endPaintingL(HDC hdc, short x, short y, int fg, int bg);
+void endPaintingL(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg);
-void startPaintingR(HDC hdc, short x, short y, int fg, int bg);
+void startPaintingR(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg);
-void whilePaintingR(HDC hdc, short x, short y, int fg, int bg);
+void whilePaintingR(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg);
-void endPaintingR(HDC hdc, short x, short y, int fg, int bg);
+void endPaintingR(HDC hdc, LONG x, LONG y, COLORREF fg, COLORREF bg);
}
SendMessage(hImageArea, WM_PAINT, 0, 0);
if ((activeTool == TOOL_ZOOM) && (zoom < 8000))
- zoomTo(zoom * 2, (short)LOWORD(lParam), (short)HIWORD(lParam));
+ zoomTo(zoom * 2, LOWORD(lParam), HIWORD(lParam));
}
break;
}
SendMessage(hImageArea, WM_PAINT, 0, 0);
if ((activeTool == TOOL_ZOOM) && (zoom > 125))
- zoomTo(zoom / 2, (short)LOWORD(lParam), (short)HIWORD(lParam));
+ zoomTo(zoom / 2, LOWORD(lParam), HIWORD(lParam));
}
break;
case WM_MOUSEMOVE:
if (hwnd == hImageArea)
{
- short xNow = (short)LOWORD(lParam) * 1000 / zoom;
- short yNow = (short)HIWORD(lParam) * 1000 / zoom;
+ LONG xNow = LOWORD(lParam) * 1000 / zoom;
+ LONG yNow = HIWORD(lParam) * 1000 / zoom;
if ((!drawing) || (activeTool <= TOOL_AIRBRUSH))
{
TRACKMOUSEEVENT tme;
if (activeTool == TOOL_ZOOM)
{
SendMessage(hImageArea, WM_PAINT, 0, 0);
- drawZoomFrame((short)LOWORD(lParam), (short)HIWORD(lParam));
+ drawZoomFrame(LOWORD(lParam), HIWORD(lParam));
}
tme.cbSize = sizeof(TRACKMOUSEEVENT);
if (drawing)
{
/* values displayed in statusbar */
- short xRel = xNow - startX;
- short yRel = yNow - startY;
+ LONG xRel = xNow - startX;
+ LONG yRel = yNow - startY;
/* freesel, rectsel and text tools always show numbers limited to fit into image area */
if ((activeTool == TOOL_FREESEL) || (activeTool == TOOL_RECTSEL) || (activeTool == TOOL_TEXT))
{