include "float.s7i";
include "bstring.s7i";
const type: PRIMITIVE_WINDOW is newtype;
IN_PARAM_IS_REFERENCE(PRIMITIVE_WINDOW);
const proc: (ref PRIMITIVE_WINDOW: dest) ::= (in PRIMITIVE_WINDOW: source) is action "DRW_CREATE";
const proc: destroy (ref PRIMITIVE_WINDOW: aValue) is action "DRW_DESTR";
const proc: (inout PRIMITIVE_WINDOW: dest) := (in PRIMITIVE_WINDOW: source) is action "DRW_CPY";
const func boolean: (in PRIMITIVE_WINDOW: win1) = (in PRIMITIVE_WINDOW: win2) is action "DRW_EQ";
const func boolean: (in PRIMITIVE_WINDOW: win1) <> (in PRIMITIVE_WINDOW: win2) is action "DRW_NE";
const func PRIMITIVE_WINDOW: _GENERATE_EMPTY_WINDOW is action "DRW_EMPTY";
const PRIMITIVE_WINDOW: (attr PRIMITIVE_WINDOW) . value is _GENERATE_EMPTY_WINDOW;
const type: pixel is newtype;
IN_PARAM_IS_VALUE(pixel);
const proc: (ref pixel: dest) ::= (in pixel: source) is action "INT_CREATE";
const proc: destroy (ref pixel: aValue) is action "GEN_DESTR";
const proc: (inout pixel: dest) := (in pixel: source) is action "INT_CPY";
const func boolean: (in pixel: pix1) = (in pixel: pix2) is action "INT_EQ";
const func boolean: (in pixel: pix1) <> (in pixel: pix2) is action "INT_NE";
const func pixel: (attr pixel) conv (in integer: num) is action "INT_ICONV3";
const func pixel: pixel (in integer: num) is action "INT_ICONV1";
const func integer: (attr integer) conv (in pixel: aPixel) is action "INT_ICONV3";
const func integer: ord (in pixel: aPixel) is action "INT_ICONV1";
const pixel: (attr pixel) . value is pixel conv 0;
const type: colorLookupTable is array [0 ..] pixel;
const proc: DRAW_POINT (inout PRIMITIVE_WINDOW: aWindow,
in integer: x, in integer: y) is action "DRW_POINT";
const proc: DRAW_PPOINT (inout PRIMITIVE_WINDOW: aWindow,
in integer: x, in integer: y,
in pixel: col) is action "DRW_PPOINT";
const proc: DRAW_LINE (inout PRIMITIVE_WINDOW: aWindow,
in integer: x1, in integer: y1,
in integer: x2, in integer: y2) is action "DRW_LINE";
const proc: DRAW_PLINE (inout PRIMITIVE_WINDOW: aWindow,
in integer: x1, in integer: y1,
in integer: x2, in integer: y2,
in pixel: col) is action "DRW_PLINE";
const proc: DRAW_RECT (inout PRIMITIVE_WINDOW: aWindow,
in integer: x, in integer: y,
in integer: width, in integer: height) is action "DRW_RECT";
const proc: DRAW_PRECT (inout PRIMITIVE_WINDOW: aWindow,
in integer: x, in integer: y,
in integer: width, in integer: height,
in pixel: col) is action "DRW_PRECT";
const proc: DRAW_CIRCLE(inout PRIMITIVE_WINDOW: aWindow,
in integer: x, in integer: y,
in integer: radius) is action "DRW_CIRCLE";
const proc: DRAW_CIRCLE(inout PRIMITIVE_WINDOW: aWindow,
in integer: x, in integer: y,
in integer: radius, in pixel: col) is action "DRW_PCIRCLE";
const proc: DRAW_CLEAR(inout PRIMITIVE_WINDOW: aWindow,
in pixel: col) is action "DRW_CLEAR";
const proc: FILL_CIRCLE(inout PRIMITIVE_WINDOW: aWindow,
in integer: x, in integer: y,
in integer: radius) is action "DRW_FCIRCLE";
const proc: FILL_CIRCLE(inout PRIMITIVE_WINDOW: aWindow,
in integer: x, in integer: y,
in integer: radius, in pixel: col) is action "DRW_PFCIRCLE";
const proc: DRAW_ARC(inout PRIMITIVE_WINDOW: aWindow,
in integer: x, in integer: y, in integer: radius,
in float: startAngle, in float: sweepAngle) is action "DRW_ARC";
const proc: DRAW_ARC(inout PRIMITIVE_WINDOW: aWindow,
in integer: x, in integer: y, in integer: radius,
in float: startAngle, in float: sweepAngle,
in pixel: col) is action "DRW_PARC";
const proc: FILL_ARCCHORD(inout PRIMITIVE_WINDOW: aWindow,
in integer: x, in integer: y, in integer: radius,
in float: startAngle, in float: sweepAngle) is action "DRW_FARCCHORD";
const proc: DRAW_ARC(inout PRIMITIVE_WINDOW: aWindow,
in integer: x, in integer: y, in integer: radius,
in float: startAngle, in float: sweepAngle,
in integer: width, in pixel: col) is action "DRW_PFARC";
const proc: FILL_ARCCHORD(inout PRIMITIVE_WINDOW: aWindow,
in integer: x, in integer: y, in integer: radius,
in float: startAngle, in float: sweepAngle,
in pixel: col) is action "DRW_PFARCCHORD";
const proc: FILL_ARCPIESLICE(inout PRIMITIVE_WINDOW: aWindow,
in integer: x, in integer: y, in integer: radius,
in float: startAngle, in float: sweepAngle) is action "DRW_FARCPIESLICE";
const proc: FILL_ARCPIESLICE(inout PRIMITIVE_WINDOW: aWindow,
in integer: x, in integer: y, in integer: radius,
in float: startAngle, in float: sweepAngle,
in pixel: col) is action "DRW_PFARCPIESLICE";
const proc: DRAW_ARC2(inout PRIMITIVE_WINDOW: aWindow,
in integer: x1, in integer: y1, in integer: x2,
in integer: y2, in integer: radius) is action "DRW_ARC2";
const proc: FILL_ELLIPSE(inout PRIMITIVE_WINDOW: aWindow,
in integer: x, in integer: y,
in integer: width, in integer: height) is action "DRW_FELLIPSE";
const proc: FILL_ELLIPSE(inout PRIMITIVE_WINDOW: aWindow,
in integer: x, in integer: y,
in integer: width, in integer: height,
in pixel: col) is action "DRW_PFELLIPSE";
const func PRIMITIVE_WINDOW: PRIMITIVE_GRAPHIC_OPEN (
ref integer: xPos, ref integer: yPos,
ref integer: width, ref integer: height,
ref string: window_name) is action "DRW_OPEN";
const proc: flushGraphic is action "DRW_FLUSH";
const func PRIMITIVE_WINDOW: openSubWindow (
in PRIMITIVE_WINDOW: aWindow,
ref integer: xPos, ref integer: yPos,
ref integer: width, ref integer: height) is action "DRW_OPEN_SUB_WINDOW";
const proc: setWindowName (in PRIMITIVE_WINDOW: aWindow,
in string: windowName) is action "DRW_SET_WINDOW_NAME";
const proc: setCursorVisible (in PRIMITIVE_WINDOW: aWindow,
in boolean: visible) is action "DRW_SET_CURSOR_VISIBLE";
const func PRIMITIVE_WINDOW: capturePixmap (
ref integer: left, ref integer: upper,
ref integer: width, ref integer: height) is action "DRW_CAPTURE";
const type: pixelArray2d is array array pixel;
const func bstring: getPixelData (
in PRIMITIVE_WINDOW: aWindow) is action "DRW_GET_PIXEL_DATA";
const func bstring: getPixelData (
ref array array pixel: image) is action "DRW_GET_PIXEL_DATA_FROM_ARRAY";
const func pixel: getPixel (
in PRIMITIVE_WINDOW: aWindow,
ref integer: x, ref integer: y) is action "DRW_GET_PIXEL";
const func pixel: getPixel (
in bstring: bImage, in integer: width,
in integer: height, in integer: x,
in integer: y) is action "DRW_GET_IMAGE_PIXEL";
const proc: copyArea (in PRIMITIVE_WINDOW: sourceWindow,
inout PRIMITIVE_WINDOW: destWindow,
ref integer: src_x, ref integer: src_y,
ref integer: width, ref integer: height,
ref integer: dest_x, ref integer: dest_y) is action "DRW_COPYAREA";
const proc: SET_TRANSPARENTCOLOR (in PRIMITIVE_WINDOW: pixmap,
ref pixel: col) is action "DRW_SET_TRANSPARENT_COLOR";
const func integer: hashCode (in PRIMITIVE_WINDOW: aWindow) is action "DRW_HASHCODE";
const func integer: compare (in PRIMITIVE_WINDOW: window1,
in PRIMITIVE_WINDOW: window2) is action "DRW_CMP";
const proc: setContent (inout PRIMITIVE_WINDOW: aWindow,
in PRIMITIVE_WINDOW: pixmap) is action "DRW_SET_CONTENT";
const func pixel: rgbPixel (ref integer: red,
ref integer: green, ref integer: blue) is action "DRW_RGBCOL";
const proc: DRAW_PIXEL_TO_RGB (
in pixel: col, inout integer: red,
inout integer: green, inout integer: blue) is action "DRW_PIXEL_TO_RGB";
const proc: SET_COLOR (ref pixel: aWindow) is action "DRW_COLOR";
const proc: SET_BACKGROUND (ref pixel: aWindow) is action "DRW_BACKGROUND";
const proc: DRAW_TEXT (inout PRIMITIVE_WINDOW: aWindow,
ref integer: x, ref integer: y, in string: stri,
ref pixel: col, ref pixel: bkcol) is action "DRW_TEXT";
const func integer: screenHeight is action "DRW_SCREEN_HEIGHT";
const func integer: screenWidth is action "DRW_SCREEN_WIDTH";
const func integer: height (in PRIMITIVE_WINDOW: aWindow) is action "DRW_HEIGHT";
const func integer: width (in PRIMITIVE_WINDOW: aWindow) is action "DRW_WIDTH";
const func integer: xPos (in PRIMITIVE_WINDOW: aWindow) is action "DRW_XPOS";
const func integer: yPos (in PRIMITIVE_WINDOW: aWindow) is action "DRW_YPOS";
const proc: setPos (in PRIMITIVE_WINDOW: aWindow,
in integer: xPos, in integer: yPos) is action "DRW_SET_POS";
const proc: setSize (in PRIMITIVE_WINDOW: aWindow,
in integer: width, in integer: height) is action "DRW_SET_SIZE";
const proc: toBottom (in PRIMITIVE_WINDOW: aWindow) is action "DRW_TO_BOTTOM";
const proc: toTop (in PRIMITIVE_WINDOW: aWindow) is action "DRW_TO_TOP";
const func array integer: getBorder (in PRIMITIVE_WINDOW: aWindow) is action "DRW_BORDER";
const func integer: pointerXPos (in PRIMITIVE_WINDOW: aWindow) is action "DRW_POINTER_XPOS";
const func integer: pointerYPos (in PRIMITIVE_WINDOW: aWindow) is action "DRW_POINTER_YPOS";
const proc: setPointerPos (in PRIMITIVE_WINDOW: aWindow,
in integer: xPos, in integer: yPos) is action "DRW_SET_POINTER_POS";
const proc: selectInput (in PRIMITIVE_WINDOW: aWindow, in char: aKey,
in boolean: active) is action "GKB_SELECT_INPUT";
const type: pointList is newtype;
IN_PARAM_IS_REFERENCE(pointList);
const proc: destroy (ref pointList: aValue) is action "PLT_DESTR";
const proc: (ref pointList: dest) ::= (in pointList: source) is action "PLT_CREATE";
const proc: (inout pointList: dest) := (in pointList: source) is action "PLT_CPY";
const func pointList: _GENERATE_EMPTY_POINT_LIST is action "PLT_EMPTY";
const pointList: (attr pointList) . value is _GENERATE_EMPTY_POINT_LIST;
const func bstring: bstring (in pointList: aPointList) is action "PLT_BSTRING";
const func pointList: pointList (in bstring: bstri) is action "PLT_POINT_LIST";
const func boolean: (in pointList: pointList1) = (in pointList: pointList2) is action "PLT_EQ";
const func boolean: (in pointList: pointList1) <> (in pointList: pointList2) is action "PLT_NE";
const func integer: hashCode (in pointList: aPointList) is action "PLT_HASHCODE";
const func integer: compare (in pointList: pointList1,
in pointList: pointList2) is action "PLT_CMP";
const func pointList: genPointList (ref array integer: coordinates) is action "DRW_GEN_POINT_LIST";
const func array integer: xyArray (ref pointList: aPointList) is action "DRW_CONV_POINT_LIST";
const func pointList: scale (in pointList: basePoints, in integer: scale) is func
result
var pointList: scaledPoints is pointList.value;
local
var array integer: coordinates is 0 times 0;
var integer: index is 0;
begin
coordinates := xyArray(basePoints);
for key index range coordinates do
coordinates[index] *:= scale;
end for;
scaledPoints := genPointList(coordinates);
end func;
const proc: DRAW_POLYLINE (inout PRIMITIVE_WINDOW: aWindow,
in integer: x, in integer: y, in pointList: point_list,
ref pixel: col) is action "DRW_POLY_LINE";
const proc: FILL_POLYLINE (inout PRIMITIVE_WINDOW: aWindow,
in integer: x, in integer: y, in pointList: point_list,
ref pixel: col) is action "DRW_FPOLY_LINE";