Показаны различия между двумя версиями страницы.
| Следующая версия | Предыдущая версия | ||
|
ob:visual:draw:en [2022/10/02 20:37] iadenisov создано |
ob:visual:draw:en [2022/10/02 20:45] (текущий) iadenisov |
||
|---|---|---|---|
| Строка 1: | Строка 1: | ||
| + | ====== Draw module ====== | ||
| + | |||
| Module to create images to canvas of HTML5. | Module to create images to canvas of HTML5. | ||
| - | CONST | + | CONST\\ |
| - | | + | |
| Most common colors. | Most common colors. | ||
| VAR | VAR | ||
| - | | + | |
| - | | + | |
| - | key: CHAR; | + | key: CHAR;\\ |
| - | | + | |
| - | | + | |
| + | |||
| + | **PROCEDURE Start** | ||
| - | PROCEDURE Start | ||
| Opens a canvas and starts looping the procedure that was set by SetDrawProc. | Opens a canvas and starts looping the procedure that was set by SetDrawProc. | ||
| - | PROCEDURE NoLoop | + | **PROCEDURE NoLoop** |
| Stops looping the procedure that was set by SetDrawProc. | Stops looping the procedure that was set by SetDrawProc. | ||
| - | PROCEDURE Loop | + | **PROCEDURE Loop** |
| Reactivates the DrawProc looping that was stopped by NoLoop. | Reactivates the DrawProc looping that was stopped by NoLoop. | ||
| - | PROCEDURE Redraw | + | **PROCEDURE Redraw** |
| Calls only once the DrawProc procedure that was set by SetDrawProc. | Calls only once the DrawProc procedure that was set by SetDrawProc. | ||
| - | PROCEDURE ColorARGB (alpha, red, green, blue: INTEGER): INTEGER; | + | **PROCEDURE ColorARGB (alpha, red, green, blue: INTEGER): INTEGER;** |
| Make color code from four variables from 0-255. | Make color code from four variables from 0-255. | ||
| - | *** Setting up procedures for callbacks *** | + | ===== Setting up procedures for callbacks |
| + | |||
| + | |||
| + | **PROCEDURE SetSetupProc(s: | ||
| - | PROCEDURE SetSetupProc(s: | ||
| Setting up a procedure for setting up a model. | Setting up a procedure for setting up a model. | ||
| | | ||
| - | PROCEDURE SetDrawProc(d: | + | **PROCEDURE SetDrawProc(d: |
| Setting up a procedure for drawing. | Setting up a procedure for drawing. | ||
| - | PROCEDURE SetPressedProc(c: | + | **PROCEDURE SetPressedProc(c: |
| Setting up a procedure for handling mouse clicks. | Setting up a procedure for handling mouse clicks. | ||
| - | PROCEDURE SetReleasedProc(c: | + | **PROCEDURE SetReleasedProc(c: |
| Set up a procedure to handle mouse release. | Set up a procedure to handle mouse release. | ||
| - | PROCEDURE SetOutProc(c: | + | **PROCEDURE SetOutProc(c: |
| Setting the procedure for the event of the cursor leaving the canvas. | Setting the procedure for the event of the cursor leaving the canvas. | ||
| - | PROCEDURE SetOverProc(c: | + | **PROCEDURE SetOverProc(c: |
| Setting up a procedure for the event that the cursor appears over the canvas. | Setting up a procedure for the event that the cursor appears over the canvas. | ||
| - | PROCEDURE SetKeyPressedProc(c: | + | **PROCEDURE SetKeyPressedProc(c: |
| Set up a procedure for a keypress event on a keyboard. | Set up a procedure for a keypress event on a keyboard. | ||
| - | *** Common *** | + | ===== Common ===== |
| + | |||
| + | |||
| + | **PROCEDURE SetFrameRate* (fps : INTEGER);** | ||
| - | PROCEDURE SetFrameRate* (fps : INTEGER); | ||
| Specifies the number of frames per second (fps) to be displayed | Specifies the number of frames per second (fps) to be displayed | ||
| in the animation. If the processor is not fast enough to maintain | in the animation. If the processor is not fast enough to maintain | ||
| Строка 61: | Строка 78: | ||
| The default rate is 60 frames per second. | The default rate is 60 frames per second. | ||
| - | PROCEDURE SetBackground(argb : INTEGER); | + | **PROCEDURE SetBackground(argb : INTEGER);** |
| - | PROCEDURE SetSize(w, h : INTEGER); | + | **PROCEDURE SetSize(w, h : INTEGER);** |
| + | |||
| + | **PROCEDURE Fill(argb : INTEGER);** | ||
| - | PROCEDURE Fill(argb : INTEGER); | ||
| Sets the color used to fill shapes, incl. characters | Sets the color used to fill shapes, incl. characters | ||
| - | PROCEDURE NoFill; | + | **PROCEDURE NoFill;** |
| Disabl filling shapes. If NoFill are called, nothing will be drawn to the screen. | Disabl filling shapes. If NoFill are called, nothing will be drawn to the screen. | ||
| + | ** | ||
| + | PROCEDURE Stroke(argb : INTEGER);** | ||
| - | PROCEDURE Stroke(argb : INTEGER); | ||
| Sets the color used to draw lines and borders around shapes. | Sets the color used to draw lines and borders around shapes. | ||
| + | ** | ||
| + | PROCEDURE NoStroke;** | ||
| - | PROCEDURE NoStroke; | ||
| Disable drawing the stroke (outline) shapes. | Disable drawing the stroke (outline) shapes. | ||
| If NoStroke are called, nothing will be drawn to the screen. | If NoStroke are called, nothing will be drawn to the screen. | ||
| Строка 80: | Строка 101: | ||
| PROCEDURE StrokeWidth(width : INTEGER); | PROCEDURE StrokeWidth(width : INTEGER); | ||
| - | PROCEDURE Smooth; | + | **PROCEDURE Smooth;** |
| - | PROCEDURE NoSmooth; | + | ** |
| + | PROCEDURE NoSmooth;** | ||
| Enables or disables Drawing all geometry with smooth (anti-aliased) edges. | Enables or disables Drawing all geometry with smooth (anti-aliased) edges. | ||
| - | *** Geometric figures | + | ===== Geometric figures |
| PROCEDURE Point(x0, y0: REAL); | PROCEDURE Point(x0, y0: REAL); | ||
| Строка 98: | Строка 122: | ||
| - | *** Geometric shapes with integer arguments | + | ===== Geometric shapes with integer arguments |
| PROCEDURE Pointi(x0, y0: INTEGER); | PROCEDURE Pointi(x0, y0: INTEGER); | ||
| Строка 111: | Строка 136: | ||
| - | *** Texts *** | + | ===== Texts ===== |
| PROCEDURE SetFont* (name: ARRAY OF CHAR); | PROCEDURE SetFont* (name: ARRAY OF CHAR); | ||
| Строка 122: | Строка 148: | ||
| - | *** Images | + | ===== Images |
| PROCEDURE LoadImage* (name: ARRAY OF CHAR): Image; | PROCEDURE LoadImage* (name: ARRAY OF CHAR): Image; | ||
| Строка 129: | Строка 156: | ||
| - | *** Transformation *** | + | ===== Transformation ===== |
| + | |||
| + | |||
| + | **PROCEDURE Translate(x, | ||
| - | PROCEDURE Translate(x, | ||
| Shifts the origin (0, 0) of the coordinates of the canvas | Shifts the origin (0, 0) of the coordinates of the canvas | ||
| in the specified direction: x to the right, y downwards. | in the specified direction: x to the right, y downwards. | ||
| - | PROCEDURE PushMatrix; | + | **PROCEDURE PushMatrix;** |
| - | PROCEDURE PopMatrix; | + | |
| + | **PROCEDURE PopMatrix;** | ||
| Pushes or pops the current transformation matrix onto the matrix stack. | Pushes or pops the current transformation matrix onto the matrix stack. | ||
| PushMatrix saves the current coordinate system to the stack | PushMatrix saves the current coordinate system to the stack | ||
| and PopMatrix restores the prior coordinate system. | and PopMatrix restores the prior coordinate system. | ||
| - | PROCEDURE Rotate(angle : REAL); | + | **PROCEDURE Rotate(angle : REAL);** |
| Rotates the amount specified by the angle parameter. | Rotates the amount specified by the angle parameter. | ||
| Angles must be specified in radians (values from 0 to 2π), | Angles must be specified in radians (values from 0 to 2π), | ||
| or they can be converted from degrees to radians | or they can be converted from degrees to radians | ||
| with the Math.Radians() function. | with the Math.Radians() function. | ||