
- •1.Introduction
- •2. Basic part
- •I / o redirection
- •3. Conclusion
- •4. The list of the used literature
- •Module Graph
- •Graphic primitives
- •Example
- •Example
- •Example
- •Pen styles
- •Current graphics brush Brush
- •The brush styles
- •Example
- •Routines for working with font
- •Example
- •Routines for working with graphic window
- •Example
- •Example.
- •Events module GraphAbc
- •Example
- •Example ;
- •I / o redirection
- •Conclusion
- •The list of the used literature
the Ministry of education and science of the Republic of Kazakhstan
SOUTH Kazakhstan STATE PEDAGOGICAL INSTITUTE
Department of Informatics
course work
graphics in Pascal
prepared: Tynybaev A.B.
scientific supervisor: Shomanbaeva M.T.
SHYMKENT 2013
Contents
1.Introduction
Module Graph
2. Basic part
Graphic primitives
Functions for working with color
Color constants
Actions with the pen: procedures and functions
Actions with the pen: the Pen object
Pen style
Actions with the brush: procedures and functions
Actions with the brush: a Brush
The brush styles
Styles hatch brush
Actions font: procedures and functions. Font object. Font styles
Actions with a graphical window: procedures and functions
Actions with a graphical window: the Window object
Action on the coordinate system: procedures and functions
Action on the coordinate system object Coordinate
Lock and drawing acceleration animation
Drawing modes
Events GraphABC
I / o redirection
3. Conclusion
4. The list of the used literature
Module Graph
Module Graph is a simple graphics library designed to create not one of the event graphics and animation programs in procedural and partially in the object style. The drawing is carried out in a special graphic window to draw in multiple Windows without missing. In addition, the module Graph defined the simple events of mouse and keyboard to create elementary event-driven applications. Main sphere of use of the module Graph - training.
Module GraphABC is based on graphics library GDI+, but remembers the current pen, brush, and the font that allows not pass them as parameters of graphic primitives. The properties of the pens, brushes and fonts that you can access both in procedural and object style. For example, to access the current pen color is used procedure SetPenColor(c) and function PenColor, as well as property Pen.Color.
In module GraphABC can be managed by the graphic window and component GraphABCControl, which carried out the drawing. By default the component GraphABCControl occupies the whole of the client part of the graphics window, however, the graphics window you can add controls, reducing the area occupied by the graphical component (as it is done in the modules Robot and Drawman).
To work with pictures used class Picture, allowing to draw on the same graphics primitives, as on the screen.
Lock mode drawing on the screen (LockDrawing) allows drawing only in the buffer, and then using a method Redraw restore all of the graphics window. This method is used to accelerate animation and animation flicker-free.
In module GraphABC defines a number of constants, types, procedures, functions, and classes for drawing the graphics window.
Graphic primitives
The graphics primitives are procedures that draw in the graphics window. To paint the current pen (lines), the current brush (fill closed areas) and the current font (output lines).
procedure SetPixel(x,y: integer; c: Color);
Fills the pixel with coordinates (x,y) color c
procedure PutPixel(x,y: integer; c: Color);
Fills the pixel with coordinates (x,y) color c
function GetPixel(x,y: integer): Color;
Returns the color of a pixel with coordinates (x,y)
procedure MoveTo(x,y: integer);
Sets the current drawing position to point (x,y)
procedure LineTo(x,y: integer);
Draws a line from the current position to point (x,y). The current position is transferred to the point (x,y)
procedure LineTo(x,y: integer; c: Color);
Draws a line from the current position to point (x,y) color c. The current position is transferred to the point (x,y)
procedure Line(x1,y1,x2,y2: integer);
Draws a line from (x1,y1) to the point (x2,y2)
procedure Line(x1,y1,x2,y2: integer; c: Color);
Draws a line from (x1,y1) to the point (x2,y2) color c
procedure FillCircle(x,y,r: integer);
Fills the interior of a circle with center (x,y) and radius r
procedure DrawCircle(x,y,r: integer);
Draws a circle with center (x,y) and radius r
procedure FillEllipse(x1,y1,x2,y2: integer);
Fills the inside of the ellipse defined by the rectangle specified by the coordinates of the opposite vertices (x1,y1) and (x2,y2)
procedure DrawEllipse(x1,y1,x2,y2: integer);
Paints the border of an ellipse defined by the rectangle specified by the coordinates of the opposite vertices (x1,y1) and (x2,y2)
procedure FillRectangle(x1,y1,x2,y2: integer);
Fills the inside of the rectangle coordinates opposite vertices (x1,y1) and (x2,y2)
procedure FillRect(x1,y1,x2,y2: integer);
Fills the interior of the rectangle coordinates opposite vertices (x1,y1) and (x2,y2)
procedure DrawRectangle(x1,y1,x2,y2: integer);
Draws a border around the rectangle, the coordinates opposite vertices (x1,y1) and (x2,y2)
procedure FillRoundRect(x1,y1,x2,y2,w,h: integer);
Fills the interior of the rectangle with rounded corners; (x1,y1) and (x2,y2) ask a couple of opposite vertices, and the w and h - the width and the height of the ellipse used to round the edges
procedure DrawRoundRect(x1,y1,x2,y2,w,h: integer);
Paints the border of a rectangle with rounded corners; (x1,y1) and (x2,y2) ask a couple of opposite vertices, and the w and h - the width and height of the ellipse used to round the edges
procedure Circle(x,y,r: integer);
Draws a filled circle with center (x,y) and radius r
procedure Ellipse(x1,y1,x2,y2: integer);
Draws a filled ellipse, limited rectangle specified coordinates opposite vertices (x1,y1) and (x2,y2)
procedure Rectangle(x1,y1,x2,y2: integer);
Draws a filled rectangle specified coordinates opposite vertices (x1,y1) and (x2,y2)
procedure RoundRect(x1,y1,x2,y2,w,h: integer);
Draws a filled rectangle with rounded corners; (x1,y1) and (x2,y2) ask a couple of opposite vertices, and the w and h - the width and height of the ellipse used to round the edges
procedure Arc(x,y,r,a1,a2: integer);
Draws an arc of a circle with center at point (x,y) and radius r, concluded between two beams that form the corners of the a1 and a2 with OX axis (a1 and a2 - material, are given in degrees and are counted against the clockwise)
procedure FillPie(x,y,r,a1,a2: integer);
Fills the inside of a sector of a circle, a limited arc with center at point (x,y) and radius r, concluded between two beams that form the corners of the a1 and a2 with OX axis (a1 and a2 - material, are given in degrees and measured counterclockwise)
procedure DrawPie(x,y,r,a1,a2: integer);
Draws a sector of a circle, a limited arc with center at point (x,y) and radius r, concluded between two beams that form the corners of the a1 and a2 with OX axis (a1 and a2 - material, are given in degrees and are counted counter arrows)
procedure Pie(x,y,r,a1,a2: integer);
Draws a filled sector of a circle, a limited arc with center at point (x,y) and radius r, concluded between two beams that form the corners of the a1 and a2 with OX axis (a1 and a2 - material, are given in degrees and measured counterclockwise)
procedure DrawPolygon(points: array of Point);
Draws a closed polygonal points whose coordinates appear in the array points
procedure FillPolygon(points: array of Point);
Fills a polygon, the coordinates of the vertices of which appear in the array points
procedure Polygon(points: array of Point);
Draws a filled polygon, the coordinates of the vertices of which appear in the array points
procedure Polyline(points: array of Point);
Draws a polyline using the points whose coordinates appear in the array points
procedure Curve points: array of Point);
Draws a curve points whose coordinates appear in the array points
procedure DrawClosedCurve(points: array of Point);
Draws a closed curve points whose coordinates appear in the array points
procedure FillClosedCurve(points: array of Point);
Fills a closed curve points whose coordinates appear in the array points
procedure ClosedCurve(points: array of Point);
Draws a filled a closed curve points whose coordinates appear in the array points
procedure TextOut(x,y: integer; s: string);
Prints the string s rectangle in the top left corner coordinates (x,y)
procedure FloodFill(x,y: integer; c: Color);
Fills the area of the same color color c, starting from the point (x,y).