Int_DrawCircle, Int_DrawEllipse, Int_DrawLine, Int_DrawMarker, Int_DrawPoly, Int_DrawRectangle, Int_MeasureHorizLineWithCenter
Description
Int_DrawCircle( intInt_CircleMode
, dwordcircleColor
, int *lpCircleX
, int *lpCircleY
, int *lpCircleRadius
, intcircleShow
);
This function draws circle in several drawing modes. After calling this function, predefined cursor appears and you can start drawing. At the end the lpCircleX, lpCircleY and lpCircleRadius parameters are filled.
Parameters
Int_CircleMode
Specifies the circle drawing mode. Possible constants are listened below.
In this mode you can draw the hollow circle. You start drawing by pressing the primary mouse button. To end drawing release the button. Parameters lpCircleX, lpCircleY and lpCircleRadius are filled on output. | |
In this mode you can draw the filled circle. You start drawing by pressing the primary mouse button. To end drawing release the button. Parameters lpCircleX, lpCircleY and lpCircleRadius are filled on output. | |
In this mode you can draw the hollow circle with fixed radius. You start drawing by pressing the primary mouse button. To end drawing release the button. Parameters lpCircleX, lpCircleY and lpCircleRadius are filled on output. The center is specified in lpCircleX and lpCircleY parameters. If one of these parameters equals -1 the current mouse coordinates are used. | |
In this mode you can draw the hollow circle with fixed radius. You start drawing by pressing the primary mouse button. To end drawing release the button. Parameters lpCircleX, lpCircleY and lpCircleRadius are filled on output. The fixed radius is specified in lpCircleRadius parameter. | |
In this mode you can draw the hollow circle as in CIRCLE_HOLLOW mode but immediately after calling this function circle on specified position and with specified radius appears. Parameters lpCircleXs, lpCircleYs and lpCircleRadius are filled on input and output. |
circleColor
The color parameter specifies the color of the circle. The color is applied only when the function parameter circleColor is not zero. Use predefined color constants (RGB_BLACK (0), RGB_BLUE (16711680), RGB_CYAN (16776960), RGB_GREEN (65280), RGB_MAGENTA (16711935), RGB_RED (255), RGB_WHITE (16777215), RGB_YELLOW (65535) or RGB_DEFAULT (2147483647)) or any RGB value. See RGB function for details.
lpCircleX
The pointer to x coordinate of center of the circle. This parameter is filled on the output. For CIRCLE_FIXEDCENTER (3) and for CIRCLE_PREDRAW (5) is also filled on input.
lpCircleY
The pointer to y coordinate of center of the circle. This parameter is filled on the output. For CIRCLE_FIXEDCENTER (3) and for CIRCLE_PREDRAW (5) is also filled on input.
//Int_DrawCircle example - draw a circle in a predraw mode interactively. dword keys[2], key; int xs, ys; char buf[256]; int width, height; int radius; SetCommandText("Int_DrawCircle example. Working..."); strcpy(buf, " application API Example - Int_DrawCircle\tPress primary mouse button to start. To cancel press Esc. "); Int_CreateTextWindow(buf,0,RGB(0,0,128),RGB_WHITE,100); keys[0] = VK_ESC; keys[1] = VK_LBUTTON; Get_Size(SIZE_PICWND, NULL, NULL, &width, &height); while(TRUE) { key = Int_GetEvents(&keys,2); if(key == keys[0]) break; if(key == keys[1]) { xs = width/2; ys = height/2; radius = 50; strcpy(buf, " application API Example - Int_DrawCircle\tMove the circle, change the circle radius. If it is OK, press right button "); Int_CreateTextWindow(buf,0,RGB(0,0,128),RGB_WHITE,100); Int_DrawCircle(CIRCLE_PREDRAW, RGB_DEFAULT, &xs, &ys, &radius, TRUE); sprintf(buf, " application API Example.\tRadius = %i pixels ","radius"); Int_CreateTextWindow(buf,0,RGB(0,0,128),RGB_WHITE,100); Wait(2.0); strcpy(buf, " application API Example - Int_DrawCircle\tPress primary mouse button to start. To cancel press Esc. "); Int_CreateTextWindow(buf,0,RGB(0,0,128),RGB_WHITE,100); } } if(ExistProc("ViewColor") == TRUE) ViewColor(); else ViewGray(); Int_CloseTextWindow();
Note
You specify the menu item by filling the menuid parameter (which is returned from Int_AppendMenuEx function).
See Also
Int_DrawEllipse, Int_DrawLine, Int_DrawMarker, Int_DrawPoly, Int_DrawRectangle
Description
Int_DrawEllipse( intelMode
, dwordelColor
, int *lpElX
, int *lpElY
, int *lpElA
, int *lpElB
, intlpElAngle
, intelShow
);
This function allows you to draw the ellipse in several drawing modes. After calling this function, a predefined cursor appears and you can start drawing. The lpElX, lpElY, lpElA, lpElB are lpElAngle parameters are filled on output.
Parameters
elMode
Specifies the Ellipse drawing mode. Possible constants are listened below.
In this mode you can draw the hollow ellipse. You start drawing by pressing the primary mouse button. To end drawing release the button. Parameters lpEllipseX, lpEllipseY and lpEllipseRadius are filled on output. | |
In this mode you can draw the filled ellipse. You start drawing by pressing the primary mouse button. To end drawing release the button. Parameters lpEllipseX, lpEllipseY and lpEllipseRadius are filled on output. | |
In this mode you can draw the hollow ellipse with fixed radius. You start drawing by pressing the primary mouse button. To end drawing release the button. Parameters lpEllipseX, lpEllipseY and lpEllipseRadius are filled on output. The center is specified in lpEllipseX and lpEllipseY parameters. If one of these parameters equals -1 the current mouse coordinates are used. | |
In this mode you can draw the hollow ellipse with fixed radius. You start drawing by pressing the primary mouse button. To end drawing release the button. Parameters lpEllipseX, lpEllipseY and lpEllipseRadius are filled on output. The fixed radius is specified in lpEllipseRadius parameter. | |
In this mode you can draw the hollow ellipse as in ELLIPSE_HOLLOW mode but immediately after calling this function Ellipse on specified position and with specified radius appears. Parameters lpEllipseXs, lpEllipseYs and lpEllipseRadius are filled on input and output. |
elColor
The color parameter specifies the color of the Ellipse. The color is applied only when the function parameter EllipseColor is not zero. Use predefined color constants (RGB_BLACK (0), RGB_BLUE (16711680), RGB_CYAN (16776960), RGB_GREEN (65280), RGB_MAGENTA (16711935), RGB_RED (255), RGB_WHITE (16777215), RGB_YELLOW (65535) or RGB_DEFAULT (2147483647)) or any RGB value. See RGB function for details.
lpElX
The pointer to x coordinate of center of the Ellipse. This parameter is filled on the output. For Ellipse_FIXEDCENTER and for Ellipse_PREDRAW is also filled on input.
lpElY
The pointer to x coordinate of center of the Ellipse. This parameter is filled on the output. For Ellipse_FIXEDCENTER and for Ellipse_PREDRAW is also filled on input.
lpElA
Points to a half of length of the first ellipse axis. This parameter is filled on output. For ELLIPSE_FIXEDPOS (4) and ELLIPSE_PREDRAW (5) modes it is also filled on input.
lpElB
Points to a half of length of the second ellipse axis. This parameter is filled on output. For ELLIPSE_FIXEDPOS (4) and ELLIPSE_PREDRAW (5) modes it is also filled on input.
//Int_DrawEllipse example - draw a Ellipse in a predraw mode interactively. dword keys[2], key; int xs, ys, a, b, angle; char buf[256]; int width, height; int radius; SetCommandText("Int_DrawEllipse example. Working..."); strcpy(buf, " application API Example - Int_DrawEllipse.\tPress primary mouse button to start. To cancel press Esc. "); Int_CreateTextWindow(buf,0,RGB(0,0,128),RGB_WHITE,100); keys[0] = VK_ESC; keys[1] = VK_LBUTTON; Get_Size(SIZE_PICWND, NULL, NULL, &width, &height); while(TRUE) { key = Int_GetEvents(&keys,2); if(key == keys[0]) break; if(key == keys[1]) { xs = width/2; ys = height/2; a = 100; b = 50; angle = 30; strcpy(buf, " application API Example - Int_DrawEllipse\tMove the ellipse, change the ellipse angle or size. If it is OK, press right button "); Int_CreateTextWindow(buf,0,RGB(0,0,128),RGB_WHITE,100); Int_DrawEllipse(ELLIPSE_PREDRAW, RGB_DEFAULT, &xs, &ys, &a, &b, &angle, TRUE); sprintf(buf, " application API Example - Int_DrawEllipse\tCoordinates of the center x = %i, y = %i pixels ","xs, ys"); Int_CreateTextWindow(buf,0,RGB(0,0,128),RGB_WHITE,100); Wait(2.0); strcpy(buf, " application API Example - Int_DrawEllipse\tPress primary mouse button to start. To cancel press Esc. "); Int_CreateTextWindow(buf,0,RGB(0,0,128),RGB_WHITE,100); } } if(ExistProc("ViewColor") == TRUE) ViewColor(); else ViewGray(); Int_CloseTextWindow();
See Also
Int_DrawCircle, Int_DrawLine, Int_DrawMarker, Int_DrawPoly, Int_DrawRectangle
Description
Int_DrawLine( intlineMode
, dwordlineColor
, intlineXFixed
, intlineYFixed
, intlineEnds
, int *lpLineX1
, int *lpLineY1
, int *lpLineX2
, int *lpLineY2
, intlineShow
);
This function enables you to interactively draw the line in several drawing modes. After calling this function, predefined cursor appears and you can start drawing. LpLineX1, lpLineY1, lpLineX2, lpLineY2 parameters are filled on the output.
Parameters
lineMode
Specifies the Ellipse drawing mode. Possible constants are listened below.
In this mode you can draw the line in all directions, simply by specifying the first and the last point of line. The parameters lpLineX1, lpLineY1, lpLineX2, lpLineY2 are filled on the output. The lineXFixed and lineYFixed parameters are not used, lineEnds specifies the length of right angled lines added to both ends of the defined line. | |
In this mode you can draw the vertical line with fixed x coordinate. The lineXFixed parameter defines the fixed x coordinate of the middle of the line. If lineXFixed == -1 the current x coordinate of the mouse is used. The lineEnds parameter specifies the length of the vertical line. | |
In this mode you can draw the horizontal line with fixed y coordinate. The lineYFixed parameter defines the fixed y coordinate of the middle of the line. If lineYFixed == -1 the current y coordinate of the mouse is used. The lineEnds parameter specifies the length of the horizontal line. | |
In this mode you can draw the cross within the picture window. The lpLineX1 and lpLineY1 variables are filled with the mouse position when you push the primary mouse button and begin to specify the cross position. The lpLineX2 and lpLineY2 variables are filled with the final cross position. The lineEnds, lineXFixed and lineYFixed parameters are not used. | |
In this mode you can draw simple line defining two points. You can then change the line position by pushing the primary mouse button near the line center, or you can change one of the end points by pushing the primary mouse button near the end of the line. | |
This mode is similar to mode LINE_FREE, but the values stored in lpLineX1, lpLineY1, lpLineX2, lpLineY2 are used for the line predraw. | |
This mode is used to draw parallel line. The values stored in lpLineX1, lpLineY1, lpLineX2, lpLineY2 are used to define the reference line. Returns offset (x, y) as a value with a +/- sign. Returned value has to be read using the GetXYFromDWord function. |
lineColor
The color parameter specifies the color of the line. The color is applied only when the function parameter visible is not zero. Use predefined color constants (RGB_BLACK (0), RGB_BLUE (16711680), RGB_CYAN (16776960), RGB_GREEN (65280), RGB_MAGENTA (16711935), RGB_RED (255), RGB_WHITE (16777215), RGB_YELLOW (65535) or RGB_DEFAULT (2147483647)) or any RGB value. See RGB function for details.
//Int_DrawLine example - draw a general line interactively. dword keys[2], key; long coor; int i, x_start, y_start, x_end, y_end; char buf[256]; SetCommandText("Int_DrawLine example. Working..."); strcpy(buf, " application API Example - Int_DrawLine.\tPress primary mouse button to start. To cancel press Esc. "); Int_CreateTextWindow(buf,0,RGB(0,0,128),RGB_WHITE,100); keys[0] = VK_ESC; keys[1] = VK_LBUTTON; while(TRUE) { key = Int_GetEvents(&keys,2); if(key == keys[0]) break; if(key == keys[1]) { coor = Int_GetMousePos(NULL, NULL); Int_PostMessage(VK_LBUTTON, coor); Int_DrawLine(LINE_GENERAL,RGB_DEFAULT,0,0,20, &x_start, &y_start, &x_end, &y_end, TRUE); } } if(ExistProc("ViewColor") == TRUE) ViewColor(); else ViewGray(); Int_CloseTextWindow();
Examples: // LINE_PARALLEL example // This macro fetches offset of user drawn parallel line // Coordinates of reference line dword xStart = 100; dword yStart = 100; dword xEnd = 200; dword yEnd = 200; // Offset of drawn line dword result = 0; int distX = 0; int distY = 0; result = Int_DrawLine(LINE_PARALLEL, 255, 100, 100, 0, &xStart, &yStart, &xEnd, &yEnd, 1); // Get offset coordinates GetXYFromDWord(result, &distX, &distY);
See Also
Int_DrawCircle, Int_DrawEllipse, Int_DrawMarker, Int_DrawPoly, Int_DrawRectangle, GetXYFromDWord
Description
Int_DrawMarker( intMarkX
, intMarkY
, intMarkOutput
, intMarkType
, intMarkSize
, dwordMarkColor
, intMarkDraw
);
This function can be used for drawing or erasing the markers. You can draw the markers to the binary picture or only to the screen. There are two sizes supported. Drawing the marker to the screen you can specify the output color using the predefined constants. There are ten types of markers.
Parameters
MarkOutput
Specifies the output mode. There are two possibilities to draw the marker to the binary picture or only to the screen.
In this mode you can draw the marker to the screen in specified color (see the color parameter). The marker will not be the part of the binary or color image. | |
In this mode you can draw the marker to the binary image. The Boolean OR function is applied for drawing. | |
In this mode you can draw the marker to overlay image. | |
In this mode you can draw the marker to the backup DC and to the screen, the overlay picture is not affected. |
MarkType
Specifies the marker pattern. You can use numbers from 1 to 10 to select them. Number outside this range will select the default marker.
MarkColor
The color parameter specifies the color of the marker. The color is applied only when the function parameter visible is not zero. Use predefined color constants (RGB_BLACK (0), RGB_BLUE (16711680), RGB_CYAN (16776960), RGB_GREEN (65280), RGB_MAGENTA (16711935), RGB_RED (255), RGB_WHITE (16777215), RGB_YELLOW (65535) or RGB_DEFAULT (2147483647)) or any RGB value. See RGB function for details.
//Int_DrawMarker example - draw markers interactively. dword keys[2], key; int xs, ys; char buf[256]; SetCommandText("Int_DrawMarker example. Working..."); strcpy(buf, " application API Example - Int_DrawMarker.\tPress primary mouse button to draw a mark. To cancel press Esc. "); Int_CreateTextWindow(buf,0,RGB(0,0,128),RGB_WHITE,100); keys[0] = VK_ESC; keys[1] = VK_LBUTTON; while(TRUE) { key = Int_GetEvents(&keys,2); if(key == keys[0]) break; if(key == keys[1]) { Int_GetMousePos(&xs,&ys); Int_DrawMarker (xs,ys,MARKER_TO_SCREEN,1,MARKER_SMALL,RGB_BLUE,1); sprintf(buf, " application API Example - Int_DrawMarker\tCoordinates of the marker x = %i, y = %i pixels ","xs,ys"); Int_CreateTextWindow(buf,0,RGB(0,0,128),RGB_WHITE,100); Wait(2.0); strcpy(buf, " application API Example\tPress primary mouse button to draw a mark. To cancel press Esc. "); Int_CreateTextWindow(buf,0,RGB(0,0,128),RGB_WHITE,100); } } if(ExistProc("ViewColor") == TRUE) ViewColor(); else ViewGray(); Int_CloseTextWindow();
See Also
Int_DrawCircle, Int_DrawEllipse, Int_DrawLine, Int_DrawPoly, Int_DrawRectangle
Description
Int_DrawPoly( intpolyMode
, dwordpolyColor
, dword *polyCoors
, dwordpolyMaxCoors
, intpolyShow
);
This function enables you to draw the polyline in several drawing modes. After calling this function, a predefined cursor appears and you can start drawing. At the end the parameter coors is filled with the polyline coordinates.
Parameters
polyMode
Specifies the polyline drawing mode.
In this mode you can draw the hollow polygon (the first point and the last point are connected). | |
In this mode you can draw the filled polygon (the first point and the last point are connected). | |
In this mode you can draw the polyline (the first point and the last point are not connected). |
polyColor
The color parameter specifies the color of the polyline. The color is applied only when the function parameter polyShow is not zero. Use predefined color constants (RGB_BLACK (0), RGB_BLUE (16711680), RGB_CYAN (16776960), RGB_GREEN (65280), RGB_MAGENTA (16711935), RGB_RED (255), RGB_WHITE (16777215), RGB_YELLOW (65535) or RGB_DEFAULT (2147483647)) or any RGB value. See RGB function for details.
polyCoors
Pointer to points coordinates (DWORDS) that defines the polyline. Filled on output. Call LOWORD to get the x coordinate of the polyline point and call HIWORD to get y coordinate of the point. Macro is responsible for buffer allocation. See comment for further information.
//Int_DrawPoly example - draw a poly interactively. dword key, keys[2], coords[1024]; char buf[256]; word x, y; dword coor; dword firstPoint; SetCommandText("Int_DrawPoly example. Working..."); strcpy(buf, " application API Example - Int_DrawPoly.\tPress primary mouse button to start. To cancel press Esc. "); Int_CreateTextWindow(buf,0,RGB(0,0,128),RGB_WHITE,100); keys[0] = VK_ESC; keys[1] = VK_LBUTTON; while(TRUE) { key = Int_GetEvents(&keys,2); if(key == keys[0]) break; if(key == keys[1]) { coor = Int_GetMousePos(NULL, NULL); Int_PostMessage(VK_LBUTTON, coor); memset(coords, 0, 1024*4); Int_DrawPoly(POLY_HOLLOW,RGB_RED,coords,1024,TRUE); firstPoint = coords[0]; x = LOWORD(firstPoint); y = HIWORD(firstPoint); sprintf(buf," application API Example - Int_DrawPoly\tCoordinates of First Point: x = %i, y = %i ","x,y"); Int_CreateTextWindow(buf,0,RGB(0,0,128),RGB_WHITE,100); Wait(1.5); strcpy(buf, " application API Example - Int_DrawPoly\tPress primary mouse button to start. To cancel press Esc. "); Int_CreateTextWindow(buf,0,RGB(0,0,128),RGB_WHITE,100); } } if(ExistProc("ViewColor") == TRUE) ViewColor(); else ViewGray(); Int_CloseTextWindow();
Note
If you fill the polyCoors with the point coordinates, the function creates the polygon at the start and lets user to edit it. Point coordinates may be filled using MAKELPARAM(x, y). The list of points is terminated with zero. Accordingly, if one of the points is the coordinates origin, you have to put this point on the top of the list (else it causes the function to terminate). Additionally, if you set polyMaxCoors exactly as the number of input points, the function will not let user to add new points on the edges.
See Also
Int_DrawCircle, Int_DrawEllipse, Int_DrawLine, Int_DrawMarker, Int_DrawRectangle
Description
Int_DrawRectangle( intrectMode
, dwordrectColor
, int *lpRectX
, int *lpRectY
, int *lpRectWidth
, int *lpRectHeight
, intrectShow
);
This function enables you to draw the rectangle in several drawing modes. After calling this function, a predefined cursor appears and you can start drawing.
Parameters
rectMode
Specifies the polyline drawing mode.
In this mode you can draw the hollow rectangle. You start drawing by pressing the primary mouse button. To end drawing release the button. After drawing, the variables lpRectX, lpRectY, lpRectWidth and lpRectHeight are filled. | |
In this mode you can draw the filled rectangle. You start drawing by pressing the primary mouse button. To end drawing release the button. After drawing, the variables lpRectX, lpRectY, lpRectWidth and lpRectHeight are filled. | |
In this mode you can draw the hollow rectangle with the fixed center point. To specify the fixed coordinates of the center point, pass them in lpRectX and lpRectY parameters. When some of *lpRectX or *lpRectY equals -1 the current cursor coordinates are used. | |
In this mode you can draw the hollow rectangle with fixed width and height. You specify these values in lpRectWidth and lpRectHeight parameters. | |
In this mode you can draw the hollow rectangle with fixed aspect ratio. The aspect ratio is determined by the initial width and height values. If you assign the x or y coordinate the 65535 value, then the rectangle will be not predrawn. |
rectColor
The color parameter specifies the color of the rectangle. The color is applied only when the function parameter rectShow is not zero. Use predefined color constants (RGB_BLACK (0), RGB_BLUE (16711680), RGB_CYAN (16776960), RGB_GREEN (65280), RGB_MAGENTA (16711935), RGB_RED (255), RGB_WHITE (16777215), RGB_YELLOW (65535) or RGB_DEFAULT (2147483647)) or any RGB value. See RGB function for details.
lpRectX
The pointer to x coordinate of first point of the rectangle. This parameter is filled on output. For RECT_FIXEDCENTER (3) mode the parameter is also filled on input and means the x coordinate of the center.
lpRectY
The pointer to y coordinate of first point of the rectangle. This parameter is filled on output. For RECT_FIXEDCENTER (3) mode the parameter is also filled on input and means the y coordinate of the center.
lpRectWidth
Pointer to the width of the rectangle. This parameter is filled on output. For RECT_FIXEDSIZE (4) the parameter is also filled on input and means the fixed width of the rectangle.
//Int_DrawRectangle example - draw a rectangle interactively. dword keys[2], key; int x_start, y_start; int width, height; int p_width, p_height; char buf[256]; long coor; SetCommandText("Int_DrawRectangle example. Working..."); strcpy(buf, " application API Example - Int_DrawRectangle.\tPress primary mouse button to star. To cancel press Esc. "); Int_CreateTextWindow(buf,0,RGB(0,0,128),RGB_WHITE,100); keys[0] = VK_ESC; keys[1] = VK_LBUTTON; while(TRUE) { key = Int_GetEvents(&keys,2); if(key == keys[0]) break; if(key == keys[1]) { x_start = p_width/2; y_start = p_height/2; Int_PostMessage(VK_LBUTTON, 0); Int_DrawRectangle(RECT_FIXEDCENTER, RGB_DEFAULT, &x_start, &y_start, &width, &height, TRUE); sprintf(buf, " application API Example - Int_DrawRectangle\tWidth = %i, Height = %i pixels ","width, height"); Int_CreateTextWindow(buf,0,RGB(0,0,128),RGB_WHITE,100); Wait(1.5); strcpy(buf, " application API Example - Int_DrawRectangle\tPress primary mouse button to start. To cancel press Esc. "); Int_CreateTextWindow(buf,0,RGB(0,0,128),RGB_WHITE,100); } } if(ExistProc("ViewColor") == TRUE) ViewColor(); else ViewGray(); Int_CloseTextWindow();
See Also
Int_DrawCircle, Int_DrawEllipse, Int_DrawLine, Int_DrawMarker, Int_DrawPoly
Description
Int_MeasureHorizLineWithCenter(
int lineMode
);
This function enables you to measure the distance using parallel lines and show the central line. The label is automatically added with length and its half. After calling this function, a predefined cursor appears and you can start drawing.
Parameters
See Also
Int_DrawCircle, Int_DrawEllipse, Int_DrawLine, Int_DrawMarker, Int_DrawPoly