
- •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
Example
// The graph. Point. A random color. Working speed
uses GraphABC,Utils;
begin
for var i:=1 to 100000 do
SetPixel(Random(Window.Width),Random(Window.Height),clRandom);
writeln('work time: ',Milliseconds/1000,' second');
end.
Example
// The graph. Transparency
uses GraphABC;
begin
Window.Title := 'Демонстрация прозрачности';
Brush.Color := clRed;
FillRectangle(50,50,100,Window.Height - 50);
Brush.Color := clGreen;
FillRectangle(150,50,200,Window.Height - 50);
Brush.Color := clBlue;
FillRectangle(250,50,300,Window.Height - 50);
Brush.Color := ARGB(127,255,0,0);
FillRectangle(20,100,420,150);
Brush.Color := ARGB(63,0,127,0);
FillRectangle(20,200,420,250);
Brush.Color := ARGB(31,0,0,255);
FillRectangle(20,300,420,350);
end.
Routines for working with the pen Drawing the line is the current pen. Access the properties of the current pen can be carried out both in procedural and object-oriented style. Procedures and functions for accessing the properties of the pen are grouped in pairs: if Prop - property name pen, the function PenProp returns the value of this property and the procedure SetPenProp(p) sets this property: procedure SetPenColor(c: Color); Sets the color of the current pen function PenColor: Color; Returns the current pen color procedure SetPenWidth(Width: integer); Sets the width of the current pen function PenWidth: integer; Returns the width of the current pen procedure SetPenStyle(style: DashStyle); Sets the style for the current pen. Constants pen styles are here function PenStyle: DashStyle; Returns the style of the current pen. Constants pen styles are here procedure SetPenMode(m: integer); Sets the current pen function PenMode: integer; Returns the current pen mode function PenX: integer; Return the x coordinate of the current drawing position function PenY: integer; Return the y coordinate of the current drawing position
In addition, you can modify the properties of the current pen through the Pen object.
The current pen Pen The object returned by the current pen Pen and is of type GraphABCPen:
function Pen: GraphABCPen; Class GraphABCPen has the following interface:
type GraphABCPen = class property NETPen: System.Drawing.Pen; property Color: GraphABC.Color; property Width: integer; property Style: DashStyle; property Mode: integer; property X: integer; property Y: integer; end;
Class properties GraphABCPen are described in the following table:
property Color: GraphABC.Color; The pen color
property Width: integer; Pen width
property Style: DashStyle; Pen style
property Mode: integer; Pen mode
property X: integer;
The X coordinate of the pen
property Y: integer;
The Y coordinate of the pen
Example.
Pen.Color := clRed;
Pen.Style := psDot;
Pen styles
Pen styles are defined enum type DashStyle. In addition, for the pen styles define the following constants:
psSolid = DashStyle.Solid;
Continuous pen
psClear = DashStyle.Clear;
Transparent pen
psDash = DashStyle.Dash;
Stroke pen
psDot = DashStyle.Dot;
Stippled pen
psDashDot = DashStyle.DashDot;
Bar-dotted pen
psDashDotDot = DashStyle.DashDotDot;
Alternative bar-dotted pen
Routines for working with brush
Drawing the innards of closed regions is the current brush. Access to the properties of the current brush can be carried out both in procedural and object-oriented style.
Procedures and functions for accessing the properties of brush grouped in pairs: if the Prop - the name of the brush properties, the function PenProp returns the value of this property and the procedure SetPenProp(p) sets this property:
procedure SetBrushColor(c: Color);
Sets the color of the current brush
function BrushColor: Color;
Returns the current brush color
procedure SetBrushStyle(bs: BrushStyleType);
Sets the style of the current brush
function BrushStyle: BrushStyleType;
Returns the style of the current brush.
procedure SetBrushHatch(bh: HatchStyle);
Sets the hatch of the current brush.
function BrushHatch: HatchStyle;
Returns the hatch of the current brush
procedure SetHatchBrushBackgroundColor(c: Color);
Sets the color of the background of the current brush stroke
function HatchBrushBackgroundColor: Color;
Returns the color of the background of the current brush stroke
procedure SetGradientBrushSecondColor(c: Color);
Installs a second color of the current gradient brush
function GradientBrushSecondColor: Color;
Returns the second color of the current gradient brush