bgi and plot library
Posted: Fri Oct 02, 2015 4:05 pm
i don't know if anybody can use these modules, but after some help of some people here
i now have debugged them and they work good. they were not created for speed, even so they are very fast, but for plotting.
UPDATED - windows repaint works source updated
UPDATED - new GetImage and PutImage functions, resize window now retains content source updated
UPDATED - new GetImage and PutImage functions, resize window now retains content source updated thanks to infratec changes to textoutput
module bgi:

UPDATED - windows repaint works source updated
UPDATED - new GetImage and PutImage functions, resize window now retains content source updated
UPDATED - new GetImage and PutImage functions, resize window now retains content source updated thanks to infratec changes to textoutput
module bgi:
Code: Select all
DeclareModule MINIBGI
EnableExplicit
; update constants
#UpdateOff = 0
#UpdateOn = 1
#UpdateNow = 2
; clipping constants
#ClipOn = 1
#ClipOff = 0
; drawing modes on screen
#CopyMode = 0
#XorMode = 1
#OrMode = 2
#AndMode = 3
#NotMode = 4
#NotScrMode = 5
#NotXorMode = 6
#NotOrMode = 7
#NotAndMode = 8
#InvColAndMode = 9
#InvColOrMode = 10
#InvScrAndMode = 11
#InvScrOrMode = 12
#BlackMode = 13
#WhiteMode = 14
#EmptyMode = 15
#TRANSPARENT_ = $00
#OPAQUE_ = 16
; drawing style For lines
#SolidLn = 0
#DottedLn = 1
#DashDotLn = 2
#DashedLn = 3
#DashDotDotLn = 4
#UserBitLn = 5
#NullLn = 6
; thick constants For lines
#NormWidth = 1
#DoubleWidth = 2
#TripleWidth = 3
#QuadWidth = 4
#ThickWidth = #TripleWidth
; filling patterns
#EmptyFill = 0
#SolidFill = 1
#LineFill = 2
#ColFill = 3
#HatchFill = 4
#SlashFill = 5
#BkSlashFill= 6
#XHatchFill = 7
#UserFill = 8
#NoFill = 9
; Bar3D constants
#TopOn = 1
#TopOff = 0
; flood mode constants
#BorderFlood = 0
#SurfaceFlood = 1
; justify constants For text
#LeftText = 0
#CenterText = 1
#RightText = 2
#TopText = 0
#BottomText = 1
#BaselineText = 2
; direction constants For text
#HorizDir = 0
#VertDir = 90
; font constants For text
#CourierNewFont = 0
#MSSansSerifFont = 1
#TimesNewRomanFont= 2
#ArialFont = 3
#DefaultFont = #CourierNewFont
#ItalicFont = $1000
#UnderlineFont = $0100
#BoldFont = $0010
; Symbols for graphs
#SYMBOLRECTANGLE = 1
#SYMBOLTRIANGLE = 2
#SYMBOLDIAMOND = 3
#SYMBOLCROSS = 4
#SYMBOLXCROSS = 5
#SYMBOLNONE = 0
#CAPTUREBLT = $40000000 ; Necessary for BitBlt to get layered windows if present on screen
#NOMIRRORBITMAP = $80000000 ; Do not Mirror the bitmap in this call
Structure ViewPortType
x1.w
y1.w
x2.w
y2.w
clip.l ; BOOLEAN
EndStructure
Structure PointType
x.l
y.l
EndStructure
Structure ThreeDPointType
x.d
y.d
z.d
EndStructure
Structure LineSettingsType
linestyle.w
pattern.w
thickness.w
EndStructure
Structure ArcCoordsType
x.l
y.l
xstart.i
ystart.i
xend.i
yend.i
EndStructure
Structure FillSettingsType
pattern.w
color.l
EndStructure
Structure TextSettingsType
font.w
direction.w
charsize.w
horiz.w
vert.w
EndStructure
Structure BGIimage
width.i
height.i
size.i
*bits
EndStructure
Macro INC(i,j=1)
i + j
EndMacro
Macro DEC(i,j=1)
i - j
EndMacro
; initialization exported routines
; Clears the entire graphics screen using ClearViewPort routine. See that routine For details. Current pointer is reset
; at (0,0), that is top-left corner of the screen.
Declare ClearDevice()
; Closes the graphics window And releases all resources related To it. The parent console window is shown again in foreground
; (If any). You can Restore back the graphics window using SetGraphMode Or InitGraph.
Declare CloseGraph()
; Use CloseGraph To close the graphics window.
Declare.i InitGraph(WinX.l, WinY.l, title.s, Color.i=#Black, BackColor.i=#White)
; Sets the dimensions of the graphics window To be created by InitGraph. In this Case you must use mCustom graphics mode. (width)
; is the width And (height) is the height in pixels of the window client area. Returns the PB window number.
; screen management exported routines
Declare ClearDeviceWithColor(color.l)
Declare ClearViewPortWithColor(color.l)
; Clears the current viewport. The current background color is used As filling color. The pointer is set at (0,0),
; that is top-left corner of the viewport. See also SetViewPort And SetBkColor For more details.
Declare ClearViewPort()
Declare GetAspectRatio(*xasp.word, *yasp.word)
; Returns the maximum x-coordinate (horizontal) in pixels. This equals the client area width minus 1. Maximum is placed on the
; right side.
Declare.i GetMaxX()
; Returns the maximum y-coordinate (vertical) in pixels. This equals the client area height minus 1. Maximum is placed on the
; bottom side.
Declare.i GetMaxY()
; Returns the current viewport And clipping settings in (viewport). You can change these settings using SetViewPort.
Declare GetViewSettings(*tviewport.ViewPortType)
; Returns the x-coordinate of the current position of the graphical pointer in pixels. It ranges between 0 And GetMaxX.
; It increases from left To right.
Declare.i GetXX()
; Returns the y-coordinate of the current position of the graphical pointer in pixels. It ranges between 0 And GetMaxY.
; It increases from top To bottom.
Declare.i GetYY()
; Sets the aspect ratio of the screen To the ratio given by xasp/yasp. It affects only routines For circular shapes. Does Not
; have a practical use other than backward compatibility With BP. Default values are (10000,10000). See also GetAspectRatio.
Declare SetAspectRatio(xasp,yasp.i)
; Sets the current output viewport To the rectangle defined by the top-left corner (x1,y1) And the bottom-right corner (x2,y2).
; If (clip) is true, anything drawn outside the viewport will be clipped (Not drawn). Coordinates specified after this call are
; relative To the top-left corner of the viewport. Cursor position is reset To (0,0). The following clipping constants are defined:
; ClipOn = #true
; ClipOff = #false
Declare SetViewPort(x1.l,y1.l,x2.l,y2.l, clip.l) ; BOOLEAN
; It specifies what binary operation is performed when drawing on screen. Argument (writemode) has two components. First
; component is the foreground mix mode. It affects contours (including lines) And filled shapes (excluding Bar). Can be one of
; the following pre-defined constants:
; CopyMode - pixels are simply copied onto the screen
; XorMode - pixels are combination of the drawing color And screen color, but Not in both (logical XOr)
; OrMode - pixels are combination of the drawing color And screen color (logical Or)
; AndMode - pixels are combination of the colors common To both the drawing And screen (logical And)
; NotMode - pixels are the inverse of the drawing color (logical Not)
; NotScrMode - pixels are the inverse of the screen color
; NotXorMode - pixels are the inverse of the XorMode color
; NotOrMode - pixels are the inverse of the OrMode color
; NotAndMode - pixels are the inverse of the AndMode color
; InvColAndMode - pixels are combination of the colors common To both the screen And the inverse of drawing color
; InvColOrMode - pixels are combination of the screen color And the inverse of drawing color
; InvScrAndMode - pixels are combination of the colors common To both the drawing And the inverse of screen color
; InvScrOrMode - pixels are combination of the drawing color And the inverse of screen color
; BlackMode - pixels are always 0
; WhiteMode - pixels are always 1
; EmptyMode - screen pixels remain unchanged
; Second component is the background mix mode. It affects only texts. Can be one of the following two pre-defined constants:
; Transparent - screen remains untouched (As in BP graph unit)
; Opaque - screen is filled With the current background color before the text is drawn
; Argument (writemode) is an Or-ed combination of the foreground And background mix modes. By Default it equals CopyMode Or Transparent.
; SetWriteMode does Not perform well on palette-based drivers, especially If the palette was Not retrived by GetSystemPalette
; routine. Anyway, because the palette is just a logical one you must use UpdateGraph routine To assure that the screen has the
; same color composition As the active page.
; You can use InvertRect To perform logical Not operations over the screen content.
Declare SetWriteMode(writemode.l)
; color management exported routines
; Returns the current background color. This is a palette entry For palette-based drivers And an absolute RGB color For
; non-palette driver. Use SetBkColor To set a new color.
Declare.l GetBkColor()
; Returns the current drawing color. This is a palette entry For palette-based drivers And an absolute RGB color For
; non-palette driver. Use SetColor To set a new color.
Declare.l GetColor()
; Returns the highest color which can be set With SetColor Or other routines that accept colors. Depending on palette, this
; color is Not always White. All colors between 0 And GetMaxColor are guarantied To be valid.
; it equals FFFFFFH.
Declare.l GetMaxColor()
; Gets the pixel color of the point at position (x,y). This is a palette entry For palette-based drivers And an absolute RGB
; color For non-palette driver. To set a new color For the pixel use PutPixel.
Declare.l GetPixel(x.l,y.l)
; Returns the (Red,Green,Blue) intensity components of the color (color) in (r), (g), (b) variables. Their values range
; between 0 And 255. For example, Black returns (0,0,0). See also GetRGBColor. Parameter (color) is a palette index in
; palette-based drivers And a true RGB color For the non-palette driver.
Declare GetRGBComponents(color.l, *r.long,*g.long,*b.long, *t.long=#Null)
; Returns a maximum of 256 colors from Windows system palette. This is the palette initialized by the operating system at
; start-up. You have no guaranty that this palette is the same across all systems. In fact, it"s not.
;Declare GetSystemPalette(*palette.PaletteType)
; Sets the background color To (color). Check SetColor To learn about color values.
; The background color is the color used To clear portions of the screen (Or the entire viewport). It is also used As dual color
; in filling patterns. SetBkColor affects only subsequent drawings. Default color is Black.
Declare SetBkColor(color.l)
; Sets the foreground color To (color). For palette-based drivers the value of (color) is an index into the palette. For
; non-palette driver (color) stores a 24 bits RGB value encoded in hexadecimal form. The low-order byte contains a value For
; the relative intensity of red, the second byte contains a value For green And the third byte contains a value For blue
; (ex 0000FFH is Red). In both cases, pre-defined color names can be used instead of pure numbers. Consult InitGraph about graphics
; drivers And the section Alphabetical color names. See GetNamesPalette routine For more details on colors.
; The foreground color is the color used For drawing contours, lines And text. Other primitives have different ways To specify
; the color. Default color is White.
Declare SetColor(color.l)
; drawing primitives exported routines
; Draws part of a circle With center at (x,y), radius (radius), starting from angle (start), stopping at angle (stop).
; These angles are measured counter-clockwise. It uses current foreground color. To draw an entire circle use Circle.
Declare Arc(x.l,y.l, start.l,stop.l,radius.l)
; Draws a complete circle With center at (x,y) And radius (radius). To draw part of a circle use Arc.
; Circle is a particular Case of Ellipse.
Declare Circles(x.l,y.l, radius.l)
; Draws one Or more cubic Bezier curves, using the current foreground color. A Bezier curve is defined by two endpoints And
; two control points in between. A number of 3N+1 vertices will Define exactly N Bezier curves. The arguments are the same As in
; DrawPoly. It can be used To draw irregular curves, but a particular Case is a rotated ellipse. See RotEllipse For details.
Declare DrawBezier(nrpoints.i, Array *polypoints.PointType(1))
; Draws a polygon With (nrpoints) corner points, using the current foreground color And line style. Argument (polypoints)
; should be an Array of type PointType containing at least (nrpoints) records. No check is performed. The last corner point is
; Not drawn. It is usually faster that using several LineTo calls.
Declare DrawPoly(nrpoints.i, Array *polypoints.PointType(1))
; Draws part of an ellipse With center at (x,y). Arguments (xradius) And (yradius) are the horizontal And vertical radii of the
; ellipse, (start) And (stop) are the starting And stopping angles of the arc of the ellipse. They are measured counter-clockwise
; from the x-axis (3 o’clock is equal To 0 degrees). It uses current foreground color. To draw part of a circle use Arc.
; To draw a rotated ellipse use RotEllipse.
Declare Ellipses(x.l,y.l, start.l,stop.l,xradius.l,yradius.l)
Declare GetArcCoords(*arccoords.ArcCoordsType)
; Returns the current line settings in (lineinfo). That is, line style, pattern And thickness, As set by SetLineStyle.
Declare GetLineSettings(*lineinfo.LineSettingsType)
; Draws a line starting from (x1,y1) To (x2,y2), using the current foregroung color And line style. The current position is
; moved To (x2,y2). See LineTo For more details.
Declare Lines(x1.l,y1.l,x2.l,y2.l)
; Draws a line starting from the current pointer position To the Point (dx,dy), relative To the current position, using the
; current foreground color And line style. The current position is moved To the endpoint of the line. See LineTo For more details.
Declare LineRel(dx.l,dy.l)
; Draws a line starting from the current pointer position To the Point (x,y), using the current foregroung color And line style.
; The current position is moved To (x,y).
; Use SetLineStyle routine To set the line attributes And SetColor To set its color. Use MoveTo To change the current pointer
; position. To draw a line With absolute coordinates use Line routine instead.
Declare LineTo(x.l,y.l)
; Moves the pointer To coordinates (dx,dy), relative To the current pointer position. See MoveTo For more details.
Declare MoveRel(dx.l,dy.l)
; Moves the pointer To coordinates (x,y) which are viewport-relative. See SetViewPort For more details. Only the following
; routines use Or move the current pointer:
; ClearDevice
; ClearViewPort
; GraphDefaults
; Line
; LineRel
; LineTo
; MoveRel
; MoveTo
; OutText
; OutTextXY
; SetViewPort
; No check is made regarding coordinates range.
Declare MoveTo(x.l,y.l)
; Puts a point at position (x,y) using color (color). Check SetColor To learn about color values. Use GetPixel To retrive a
; pixel color.
Declare PutPixel(x.l,y.l, color.l)
; Draws a rectangle defined by the top-left corner (x1,y1) And the bottom-right corner (x2,y2). It uses the current foreground
; color And line style. To draw a filled rectangle use FillRect.
; Rectangle is a particular Case of DrawPoly.
Declare Rectangle(x1.l,y1.l,x2.l,y2.l)
; Draws a rotated ellipse With center at (x,y). Arguments (xradius) And (yradius) are the horizontal And vertical radii of the
; ellipse, (rot) defines the rotation angle measured counter-clockwise in degrees. It uses current foreground color. It is
; implemented using DrawBezier.
Declare RotEllipse(x.l,y.l,rot.i, xradius.i,yradius.i)
; Sets the drawing style For lines. The (linestyle) is one of the following constants:
; SolidLn - solid line
; DashedLn - dashed line
; DottedLn - dotted line
; DashDotLn - alternating dashes And dots line
; DashDotDotLn - dashes And double dots line
; UserBitLn - user defined line
; NullLn - invisible line
; If UserBitLn is specified then (pattern) should contain the 16-bit pattern. In all another cases (pattern) is ignored. The
; parameter (thickness) indicates how thick the line should be:
; NormWidth - one pixel width
; DoubleWidth - two pixels width
; TripleWidth - three pixels width
; QuadWidth - four pixels width
; ThickWidth=TripleWidth
; If (thickness) <> NormWidth then (linestyle) is ignored And the line is drawn solid, due To Windows GDI limitations.
; (thickness) is ignored For UserBitLn style because of missing implementation. Use SetColor To set the line color.
Declare SetLineStyle(linestyle.i,pattern.l,thickness.i)
; filled drawings exported routines
; Draws And fills a rectangle With opposite corners at (x1,y1) And (x2,y2), using the current fill style And color.
; This rectangle has no border. Use FillRect To draw a filled rectangle With border.
Declare Bar(x1.l,y1.l,x2.l,y2.l)
; Draws And fills a 3-dimensional bar With opposite corners of the front facet at (x1,y1) And (x2,y2). It uses the
; current foreground color. Only front facet is filled With the current fill style And color. Argument (depth) specifies
; the number of pixels used To show the depth of the bar. If (top) is true, then a 3-dimensional top is drawn.
; Its pre-defined values are
; TopOn = true
; TopOff = false
; Use Bar To draw a 2-dimensional bar.
Declare Bar3D(x1.l,y1.l,x2.l,y2.l, depth.l, top.l, col.l) ; BOOLEAN
; Draws And fills a chord (a region bounded by the intersection of an ellipse And a line segment - called a secant).
; It uses the current foreground color And fill style. The arguments have the same meaning As in Ellipse. To draw a
; sector of an ellipse use Sector.
Declare Chord(x.l,y.l, start.i,stop.i,xradius.i,yradius.i)
; Draws And fills an entire ellipse With center at (x,y). Arguments (xradius) And (yradius) are the horizontal And vertical
; radii of the ellipse. It uses the current foreground color And fill style. To draw a sector of an ellipse use Sector.
Declare FillEllipse(x.l,y.l,xradius.i,yradius.i, col.l=-1)
; Draws And fills a polygon, using the current foreground color, line And fill style. The arguments are the same As in DrawPoly.
; The polygon is closed automatically by drawing a line from the last vertex To the first.
Declare FillPoly(nrpoints.i, Array *polypoints.PointType(1))
; Draws And fills a rectangle, using the current foreground color, line And fill style. The arguments are the same As in Rectangle.
; To draw a borderless rectangle use Bar instead.
; FillRect is a particular Case of FillPoly.
Declare FillRect(x1.l,y1.l,x2.l,y2.l, col.l=-1)
; Fills a region surrounding the Point (x,y) Until a color-condition is met. This condition depends on (color) And the flood mode.
; This mode is set With SetFloodMode routine.
; There are some reasons this routine might fail:
; (1) the filling could Not be completed (out of memory) - unlikely
; (2) the specified point has the boundary color specified by the (color)
; parameter (in BorderFlood mode)
; (3) the specified point does Not have the color specified by (color)
; parameter (in SurfaceFlood mode)
; (4) the point is outside the current viewport, that is, it is Not visible
; See SetFloodMode For details.
Declare FloodFill(x.l,y.l, color.l)
; Returns in (fillpattern) the current fill-pattern Array. This was set using SetFillPattern routine.
Declare GetFillPattern(Array *fillpatternn.byte(1)) ;FillPatternType
; Returns the current fill-settings in (fillinfo). This Structure contains the fill pattern And color, As set by SetFillStyle routine
Declare GetFillSettings(*fillinfo.FillSettingsType)
; Performs a logical Not operation on the color values For each pixel in the specified rectangle defined by coordinates (x1,y1,x2,y2).
; On monochrome driver, InvertRect makes white pixels black And black pixels white. On color drivers, the inversion depends on
; how colors are generated. Calling InvertRect twice For the same rectangle restores the display To its previous colors. It does
; Not perform well on palette-based drivers. See also SetWriteMode.
Declare InvertRect(x1.l,y1.l,x2.l,y2.l)
; Draws And fills a circular sector (a region bounded by the intersection of a circle And two radials - called pie slice).
; It uses the current foreground color And fill style. The arguments have the same meaning As in Arc. To draw an entire disk
; use FillEllipse.
; PieSlice is a particular Case of Sector
Declare PieSlice(x.l,y.l, start.i,stop.i,radius.l)
; Draws And fills a rectangle With rounded corners, using the current foreground color, fill style And color. The argument (r)
; is the radius of a circle used To draw the corners. The other parameters are the same As in Rectangle.
Declare RoundRect(x1.l,y1.l,x2.l,y2.l,r.l)
; Draws And fills an elliptical sector (a region bounded by the intersection of an ellipse And two radials). It uses the
; current foreground color And fill style. The arguments have the same meaning As in Ellipse. To draw a sector of a circle use PieSlice.
Declare Sector(x.l,y.l, start.i,stop.i,xradius.i,yradius.i)
; Selects a user-defined fill pattern which will be used in SetFillStyle routine With UserFill hatch set. The pattern is an 8x8
; raster, corresponding To the 64 bits in (fillpattern). Foreground pattern color is set To (color). Default is White. Background
; pattern color is the background color selected by SetBkColor. Check SetColor To learn more about colors.
; Before returning it calls SetFillStyle routine To put the pattern into effect.
Declare SetFillPattern(Array fillpattern.b(1), color.l) ; FillPatternType
; Sets the filling pattern And color For filled drawings routines. Argument (pattern) can be one of the following constants:
; EmptyFill - background color hatch
; SolidFill - solid hatch
; LineFill - horizontal hatch
; ColFill - vertical hatch
; HatchFill - horizontal And vertical cross-hatch
; SlashFill - 45-degree upward, left-To-right hatch
; BkSlashFill - 45-degree downward, left-To-right hatch
; XHatchFill - 45-degree cross-hatch
; UserFill - user-defined hatch
; NoFill - no hatch
; If (pattern) equals UserFill, the user-defined pattern set by SetFillPattern becomes the active pattern. In this Case, the
; argument (color) is ignored. Parameter (color) is used To fill the shapes. Default is White. Check SetColor To learn about
; color values.
Declare SetFillStyle(pattern.l, color.l)
; Sets the mode in witch flood-fills are performed With FloodFill routine. Argument (floodmode) has the following pre-defined
; values:
; BorderFlood - the fill area is bounded by the color specified in FloodFill filling begins at the specified point and continues
; in all directions Until it reaches the color bounding the area this is the default.
; SurfaceFlood - the fill area is defined by the color that is specified in FloodFill filling begins at the specified point and
; continues in all directions over all adjacent regions containing the specified color this mode is useful for
; filling areas With multicolored boundaries
; See also FloodFill routine.
Declare SetFloodMode(floodmode.l)
; text And font handling exported routines
; Retrieves some information about the current selected font. First argument contains the full registered name of the font
; (ex. "Courier New"). It is the same name used by routine InstallUserFont when the font was installed. Variables (width) And
; (height) contain the maximum dimensions of the characters in the font. If you want To retrive the dimensions of specific
; characters use TextWidth And TextHeight routines. Boolean argument (ttfont) specify If the technology of this font is a
; TrueType one. If so, the text can be rotated on screen using SetTextStyle routine. Otherwise, it cannot be rotated.
Declare GetFontSettings(fontname.s, *width.integer, *height.integer, *ttfont.integer) ; BOOLEAN
; Returns the current font And text settings in argument (textinfo). This contains the font type, direction, magnification,
; horizontal And vertical alignment, As set by SetTextStyle And SetTextJustify routines.
Declare GetTextSettings(*textinfo.TextSettingsType)
; Installs a new font And returns its index into the installed font table. This index can be used With SetTextStyle To enable
; the font For texts. The parameter (fontname) must be a valid family font name registered into the system (ex: " Fixedsys").
; The name IS Case sensitive. If the font cannot be registered, InstallUserFont will Return -1.
; InitGraph installs several fonts using this routine. Default font is set To "Courier New". Other installed fonts are listed in
; section Font constants For text. For more info about fonts see SetTextStyle.
Declare.i InstallUserFont(fontname.s)
; Puts (textstring) on the screen, at the current pointer position, using the current font And text settings. The current
; position is moved To the End of the text. Use SetTextStyle To change font style And SetTextJustify To change text alignment.
; To put text on an absolute location use OutTextXY instead.
Declare OutText(textstring.s, color.l = -1, bcol.l = -1)
; Puts (textstring) on the screen, at the coordinates (x,y), using the current font And text settings. The current position is
; moved To the End of the text. See OutText For more details.
Declare OutTextXY(x.l, y.l, textstring.s, color.l = -1, bcol.l = -1)
; It controls the placement of new text, relative To the cursor position. Argument (horiz) controls horizontal placement, And
; can be one of the following pre-defined constants:
; LeftText - text is set left of the pointer
; CenterText - text is set centered horizontally on the pointer
; RightText - text is set To the right of the pointer
; Argument (vert) controls the vertical placement of the text. Its value can be one of the following pre-defined constants:
; TopText - text is placed above the pointer
; BottomText - text is placed under the pointer
; BaselineText - text is placed relative To its base line
; Default text placement is LeftText And TopText.
Declare SetTextJustify(horiz.i,vert.i)
; It controls the style of text To be put on the screen. Pre-defined constants For (font) are:
; CourierNewFont - Courier New font
; MSSansSerifFont - MS Sans Serif font
; TimesNewRomanFont - Times New Roman font
; ArialFont - Arial font
; DefaultFont=CourierNewFont
; Besides, any successfully installed user font can be used insted. See InstallUserFont For details. All these fonts can be Or-ed
; With the following additional styles To change their appearance:
; ItalicFont - italic font
; UnderlineFont - underlined font
; BoldFont - bold font
; Argument (direction) sets the direction of text. It can be any positive value in degrees Or one of the following constants:
; HorizDir = 0
; VertDir = 90
; Between 1 And 5, (charsize) represents the magnification of the characters With a standard font size of 8 pixels. Above 6 it
; represents an absolute font size. Default is set To 16.
; Be aware that some fonts (including pre-defined) do Not support all these styles. See GetFontSettings routine For more details.
; Use SetColor To set text color.
Declare SetTextStyle(font.i,direction.l,charsize.l)
; First argument (nCharExtra) sets the intercharacter spacing in text And the second one (nBreakExtra) sets the amount of space
; reserved For Break character. The other ones are dummy arguments (Not used). This is a major incompatibility With BP graph unit.
; Default values are zero.
; See SetTextStyle For other text styles.
Declare SetUserCharSize(nCharExtra.i,nBreakExtra.i,dummy1.i,dummy2.i)
; Returns the height (in pixels) of the (textstring) in the current font style. This value might be altered by a call To
; SetTextStyle Or SetUserCharSize.
Declare.i TextHeights(textstring.s)
; Returns the width (in pixels) of the (textstring) in the current font style. This value might be altered by a call To
; SetTextStyle Or SetUserCharSize.
Declare.i TextWidths(textstring.s)
Declare THREEDto2DAll(*coords.ThreeDPointType, *pan.ThreeDPointType, *centre.ThreeDPointType, *position.ThreeDPointType, zoom.d, *sx.double, *sy.double)
Declare THREEDto2D(*coords.ThreeDPointType, zoom.d, *sx.double, *sy.double)
Declare DrawSymbol(x.l, y.l, color.l, symbol.l, width.l, height.l)
; caret format: block Or underline
Global CaretBlock.i = 1
; caret blink rate in tenths OF a second
Global BlinkRate.i = 2
Declare DrawCaret(nr.i)
Declare TextSettings()
#PLUS = 1
#BOX = 2
#CROSS_X_LIKE = 3
#TRIANGLE = 4
#INVERTEDTRIANGLE = 5
#OPENCIRCLE = 6
#FILLEDCIRCLE = 7
#DOT = 8
Declare PlotSymbol(X.d,Y.d, Symbol.i, SymSize.i, color.i=-1)
#SNone = 0
#SArrow = 1
#SBox = 2
#SCircle= 3
#SLine = 4
#SDLine = 5
#SDCross= 6
Declare LineCaped(x1.i, y1.i, x2.i, y2.i, left.i=#SNone, right.i=#SNone, colr.l=-1, coll.l=-1, filledl.i=#False, filledr.i=#False)
Declare IsClipping() ; returns #true/#false
; get handles to the outside
Declare.i GetDC()
Declare.i GetHWND()
; Retains the content of the windows
Declare ReSetWindowSize(width.l,height.l)
; Places a copy of the screen area given by rectangle With coordinates (x1,y1,x2,y2) in the
; variable (bitmap). This variable must have enough room To accomodate the image (use ImageSize
; To get the exact size). Afterwards the image can be put back on screen using PutImage.
; The format of bitmap is hardcoded To 24 bits per pixel, so it is driver independent. In fact
; (bitmap) will contain the complete Structure of a BMP image And can be saved on disk And loaded
; into your favourite image viewer.
Declare GetImage(x1.i,y1.i,x2.i,y2.i,*bitmap.BGIimage)
; Places the image from (bitmap) on the screen at (x1,y1). Argument (bit) determines how the bitmap will be placed. Pre-defined
; values are:
; CopyPut - copies the bitmap directly To the screen
; XorPut - combines the colors of the bitmap And the screen by using the logical XOr operator
; OrPut - combines the colors of the bitmap And the screen by using the logical Or operator
; AndPut - combines the colors of the bitmap And the screen by using the logical And operator
; NotPut - copies the inverted bitmap To the screen
; NotOrPut - combines the colors of the bitmap And the screen by using the logical Or operator
; and then inverts the resultant color
; InvBitOrPut - combines the colors of the inverted bitmap With the colors of the screen by
; using the logical Or operator
; InvScrAndPut - combines the inverted colors of the screen With the colors of the bitmap by
; using the logical And operator
; NormalPut = CopyPut
; With PutImage you can put on screen any external BMP image having 32 bits format.
Declare PutImage(x1.i,y1.i, *bitmap.BGIimage,rop.i=#SRCAND)
;Sets the visual page To be displayed onto the graphics window. For more info see
;SetActivePage routine. UpdateGraph uses this routine To force screen refreshes.
;Declare SetVisualPage(page.i)
;Sets the active page where all drawings are performed. If different than visual page,
;these drawings do Not appear on screen.
;Declare SetActivePage(page.i)
EndDeclareModule