Als anfänger versuche ich ein bgi graph modul zu programmieren. Es scheint auch zu funktionieren bis auf die farben. Kann mir irgendjemand sagen warum ich falsche farben bekomme?.
Danke im voraus.
hier das modul part 1
Code: Alles auswählen
DeclareModule BGI
EnableExplicit
; error codes
#grOK = 0
#grNoInitGraph = - 1
#grInvalidDriver = - 2
#grInvalidMode = - 3
#grNotWindow = - 4
#grInvalidFont = - 5
#grInvalidFontNum = - 6
#grInvalidParam = - 7
#grNoPalette = - 8
#grError = -10
; update constants
#UpdateOff = 0
#UpdateOn = 1
#UpdateNow = 2
; clipping constants
#ClipOn = #True
#ClipOff = #False
; raster operation constants
#CopyPut = 0
#XorPut = 1
#OrPut = 2
#AndPut = 3
#NotPut = 4
#NotOrPut = 5
#InvBitOrPut = 6
#InvScrAndPut = 7
#TransPut = 8
#MaskPut = 9
#BkgPut = 10
#NormalPut = #CopyPut
; 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 = #True
#TopOff = #False
; 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
Structure ViewPortType
x1.w
y1.w
x2.w
y2.w
clip.i ; BOOLEAN
EndStructure
Structure IMAGE
bmiInfoHeader.BITMAPINFOHEADER
bmiFileHeader.BITMAPFILEHEADER
*bmiBits.RGBTRIPLE[0]
EndStructure
Structure PaletteType
size.i
colors.i[255]
EndStructure
Structure PointType
x.i
y.i
EndStructure
Structure ThreeDPointType
x.d
y.d
z.d
EndStructure
Structure LineSettingsType
linestyle.w
pattern.w
thickness.w
EndStructure
Structure ArcCoordsType
x.i
y.i
xstart.i
ystart.i
xend.i
yend.i
EndStructure
Structure FillSettingsType
pattern.w
color.w
EndStructure
;Global FillPatternType = Array [1..8] OF LOC
Structure TextSettingsType
font.w
direction.w
charsize.w
horiz.w
vert.w
EndStructure
Global grResult.i=-1
; 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()
; Resets graphics settings To their Default values For palette, line style, foreground And background colors, filling pattern
; And style, text style And placement, viewport, write mode And aspect ratio. This routine is first used by InitGraph.
Declare GraphDefaults()
; Tests If the graphics window is enabled. If so, you can perform graphics. Usually, after InitGraph, this routine returns
; true And, after CloseGraph, it returns false.
Declare.i GraphEnabled() ; BOOLEAN RETURN
; Returns a string describing the error (errorcode). This string can be used To let the user know what went wrong. We have the
; following types of error codes:
; grOk - no error
; grInvalidDriver - invalid graphics driver
; grInvalidMode - invalid graphics mode
; grNotWindow - creation of graphics window failed
; grNoInitGraph - graphics window Not initialized
; grInvalidFont - invalid font selection
; grInvalidFontNum - invalid font number
; grInvalidParam - invalid parameter value
; grNoPalette - no palette available
; grNoOpenGL - OpenGL driver Not initialized
; grError - general graphics error
; Use GraphResult To Return an error code.
Declare.s GraphErrorMsg(errorcode.i)
; Returns an error code For the last graphics operation. If the returned value is zero (grOK), all went well. A value different
; from zero means an error has occurred. Most of routines which draw something on screen, set Or query some drawing attributes can
; produce a GraphResult different from zero. Calling this routine once will reset the error code back To zero. GraphResult should
; be used after InitGraph To discover initialization problems, since that routine may fail on some situations: graphics driver And
; mode is Not supported, Or Default fonts cannot be installed, Or OpenGL driver cannot be initialized, etc.
; Each error code has an associated error message. Use GraphErrorMsg To get this message. See that routine For a List
; of error codes.
Declare.i GraphResult()
; Use CloseGraph To close the graphics window.
Declare.i InitGraph(windownumber.i, WinX.i, WinY.i, title.s)
; 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. See InitGraph For more details.
Declare SetWindowSize(width.i, height.i)
; This routine is used To manage all graphics operations. By Default, these operations are performed simultaneously onto the
; graphics window And in memory (the current active page). However, you can change this behaviour With UpdateGraph. The meaning
; of (bit) is the following:
; UpdateOff - graphics operations are Not performed directly on screen, only on memory (you can gain some speed here)
; UpdateOn - graphics operations are also performed directly on screen (this is the Default)
; UpdateNow - screen is updated With the content of the current active page right now used in conjunction with UpdateOff.
; This routine is useful To synchronize the output of several graphics operations, in order To reduce screen flickering. In
; addition, you must use UpdateGraph(UpdateNow) To force updating the screen after each OpenGL frame. See SetOpenGLMode For details.
; WinCrt routines
Declare UpdateGraph(bit.w)
; screen management exported routines
; 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)
; 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 complet
; Structure of a BMP image And can be saved on disk And loaded into your favourite image viewer.
; See PutImage For more details.
Declare GetImage(x1.i,y1.i,x2.i,y2.i, *bitmap.IMAGE)
; 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(*viewport.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()
; Returns the number of bytes needed To store the image from the rectangle defined by coordinates (x1,y1,x2,y2). It should be
; used before calling GetImage And PutImage. See those routines For details.
Declare.i ImageSize(x1.i,y1.i,x2.i,y2.i)
; 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
; In palette-based drivers the colors in the bitmap are mapped To the palette entries. Anyway, because the palette is just a
; logical one you should use UpdateGraph routine To assure that the bitmap on screen has the same color composition As appear in
; the active page. Due To same reason, raster operations do Not perform well on such drivers.
; With PutImage you can put on screen any external BMP image having 24 bits format. See GetImage For more details.
Declare PutImage(x1.i,y1.i, *bitmap.IMAGE, bit.w)
; Sets the active page where all drawings are performed. If different than visual page, these drawings do Not appear on screen.
; At least 4 active pages exist (starting With 0), but this number can be increased from the source code. This routine can be used
; To create multiple outputs. See also SetVisualPage.
; Programmatically, an active page is a memory copy of the graphics window. This copy is also used by the messaging thread To
; refresh the graphics window As necessary.
; You can use UpdateGraph routine To refresh the graphics window With the content of the current active page. This is useful If
; drawings are Not performed directly on the graphics window.
Declare SetActivePage(page.i)
; 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
; OpenGL drawings are Not bounded To the viewport.
Declare SetViewPort(x1.i,y1.i,x2.i,y2.i, clip.i) ; BOOLEAN
; 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)
; 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.i)
Declare.i GetDC()
; 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.i 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.i 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.i 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.i GetPixel(x.i,y.i)
; 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.i, *r.integer,*g.integer,*b.integer)
; 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.i)
; 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.i)
; 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.i,y.i, start.i,stop.i,radius.i)
; 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.i,y.i, radius.i)
; 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.i,y.i, start.i,stop.i,xradius.i,yradius.i)
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.i,y1.i,x2.i,y2.i)
; 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.i,dy.i)
; 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.i,y.i)
; Moves the pointer To coordinates (dx,dy), relative To the current pointer position. See MoveTo For more details.
Declare MoveRel(dx.i,dy.i)
; 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.i,y.i)
; 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.i,y.i, color.i)
; 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.i,y1.i,x2.i,y2.i)
; 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.i,y.i,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.i,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.i,y1.i,x2.i,y2.i)
; 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.i,y1.i,x2.i,y2.i, depth.i, top.i) ; 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.i,y.i, 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.i,y.i,xradius.i,yradius.i)
; 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.i,y1.i,x2.i,y2.i)
; 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.i,y.i, color.i)
; 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.i,y1.i,x2.i,y2.i)
; 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.i,y.i, start.i,stop.i,radius.i)
; 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.i,y1.i,x2.i,y2.i,r.i)
; 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.i,y.i, 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.i) ; 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.i, color.i)
; 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.i)
; 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)
; 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.i,y.i, textstring.s)
; 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.i,charsize.i)
; 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.i, y.i, color.i, symbol.i, width.i, height.i)
; caret format: block Or underline
Global CaretBlock.i = #True
; caret blink rate in tenths OF a second
Global BlinkRate.i = 2
; Generates simple tones on the speaker. Parameter (hz) is the frequency of the sound in hertz. Its valid range is between 37
; through 32767. (dur) is the duration of the sound in milliseconds.
Declare Sound(hz.i,dur.i)
Declare DrawCaret(nr.i)
Declare TextSettings()
EndDeclareModule