bgi modul - farbfehler

Anfängerfragen zum Programmieren mit PureBasic.
123
Beiträge: 9
Registriert: 21.07.2015 20:20

bgi modul - farbfehler

Beitrag von 123 »

Hi,
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

123
Beiträge: 9
Registriert: 21.07.2015 20:20

Re: bgi modul - farbfehler

Beitrag von 123 »

part 2

Code: Alles auswählen

Module BGI
EnableExplicit


Structure COLORTABLE
  *colTable.RGBQUAD[0]
EndStructure

Structure Ltype1
    StructureUnion
        L.l
        W1.w
        W2.w
        B1.b
        B2.b
        B3.b
        B4.b
  EndStructureUnion
EndStructure

#NrVideoPages = 4; ;number OF available video pages
#Rad = #PI/180.0
#NrMaxFonts = 15
#MinCharSize = 8
#NrColorNames = 256

Global grEnabled.i          ; ,palExist.i BOOLEAN
Global screenWidth.i,screenHeight.i, image.i
Global Dim internColor.i(#NrColorNames-1)   ; POINTER To CARDINAL
Global customWidth.i,customHeight.i    ; INTEGER
Global windowWidth.i,windowHeight.i    ; INTEGER
Global windowStyle.i                   ; DWORD
Global bitPixel.i                      ; WORD
Global maxColors.i,palSize.i           ; CARDINAL
Global grHandle.i,consHandle.i         ; HWND
Global grTitle.s                       ; Array[0..31] OF CHAR
Global grThread.i                      ; HANDLE
Global.i maxX.i,maxY.i,origX.i,origY.i, actX.i,actY.i,aspX.i,aspY.i     ; INTEGER
Global defAspectRatio.i                ; BOOLEAN
Global grWindow.i,grMemory.i,grTemp.i  ; HDC
Global grPalette.i,old_Palette.i       ; HPALETTE
Global grPen.i,old_Pen.i               ; HPEN
Global grBrush.i,old_Brush.i           ; HBRUSH
Global grFont.i,old_Font.i             ; HFONT
Global grPattern.i,old_Bitmap.i        ; HBITMAP
Global Dim grBitmap.i(#NrVideoPages-1) ; Array[0..NrVideoPages-1] OF HBITMAP
Global *colTable.COLORTABLE
Global protect_devices.CRITICAL_SECTION     ; CRITICAL_SECTION
Global grDirect,grUpdate = #True            ; BOOLEAN
Global visualPage.i,activePage.i     ; CARDINAL
Global Dim instFont.s(#NrMaxFonts-1)        ; Array[0..NrMaxFonts-1] OF TFontString
Global grClip.i                      ; HRGN
Global frColor.i,bkColor.i             ; CARDINAL
Global lineSettings.LineSettingsType   ; LineSettingsType
Global fillSettings.FillSettingsType   ; FillSettingsType
Global textSettings.TextSettingsType   ; TextSettingsType
Global Dim fillPattern.b(8)            ; FillPatternType
Global viewPort.ViewPortType           ; ViewPortType
Global lastArcCoords.ArcCoordsType     ; ArcCoordsType
Global viewPortWidth.i,viewPortHeight.i; INTEGER
Global floodMode.i                   ; UINT
Global oglEnabled.i,oglDirect.i      ; BOOLEAN
Global grCloseRequest.i              ; BOOLEAN
Global globalTemp.i                  ; INTEGER
Global Dim NamesPalette.i(256)
Global Dim DefaultVGAPalette.i(256) 
Global Dim NamesPalette.i(256)


Procedure ShiftTable (Array Table.c(1), Shift.l)
   Protected i.l
   Protected Dim tempTable.c (#NrColorNames)
   Define.l NewPosition
   CopyMemory (@Table(), @tempTable(), #NrColorNames)
   For i = 0 To 255
     NewPosition = Int(Abs(i + Shift)) & $000000FF
      Table(NewPosition) = tempTable(i)
   Next   
EndProcedure

Procedure.l AssignTables (Array RedTable.c(1), Array GreenTable.c(1), Array  BlueTable.c(1), Array Bits.c(1),  Width, Height)
   Protected.l  LineWidth = Width * 3
   Protected.l h, w, i   
   For h = 0 To Height-1
      For w = 0 To Width-1
         i = h * LineWidth + 3 * w
         Bits(i+2) =   RedTable(Bits(i+2))
         Bits(i+1) = GreenTable(Bits(i+1))
         Bits( i ) =  BlueTable(Bits( i ))
      Next
   Next  
EndProcedure

Macro FastRed(color)
  color & 255
EndMacro

Macro FastGreen(color)
  (color & 65535) >> 8
EndMacro

Macro FastBlue(color)
  (color & 16777215) >> 16
EndMacro

Procedure.c GetIntensity(r.c,g.c,b.c)
   ProcedureReturn  Int(R * 0.3 + G * 0.59 + B * 0.11)
EndProcedure

Procedure.i PALETTEINDEX(n.i)
Protected l.Ltype1
    l\W1 = n
    l\B3 = 0
    l\B4 = 1
    ProcedureReturn l\L
EndProcedure

Procedure.b LOBYTE(w.w)
    ProcedureReturn w & $0FF
EndProcedure

Procedure.b HIBYTE(w.w)
    ProcedureReturn (w >> 8) & $0FF
EndProcedure

Procedure.w LOWORD(l.l)
    ProcedureReturn l & $0FFFF
EndProcedure

Procedure.w HIWORD(l.l)
    ProcedureReturn (l >> 16) & $0FFFF
EndProcedure

; internal routines

Procedure UpdatesGraph()
  Protected strPaint.PAINTSTRUCT
  Protected grRect.RECT, old_hbmp.i
  If GetUpdateRect_(grHandle,grRect,#False)
    With grRect
      EnterCriticalSection_(protect_devices)
      If (grClip <> #Null)  
        SelectClipRgn_(grWindow,#Null)
      EndIf
      BeginPaint_(grHandle,strPaint)
      If activePage = visualPage
        BitBlt_(grWindow,\left,\top,\right-\left+1,\bottom-\top+1,grMemory,\left,\top,#SRCCOPY)
      Else
        old_hbmp  = SelectObject_(grMemory,grBitmap(visualPage))
        BitBlt_(grWindow,\left,\top,\right-\left+1,\bottom-\top+1,grMemory,\left,\top,#SRCCOPY)
        SelectObject_(grMemory,old_hbmp)
      EndIf
      EndPaint_(grHandle,strPaint)
      If grClip <> #Null
        SelectClipRgn_(grWindow,grClip)
      EndIf
      LeaveCriticalSection_(protect_devices)
    EndWith
  EndIf
EndProcedure

Procedure.i EnumFontFamProc(*lpelf.LOGFONT, *lpntm.NEWTEXTMETRIC, FontType.l, param.i) ;:LPARAM
  globalTemp = 1   ; we got here IF at least one font from the family font exists
  ProcedureReturn 0
EndProcedure

#NrDefFonts = 4
Procedure InstallDefaultFonts()
  Protected Dim DefaultFont.s(#NrDefFonts-1)
  Protected i.i
  DefaultFont.s(0) = "Courier New"
  DefaultFont.s(1) = "MS Sans Serif"
  DefaultFont.s(2) = "Times New Roman"
  DefaultFont.s(3) = "Arial"

  For i = 0 To #NrMaxFonts-1
    instFont(i) = ""
  Next
  For i=0 To #NrDefFonts-1
    InstallUserFont(DefaultFont(i))
    If grResult <> #grOK
      Break
    EndIf
  Next
EndProcedure

Procedure LineProc(x.i,y.i, param.i) ;:LPARAM)
  param = param >> globalTemp
  If (param & $0001 <> 0)
    PutPixel(x,y,frColor)
  EndIf
  globalTemp = (globalTemp+1) % 16
  If grUpdate : UpdatesGraph(): EndIf
EndProcedure

Procedure SetBitmaps_BGI()
  Protected *pbmi.BITMAPINFO
  Protected pbits.i = #Null ;LPVOID
  Protected i.i,nr.i = 0
  *pbmi = AllocateMemory(SizeOf(BITMAPINFOHEADER) + nr * SizeOf(RGBQUAD))
  *pbmi\bmiHeader\biSize = SizeOf(BITMAPINFOHEADER)
  *pbmi\bmiHeader\biWidth = maxX+1
  *pbmi\bmiHeader\biHeight = maxY+1
  *pbmi\bmiHeader\biPlanes = 1
  *pbmi\bmiHeader\biBitCount = bitPixel
  *pbmi\bmiHeader\biClrUsed = 0
  *pbmi\bmiHeader\biCompression = #BI_RGB
  *pbmi\bmiHeader\biSizeImage = 0
  *pbmi\bmiHeader\biClrImportant = 0
   
  For i = 0 To #NrVideoPages-1
    grBitmap(i) = CreateDIBSection_(grWindow, *pbmi, #DIB_RGB_COLORS, pbits, #Null, 0)
  Next
  FreeMemory(*pbmi)  
  If *colTable <> #Null   ;*colTable.RGBQUAD(0)
    FreeMemory(*colTable)
  EndIf
  If nr > 0
  *colTable = AllocateMemory(nr * SizeOf(RGBQUAD))
    FillMemory(*colTable, nr * SizeOf(RGBQUAD), 0)
  EndIf
EndProcedure

Procedure SetAttrib_BGI()
  Protected.i dx_bor,dy_bor,dx,dy,tmp
  dx_bor = 2*GetSystemMetrics_(#SM_CXFIXEDFRAME)
  dy_bor = 2*GetSystemMetrics_(#SM_CYFIXEDFRAME)+GetSystemMetrics_(#SM_CYCAPTION)
  dx = customWidth
  dy = customHeight
  windowWidth  = dx + dx_bor
  windowHeight = dy + dy_bor
  If (windowWidth <= screenWidth) And (windowHeight <= screenHeight)
    windowStyle = #WS_OVERLAPPED | #WS_SYSMENU | #WS_CAPTION | #WS_MINIMIZEBOX
  Else
    If (dx <= screenWidth) And (dy <= screenHeight)
      windowWidth = dx
      windowHeight = dy
      windowStyle = #WS_POPUP
    Else
      grResult = #grInvalidMode
      ProcedureReturn
    EndIf
  EndIf  
  bitPixel = GetDeviceCaps_(GetDC_(GetDesktopWindow_()), #BITSPIXEL)
EndProcedure

;initialization routines

Procedure ClearDevice()
  Protected old_ViewPort.ViewPortType
  old_ViewPort = viewPort
  SetViewPort(0,0,maxX,maxY,#ClipOff)
  ClearViewPort()
  With old_ViewPort
    SetViewPort(\x1,\y1,\x2,\y2, \clip)
  EndWith
  If grUpdate : UpdatesGraph(): EndIf
EndProcedure

Procedure CloseGraph()
  Protected exitcode.i
  grResult = #grOK
  If Not(grEnabled)
    grResult = #grNoInitGraph
    ProcedureReturn
  EndIf
  grEnabled = #False
  If consHandle <> #Null
    ShowWindow_(consHandle,#SW_SHOW)
    SetForegroundWindow_(consHandle)
  EndIf
  If *colTable <> #Null
    FreeMemory(*colTable)
  EndIf
  DeleteCriticalSection_(protect_devices);  
EndProcedure

Procedure GraphDefaults()
  Protected palette.PaletteType
  Protected Dim pattern.b(8) ; FillPatternType
  With lineSettings
    \linestyle = #SolidLn
    \pattern = 0
    \thickness = #NormWidth
  EndWith
  SetColor(#White)
  SetBkColor(#Black)
  FillMemory(@pattern(0), 8, $0FF)
  SetFillPattern(pattern(),#White)
  SetFillStyle(#SolidFill,#White)
  SetTextStyle(#DefaultFont,#HorizDir,16)
  SetTextJustify(#LeftText,#TopText)
  SetUserCharSize(0,0,0,0)
  SetViewPort(0,0,maxX,maxY,#ClipOff)
  SetWriteMode(#CopyMode | #TRANSPARENT)
  SetAspectRatio(10000,10000)
  floodMode = #BorderFlood
EndProcedure

Procedure.i GraphEnabled()    ; BOOLEAN
  ProcedureReturn grEnabled
EndProcedure

Procedure.s GraphErrorMsg(errorcode.i)
  Select errorcode
    Case #grOK
      ProcedureReturn ""
    Case #grInvalidDriver
      ProcedureReturn "Invalid graphics driver"
    Case #grInvalidMode
      ProcedureReturn "Invalid graphics mode"
    Case #grNotWindow
      ProcedureReturn "Creation OF graphics window failed"
    Case #grNoInitGraph
      ProcedureReturn "Graphics window NOT initialized. Use InitGraph"
    Case #grInvalidFont
      ProcedureReturn "Invalid font selection"
    Case #grInvalidFontNum
      ProcedureReturn "Invalid font number"
    Case #grInvalidParam
      ProcedureReturn "Invalid parameter value"
    Case #grNoPalette
      ProcedureReturn "No palette available. Change graphics driver"
    Case #grError
      ProcedureReturn "General graphics error"
  Default
    ProcedureReturn "Unrecognized error code"
  EndSelect
EndProcedure

Procedure.i GraphResult()
  Protected Result.i
  Result = grResult
  grResult = #grOK
  ProcedureReturn Result
EndProcedure

Procedure.i GetDC()
  ProcedureReturn grWindow
EndProcedure

Procedure.i InitGraph(windownumber.i, WinX.i, WinY.i, title.s) ;<- main entry point*)
  Protected i.i
  Protected grRect.RECT
  
  grHandle = WindowID(windownumber)
  GetClientRect_(grHandle, grRect)
  maxX       = grRect\right-1 
  maxY       = grRect\bottom-1
  grWindow   = GetDC_(grHandle)
  grMemory   = CreateCompatibleDC_(#Null)
  grTemp     = CreateCompatibleDC_(#Null)
  old_Palette= GetCurrentObject_(grWindow,#OBJ_PAL)
  old_Pen    = GetCurrentObject_(grWindow,#OBJ_PEN)
  old_Brush  = GetCurrentObject_(grWindow,#OBJ_BRUSH)
  old_Font   = GetCurrentObject_(grWindow,#OBJ_FONT)
  old_Bitmap = GetCurrentObject_(grMemory,#OBJ_BITMAP)
  *colTable  = #Null
  InitializeCriticalSection_(protect_devices)
  
  SetAttrib_BGI()
  SetBitmaps_BGI()
  
  screenWidth = GetSystemMetrics_(#SM_CXSCREEN)
  screenHeight= GetSystemMetrics_(#SM_CYSCREEN)
  
  grEnabled = #True
  SetWindowSize(WinX,WinY)
  grResult = #grOK
  
  If grResult <> #grOK
    ProcedureReturn -1
  EndIf
  consHandle = #Null
  If title <> ""
    grTitle = title
  Else
    grTitle = "NONAME"
  EndIf
  SetWindowTitle(windownumber, grTitle) 
  If grResult = #grOK
    visualPage = 0
    grUpdate = #True
    SetActivePage(0)
    InstallDefaultFonts()
    If (grResult <> #grOK)
      ProcedureReturn -1
    EndIf
    grClip = #Null
    grPattern = #Null
    GraphDefaults()
;     oglEnabled = #False
;     oglDirect = #DirectOff
    If consHandle <> #Null
      ShowWindow_(consHandle, #SW_HIDE)
    EndIf
    ShowWindow_(grHandle, #SW_HIDE)
    ShowWindow_(grHandle,#SW_SHOWNORMAL)
    SetForegroundWindow_(grHandle)
    grCloseRequest = #False;        
  EndIf
  If grUpdate : UpdatesGraph(): EndIf
  ProcedureReturn windownumber
EndProcedure

Procedure SetWindowSize(width.i,height.i)
  customWidth = width
  customHeight = height
  If grUpdate : UpdatesGraph(): EndIf
EndProcedure

Procedure UpdateGraph(bit.w)
  Select bit
    Case #UpdateOff
      If grUpdate
        grUpdate = #False
        grDirect = #False
      EndIf
    Case #UpdateOn
      If Not(grUpdate)
        grUpdate = #True
        SetVisualPage(visualPage)
      EndIf
    Case #UpdateNow
      SetVisualPage(visualPage)
      UpdatesGraph()
  EndSelect
EndProcedure

; screen management routines

Procedure ClearViewPort()
  Protected old_FillSettings.FillSettingsType
  MoveTo(0,0)
  If grResult <> #grOK
    ProcedureReturn 
  EndIf
  old_FillSettings = fillSettings
  SetFillStyle(#SolidFill,bkColor)
  Bar(0,0,viewPortWidth,viewPortHeight)
  With old_FillSettings 
    SetFillStyle(\pattern, \color)
  EndWith
  ;If grUpdate : UpdatesGraph(): EndIf
EndProcedure

Procedure GetAspectRatio(*xasp.integer,*yasp.integer)
  *xasp = aspX
  *yasp = aspY
EndProcedure

Procedure GetImage(x1.i,y1.i,x2.i,y2.i, *bitmap.IMAGE)
  Protected *hbmp.BITMAP
  Protected img.IMAGE
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn
  EndIf
  If (x1 > x2) Or (y1 > y2)
    grResult = #grInvalidParam
    ProcedureReturn
  EndIf
  With img\bmiFileHeader
    \bfType =  $4D42
    \bfOffBits = SizeOf(BITMAPFILEHEADER)+SizeOf(BITMAPINFOHEADER)
    \bfSize = ImageSize(x1,y1,x2,y2)
    \bfReserved1 = 0
    \bfReserved2 = 0
  EndWith
  With img\bmiInfoHeader
    x2+1
    y2+1
    \biSize = SizeOf(BITMAPINFOHEADER)
    \biWidth = x2-x1
    \biHeight = y2-y1
    \biPlanes = 1
    \biBitCount = 24; hardcoded 24-bit bitmap format
    \biClrUsed = 0
    \biCompression = #BI_RGB
    \biSizeImage = 0
    \biClrImportant = 0
    *hbmp = CreateCompatibleBitmap_(grMemory,x2-x1,y2-y1)
    EnterCriticalSection_(protect_devices)
    SelectObject_(grTemp, *hbmp)
    BitBlt_(grTemp,0,0,x2-x1,y2-y1,grMemory,x1+origX,y1+origY,#SRCCOPY)
    SelectObject_(grTemp,old_Bitmap)
    GetDIBits_(grWindow, *hbmp,0,\biHeight, img\bmiBits, img\bmiInfoHeader, #DIB_RGB_COLORS)
    LeaveCriticalSection_(protect_devices)
  EndWith
  DeleteObject_(*hbmp)
EndProcedure

Procedure.i GetMaxX()
  ProcedureReturn maxX
EndProcedure

Procedure.i GetMaxY()
  ProcedureReturn maxY
EndProcedure

Procedure GetViewSettings(*viewport.ViewPortType)
  viewport  =  viewPort
EndProcedure

Procedure.i GetXX()
  ProcedureReturn actX
EndProcedure

Procedure.i GetYY()
  ProcedureReturn actY
EndProcedure

Procedure.i ImageSize(x1.i,y1.i,x2.i,y2.i)
  Protected aux.d
  Protected rowsize.i
  grResult = #grOK
  If (x1 > x2) Or (y1 > y2)
    grResult = #grInvalidParam
    ProcedureReturn 0
  EndIf
  x2+1
  y2+1
  aux = 0.75 * (x2-x1)
  rowsize = Int(aux)
  If rowsize <> aux
    rowsize+1
  EndIf
  ProcedureReturn SizeOf(BITMAPFILEHEADER)+SizeOf(BITMAPINFOHEADER)+ rowsize*(y2-y1)*4 ; hardcoded 24-bit bitmap format
EndProcedure

Procedure GetBkg(*bm.BITMAP,x1.i,y1.i)
  With *bm 
    BitBlt_(grTemp,0,0,\bmWidth,\bmHeight,grMemory,x1,y1,#SRCCOPY) 
  EndWith
  If grUpdate : UpdatesGraph(): EndIf
EndProcedure
    
Procedure PutImage(x1.i,y1.i, *bitmap.IMAGE, bit.w)
  Protected *hbmp.BITMAP
  Protected img.IMAGE
  Protected rop.i
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn
  EndIf
  x1 + origX
  y1 + origY
  Select bit
    Case #CopyPut      
      rop = #SRCCOPY
    Case #XorPut       
      rop = #SRCINVERT
    Case #OrPut        
      rop = #SRCPAINT
    Case #AndPut       
      rop = #SRCAND
    Case #NotPut       
      rop = #NOTSRCCOPY
    Case #NotOrPut     
      rop = #NOTSRCERASE
    Case #InvBitOrPut  
      rop = #MERGEPAINT
    Case #InvScrAndPut 
      rop = #SRCERASE
  Default
    grResult = #grInvalidParam
    ProcedureReturn
  EndSelect
  With img\bmiInfoHeader
    *hbmp = CreateCompatibleBitmap_(grMemory,\biWidth,\biHeight)
    EnterCriticalSection_(protect_devices)
    SetDIBits_(grWindow,*hbmp,0,\biHeight,img\bmiBits,img\bmiInfoHeader,#DIB_RGB_COLORS)
    SelectObject_(grTemp, *hbmp)
    If grDirect  
      BitBlt_(grWindow,x1,y1,\biWidth,\biHeight,grTemp,0,0,rop) 
    EndIf
    BitBlt_(grMemory,x1,y1,\biWidth,\biHeight,grTemp,0,0,rop)
    SelectObject_(grTemp,old_Bitmap)
    LeaveCriticalSection_(protect_devices)
  EndWith
  DeleteObject_(*hbmp)
  If grUpdate : UpdatesGraph(): EndIf
EndProcedure

Procedure SetActivePage(page.i)
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn
  EndIf
  If page >= #NrVideoPages
    page = 0 
  EndIf
  activePage = page
  EnterCriticalSection_(protect_devices)
  SelectObject_(grMemory,grBitmap(activePage))
  LeaveCriticalSection_(protect_devices)
  grDirect =  Bool(Bool(activePage = visualPage) And grUpdate)
EndProcedure

Procedure SetAspectRatio(xasp.i,yasp.i)
  aspX = xasp
  aspY = yasp
  defAspectRatio = Bool(Bool(xasp = 10000) And Bool(yasp = 10000))
EndProcedure

Procedure SetViewPort(x1.i,y1.i,x2.i,y2.i, clip.i)  ;BOOLEAN
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn
  EndIf
  If (x1 > x2) Or (y1 > y2)
     grResult = #grInvalidParam
     ProcedureReturn
  EndIf
  viewPort\x1 = x1
  viewPort\y1 = y1
  viewPort\x2 = x2
  viewPort\y2 = y2
  viewPort\clip = clip
  viewPortWidth = x2-x1; 
  viewPortHeight = y2-y1
  origX = x1            ; 
  origY = y1            ; 
  MoveTo(0,0)           
  EnterCriticalSection_(protect_devices)
  If grClip <> #Null
    SelectClipRgn_(grWindow,#Null)
    SelectClipRgn_(grMemory,#Null)
    DeleteObject_(grClip)
    grClip = #Null
  EndIf
  If clip
     grClip = CreateRectRgn_(x1,y1,x2+1,y2+1)
     SelectClipRgn_(grWindow,grClip)
     SelectClipRgn_(grMemory,grClip)
  EndIf
  LeaveCriticalSection_(protect_devices)
  If grUpdate : UpdatesGraph(): EndIf
EndProcedure

Procedure SetVisualPage(page.i)
  Protected *lpRect.RECT = #Null
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn
  EndIf
  If page >= #NrVideoPages  
    page = 0 
  EndIf
  visualPage = page
  grDirect = Bool(Bool(activePage = visualPage) And grUpdate)
  InvalidateRect_(grHandle, *lpRect, #False)
  If grUpdate : UpdatesGraph(): EndIf
EndProcedure

Procedure SetWriteMode(writemode.i)
  Protected.i fnDrawMode,iBkMode
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn
  EndIf
  fnDrawMode = writemode % $10
  iBkMode = (writemode / $10) << 4
  Select fnDrawMode
    Case #CopyMode     : fnDrawMode = #R2_COPYPEN
    Case #XorMode      : fnDrawMode = #R2_XORPEN
    Case #OrMode       : fnDrawMode = #R2_MERGEPEN
    Case #AndMode      : fnDrawMode = #R2_MASKPEN
    Case #NotMode      : fnDrawMode = #R2_NOTCOPYPEN
    Case #NotScrMode   : fnDrawMode = #R2_NOT
    Case #NotXorMode   : fnDrawMode = #R2_NOTXORPEN
    Case #NotOrMode    : fnDrawMode = #R2_NOTMERGEPEN
    Case #NotAndMode   : fnDrawMode = #R2_NOTMASKPEN
    Case #InvColAndMode: fnDrawMode = #R2_MASKNOTPEN
    Case #InvColOrMode : fnDrawMode = #R2_MERGENOTPEN
    Case #InvScrAndMode: fnDrawMode = #R2_MASKPENNOT
    Case #InvScrOrMode : fnDrawMode = #R2_MERGEPENNOT
    Case #BlackMode    : fnDrawMode = #R2_BLACK
    Case #WhiteMode    : fnDrawMode = #R2_WHITE
    Case #EmptyMode    : fnDrawMode = #R2_NOP
  Default
    grResult = #grInvalidParam
    ProcedureReturn
  EndSelect
  Select iBkMode
    Case #TRANSPARENT_: iBkMode = #TRANSPARENT
    Case #OPAQUE_     : iBkMode = #OPAQUE
  Default
    grResult = #grInvalidParam
    ProcedureReturn
  EndSelect
  SetROP2_(grWindow,fnDrawMode)
  SetBkMode_(grWindow,iBkMode)
  SetROP2_(grMemory,fnDrawMode)
  SetBkMode_(grMemory,iBkMode)
  If grUpdate : UpdatesGraph(): EndIf
EndProcedure

; color management routines

Procedure.i GetBkColor()
  ProcedureReturn bkColor
EndProcedure

Procedure.i GetColor()
  ProcedureReturn frColor
EndProcedure


Procedure.i GetMaxColor()
  ProcedureReturn $0FFFFFF
EndProcedure

Procedure.i GetPixel(x.i,y.i)
  Protected Result.i
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn 0
  EndIf
  EnterCriticalSection_(protect_devices)
  Result = GetPixel_(grMemory,x+origX,y+origY)
  LeaveCriticalSection_(protect_devices)
  ProcedureReturn Result
EndProcedure

Procedure GetRGBComponents(color.i, *r.integer,*g.integer,*b.integer)
  Protected pe.PALETTEENTRY
  *r = FastRed(color)
  *g = FastGreen(color)
  *b = FastBlue(color)
EndProcedure

Procedure GetSystemPalette(*palette.PaletteType)
  Protected Dim pe.PALETTEENTRY(0)
  Protected i.i
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn
  EndIf
  With *palette
      \size = 256 
    ReDim pe(\size)
    GetSystemPaletteEntries_(grWindow,0,\size,@pe(0))
    For i = 0 To \size-1
      \colors[i] = RGB(pe(i)\peRed,pe(i)\peGreen,pe(i)\peBlue)
    Next
    FreeArray(pe())
  EndWith
  If grUpdate : UpdatesGraph(): EndIf
EndProcedure

Procedure SetBkColor(color.i)
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn
  EndIf
  bkColor = color
  SetBkColor_(grWindow,color)
  SetBkColor_(grMemory,color)
EndProcedure

Procedure SetColor(color.i)
  frColor = color
  SetLineStyle(lineSettings\linestyle, lineSettings\pattern, lineSettings\thickness)
  If grResult <> #grOK
    ProcedureReturn 
  EndIf
  SetTextColor_(grWindow,color)
  SetTextColor_(grMemory,color)
  SetDCBrushColor_(grWindow, color)
  SetDCPenColor_(grWindow, color)
  SetDCBrushColor_(grMemory, color)
  SetDCPenColor_(grMemory, color)
  If grUpdate : UpdatesGraph(): EndIf
EndProcedure

; drawing primitives routines

Procedure Arc(x.i,y.i, start.i,stop.i,radius.i)
  Ellipse_(x,y,start,stop,radius)
  If grUpdate : UpdatesGraph(): EndIf
EndProcedure

Procedure Circles(x.i,y.i, radius.i)
  Ellipse_(x,y,0,360,radius)
  If grUpdate : UpdatesGraph(): EndIf
EndProcedure

Procedure DrawBezier(nrpoints.i, Array *polypoints.PointType(1))
  Protected.i size,i
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn
  EndIf
  If nrpoints >= 4
    EnterCriticalSection_(protect_devices)
    If grDirect  
      PolyBezier_(grWindow, *polypoints(0),nrpoints) 
    EndIf
    PolyBezier_(grMemory,*polypoints(0),nrpoints) 
    LeaveCriticalSection_(protect_devices)
  Else
    grResult = #grInvalidParam
  EndIf
  If grUpdate : UpdatesGraph(): EndIf
EndProcedure

Procedure DrawPoly(nrpoints.i, Array *polypoints.PointType(1))
  Protected.i size,i
  grResult = #grOK
  If Not(grEnabled)
    grResult = #grNoInitGraph
    ProcedureReturn
  EndIf
  If nrpoints < 2
    grResult = #grInvalidParam
    ProcedureReturn
  EndIf
  EnterCriticalSection_(protect_devices)
  If grDirect  
    Polyline_(grWindow,*polypoints(0),nrpoints) 
  EndIf
  Polyline_(grMemory,*polypoints(0),nrpoints)
  LeaveCriticalSection_(protect_devices)
  If grUpdate : UpdatesGraph(): EndIf
EndProcedure

Procedure Ellipses(x.i,y.i, start.i,stop.i,xradius.i,yradius.i)
  Protected.i nXStartArc,nYStartArc,nXEndArc,nYEndArc
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn
  EndIf
  lastArcCoords\x = x; 
  lastArcCoords\y = y
  x + origX
  y + origY
  nXStartArc = Round(xradius * Cos(start*#Rad), #PB_Round_Nearest) 
  nXEndArc = Round(xradius * Cos(stop*#Rad), #PB_Round_Nearest)
  nYStartArc = Round(yradius * Sin(start*#Rad), #PB_Round_Nearest)
  nYEndArc = Round(yradius * Sin(stop*#Rad), #PB_Round_Nearest)
  If Not(defAspectRatio)
    xradius = Int(10000*xradius) / aspX; 
    yradius = Int(10000*yradius) / aspY
  EndIf
  EnterCriticalSection_(protect_devices)
  If grDirect
    Arc_(grWindow,x-Int(xradius),y-Int(yradius),x+Int(xradius)+1,y+Int(yradius)+1,x+nXStartArc,y-nYStartArc,x+nXEndArc,y-nYEndArc)
  EndIf
  Arc_(grMemory,x-Int(xradius),y-Int(yradius),x+Int(xradius)+1,y+Int(yradius)+1,x+nXStartArc,y-nYStartArc,x+nXEndArc,y-nYEndArc)
  LeaveCriticalSection_(protect_devices)
  With lastArcCoords
    \xstart = \x+nXStartArc; 
    \ystart = \y-nYStartArc 
    \xend = \x+nXEndArc    ; 
    \yend = \y-nYEndArc     
  EndWith
  If grUpdate : UpdatesGraph(): EndIf
EndProcedure

Procedure GetArcCoords(*arccoords.ArcCoordsType)
  *arccoords = lastArcCoords
EndProcedure

Procedure GetLineSettings(*lineinfo.LineSettingsType)
  *lineinfo = lineSettings
EndProcedure

Procedure Lines(x1.i,y1.i,x2.i,y2.i)
  MoveTo(x1,y1)
  LineTo(x2,y2)
  ;If grUpdate : UpdatesGraph(): EndIf
EndProcedure

Procedure LineRel(dx.i,dy.i)
  LineTo(actX+dx,actY+dy)
  ;If grUpdate : UpdatesGraph(): EndIf
EndProcedure

Procedure LineTo(x.i,y.i)
  Protected.i x0,y0
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn
  EndIf
  x0 = x; 
  y0 = y
  x + origX
  y + origY
  With lineSettings
    If \linestyle <> #UserBitLn
      EnterCriticalSection_(protect_devices)
      If grDirect  
        LineTo_(grWindow,x,y) 
      EndIf
      LineTo_(grMemory,x,y)
      LeaveCriticalSection_(protect_devices)
      If \thickness = #NormWidth 
        PutPixel(x0,y0,frColor) 
      EndIf
    EndIf
    MoveTo(x0,y0)
  EndWith
EndProcedure

Procedure MoveRel(dx.i,dy.i)
  actX + dx
  actY + dy
  MoveTo(actX,actY)
EndProcedure

Procedure MoveTo(x.i,y.i)
  Protected d.POINT
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn
  EndIf
  actX = x; 
  actY = y
  x + origX 
  y + origY
  MoveToEx_(grWindow,x,y,d)
  MoveToEx_(grMemory,x,y,d)
  If grUpdate : UpdatesGraph(): EndIf
EndProcedure

Procedure PutPixel(x.i,y.i, color.i)
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn
  EndIf
  x + origX 
  y + origY
  EnterCriticalSection_(protect_devices)
  If grDirect  
    SetPixelV_(grWindow,x,y,color) 
  EndIf
  SetPixelV_(grMemory,x,y,color)
  LeaveCriticalSection_(protect_devices)
  If grUpdate : UpdatesGraph(): EndIf
EndProcedure

Procedure Rectangle(x1.i,y1.i,x2.i,y2.i)
  Protected Dim pt.POINT(5)
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn
  EndIf
  If (x1 > x2) Or (y1 > y2)
     grResult = #grInvalidParam
     ProcedureReturn
  EndIf
  x1 + origX 
  y1 + origY 
  x2 + origX 
  y2 + origY
  If (x1 <> x2) Or (y1 <> y2)
    pt(1)\x = x1: pt(1)\y = y1
    pt(2)\x = x2: pt(2)\y = y1
    pt(3)\x = x2: pt(3)\y = y2
    pt(4)\x = x1: pt(4)\y = y2
    pt(5)\x = x1: pt(5)\y = y1
    EnterCriticalSection_(protect_devices)
    If grDirect  
      Polyline_(grWindow,@pt(0),5) 
    EndIf
    Polyline_(grMemory,@pt(0),5)
    LeaveCriticalSection_(protect_devices)
    If grUpdate : UpdatesGraph(): EndIf
  Else
    PutPixel(x1,y1,frColor)
  EndIf
EndProcedure

Procedure RotEllipse(x.i,y.i,rot.i, xradius.i,yradius.i)
  Protected Dim pt.PointType(7)
  Protected.d cosrot,sinrot
  Protected.i x1,y1,i
  xradius = Round(1.3333*xradius, #PB_Round_Nearest)
  cosrot = Cos(rot*#Rad): sinrot = Sin(rot*#Rad)
  pt(1)\x = 0:        pt(1)\y = -Int(yradius)
  pt(2)\x =  xradius: pt(2)\y = -Int(yradius)
  pt(3)\x =  xradius: pt(3)\y =  (yradius)
  pt(4)\x = 0:        pt(4)\y =  (yradius)
  pt(5)\x = -Int(xradius): pt(5)\y =  (yradius)
  pt(6)\x = -Int(xradius): pt(6)\y = -Int(yradius)
  pt(7)\x = 0:        pt(7)\y = -Int(yradius)
  For i = 1 To 7
     x1 = pt(i)\x: y1 = pt(i)\y ; perform rotation
     pt(i)\x = x+Round( x1*cosrot+y1*sinrot, #PB_Round_Nearest)
     pt(i)\y = y+Round(-x1*sinrot+y1*cosrot, #PB_Round_Nearest)
  Next
  DrawBezier(7, pt())
  If grUpdate : UpdatesGraph(): EndIf
EndProcedure

Procedure SetLineStyle(linestyle.i,pattern.i,thickness.i)
  Protected lgpn.LOGPEN
  Protected lstyle.i
  Protected old.i ;HGDIOBJ
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn
  EndIf
  Select linestyle
    Case #SolidLn         : lstyle = #PS_SOLID
    Case #DashedLn        : lstyle = #PS_DASH
    Case #DottedLn        : lstyle = #PS_DOT
    Case #DashDotLn       : lstyle = #PS_DASHDOT
    Case #DashDotDotLn    : lstyle = #PS_DASHDOTDOT
    Case #UserBitLn,#NullLn: lstyle = #PS_NULL
  Default
    grResult = #grInvalidParam
    ProcedureReturn
  EndSelect
  lineSettings\linestyle = linestyle
  lineSettings\pattern   = pattern
  lineSettings\thickness = thickness
  With lgpn
     \lopnStyle = lstyle
     \lopnWidth\x = thickness
     \lopnColor = frColor
     \lopnColor = frColor
  EndWith
  EnterCriticalSection_(protect_devices)
  grPen = CreatePenIndirect_(lgpn);
  old = SelectObject_(grWindow,grPen); 
  SelectObject_(grMemory,grPen)       
  If old <> old_Pen  
    DeleteObject_(old) 
  EndIf
  LeaveCriticalSection_(protect_devices)
EndProcedure

;filled drawings routines

Procedure Bar(x1.i,y1.i,x2.i,y2.i)
  Protected rc.RECT
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn
  EndIf
  If (x1 > x2) Or (y1 > y2)
     grResult = #grInvalidParam
     ProcedureReturn
  EndIf
  x1 + origX
  y1 + origY 
  x2 + origX 
  y2 + origY
  SetRect_(rc,x1,y1,x2+1,y2+1)
  EnterCriticalSection_(protect_devices)
  If grDirect  
    FillRect_(grWindow,rc,grBrush) 
  EndIf
  FillRect_(grMemory,rc,grBrush)
  LeaveCriticalSection_(protect_devices)
  If grUpdate : UpdatesGraph(): EndIf
EndProcedure

Procedure Bar3D(x1.i,y1.i,x2.i,y2.i, depth.i, top.i)  ;:BOOLEAN)
  Protected Dim pt.POINT(4)
  FillRect(x1,y1,x2,y2); 
  If grResult <> #grOK
    ProcedureReturn
  EndIf
  x1 + origX 
  y1 + origY 
  x2 + origX 
  y2 + origY
  EnterCriticalSection_(protect_devices)
  If top
    pt(1)\x = x1:       pt(1)\y = y1
    pt(2)\x = x1+Int(depth): pt(2)\y = y1-Int(depth)
    pt(3)\x = x2+Int(depth): pt(3)\y = y1-Int(depth)
    pt(4)\x = x2:       pt(4)\y = y1
    If grDirect  
      Polyline_(grWindow,@pt(),4) 
    EndIf
    Polyline_(grMemory,@pt(),4)
  EndIf
  If depth <> 0
     pt(1)\x = x2+Int(depth): pt(1)\y = y1-Int(depth)
     pt(2)\x = x2+Int(depth): pt(2)\y = y2-Int(depth)
     pt(3)\x = x2:       pt(3)\y = y2
     If grDirect  
       Polyline_(grWindow,@pt(),3)
     EndIf
     Polyline_(grMemory,@pt(),3)
  EndIf
  LeaveCriticalSection_(protect_devices)
  If grUpdate : UpdatesGraph(): EndIf
EndProcedure

Procedure Chord(x.i,y.i, start.i,stop.i,xradius.i,yradius.i)
  Protected.i nXRadial1,nYRadial1,nXRadial2,nYRadial2
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn
  EndIf
  x + origX 
  y + origY
  nXRadial1 = Round(xradius*Cos(start*#Rad), #PB_Round_Nearest): nXRadial2 = Round(xradius*Cos(stop*#Rad), #PB_Round_Nearest)
  nYRadial1 = Round(yradius*Sin(start*#Rad), #PB_Round_Nearest): nYRadial2 = Round(yradius*Sin(stop*#Rad), #PB_Round_Nearest)
  If Not(defAspectRatio)
    xradius = 10000*Int(xradius) / aspX: yradius = 10000*Int(yradius) / aspY
  EndIf
  EnterCriticalSection_(protect_devices)
  If grDirect
    Chord_(grWindow,x-xradius,y-yradius,x+xradius+1,y+yradius+1,x+nXRadial1,y-nYRadial1,x+nXRadial2,y-nYRadial2)
  EndIf
  Chord_(grMemory,x-xradius,y-yradius,x+xradius+1,y+yradius+1,x+nXRadial1,y-nYRadial1,x+nXRadial2,y-nYRadial2)
  LeaveCriticalSection_(protect_devices)
  If grUpdate : UpdatesGraph(): EndIf
EndProcedure

Procedure FillEllipse(x.i,y.i,xradius.i,yradius.i)
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn
  EndIf
  x + origX
  y + origY
  If Not(defAspectRatio)
    xradius = Int(10000*xradius) / aspX; 
    yradius = Int(10000*yradius) / aspY
  EndIf
  EnterCriticalSection_(protect_devices)
  If grDirect
    Ellipse_(grWindow,x-Int(xradius),y-Int(yradius),x+Int(xradius)+1,y+Int(yradius)+1)
  EndIf
  Ellipse_(grMemory,x-Int(xradius),y-Int(yradius),x+Int(xradius)+1,y+Int(yradius)+1)
  LeaveCriticalSection_(protect_devices)
  If grUpdate : UpdatesGraph(): EndIf
EndProcedure

Procedure FillPoly(nrpoints.i, Array *polypoints.PointType(1))
  Protected.i size,i
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn
  EndIf
  If nrpoints >= 2
    EnterCriticalSection_(protect_devices)
    If grDirect  
      Polygon_(grWindow, *polypoints(),nrpoints) 
    EndIf
    Polygon_(grMemory,*polypoints(),nrpoints)
    LeaveCriticalSection_(protect_devices)
  Else
    grResult = #grInvalidParam
  EndIf
  If grUpdate : UpdatesGraph(): EndIf
EndProcedure

Procedure FillRect(x1.i,y1.i,x2.i,y2.i)
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn
  EndIf
  If (x1 > x2) Or (y1 > y2)
     grResult = #grInvalidParam
     ProcedureReturn
  EndIf
  x1 + origX 
  y1 + origY 
  x2 + origX+1 
  y2 + origY+1
  EnterCriticalSection_(protect_devices)
  If grDirect  
    Rectangle_(grWindow,x1,y1,x2,y2) 
  EndIf
  Rectangle_(grMemory,x1,y1,x2,y2)
  LeaveCriticalSection_(protect_devices)
  If grUpdate : UpdatesGraph(): EndIf
EndProcedure

Procedure FloodFill(x.i,y.i, color.i)
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn
  EndIf
  x + origX
  y + origY
  EnterCriticalSection_(protect_devices)
  If grDirect  
    ExtFloodFill_(grWindow,x,y,color,floodMode) 
  EndIf
  ExtFloodFill_(grMemory,x,y,color,floodMode)
  LeaveCriticalSection_(protect_devices)
  If grUpdate : UpdatesGraph(): EndIf
EndProcedure

Procedure GetFillPattern(Array *fillpatternn.byte(1))
  CopyArray(*fillPatternn(), fillpattern())
EndProcedure

Procedure GetFillSettings(*fillinfo.FillSettingsType)
  *fillinfo = fillSettings
EndProcedure

Procedure InvertRect(x1.i,y1.i,x2.i,y2.i)
  Protected rc.RECT
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn
  EndIf
  If (x1 > x2) Or (y1 > y2)
     grResult = #grInvalidParam
     ProcedureReturn
  EndIf
  x1 + origX 
  y1 + origY 
  x2 + origX 
  y2 + origY
  SetRect_(rc,x1,y1,x2+1,y2+1)
  EnterCriticalSection_(protect_devices)
  If grDirect
    InvertRect_(grWindow,rc) 
  EndIf
  InvertRect_(grMemory,rc)
  LeaveCriticalSection_(protect_devices)
  If grUpdate : UpdatesGraph(): EndIf
EndProcedure

Procedure PieSlice(x.i,y.i, start.i,stop.i,radius.i)
  Sector(x,y,start,stop,radius,radius)
  If grUpdate : UpdatesGraph(): EndIf
EndProcedure

Procedure RoundRect(x1.i,y1.i,x2.i,y2.i,r.i)
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn
  EndIf
  If (x1 > x2) Or (y1 > y2)
     grResult = #grInvalidParam
     ProcedureReturn
  EndIf
  x1 + origX 
  y1 + origY 
  x2 + origX 
  y2 + origY
  EnterCriticalSection_(protect_devices)
  If grDirect 
    RoundRect_(grWindow,x1,y1,x2+1,y2+1,r,r) 
  EndIf
  RoundRect_(grMemory,x1,y1,x2+1,y2+1,r,r)
  LeaveCriticalSection_(protect_devices)
  If grUpdate : UpdatesGraph(): EndIf
EndProcedure

Procedure Sector(x.i,y.i, start.i,stop.i,xradius.i,yradius.i)
  Protected.i nXRadial1,nYRadial1,nXRadial2,nYRadial2
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn
  EndIf
  x + origX
  y + origY
  nXRadial1 = Round(xradius*Cos(start*#Rad), #PB_Round_Nearest): nXRadial2 = Round(xradius*Cos(stop*#Rad), #PB_Round_Nearest)
  nYRadial1 = Round(yradius*Sin(start*#Rad), #PB_Round_Nearest): nYRadial2 = Round(yradius*Sin(stop*#Rad), #PB_Round_Nearest)
  If Not(defAspectRatio)
    xradius = Int(10000*xradius) / aspX: yradius = Int(10000*yradius) / aspY
  EndIf
  EnterCriticalSection_(protect_devices)
  If grDirect
    Pie_(grWindow,x-Int(xradius),y-Int(yradius),x+Int(xradius)+1,y+Int(yradius)+1,x+nXRadial1,y-nYRadial1,x+nXRadial2,y-nYRadial2)
  EndIf
  Pie_(grMemory,x-Int(xradius),y-Int(yradius),x+Int(xradius)+1,y+Int(yradius)+1,x+nXRadial1,y-nYRadial1,x+nXRadial2,y-nYRadial2)
  LeaveCriticalSection_(protect_devices)
  If grUpdate : UpdatesGraph(): EndIf
EndProcedure

Procedure SetFillPattern(Array fillpattern.b(1), color.i)
  Protected.i i,j
  Protected.i col0,col1 ; COLORREF
  Protected.b b
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn
  EndIf
  CopyArray(fillpattern(), fillPattern())
  col1 = color
  col0 = bkColor
  EnterCriticalSection_(protect_devices)
  If grPattern <> #Null
    DeleteObject_(grPattern) 
  EndIf
  grPattern = CreateCompatibleBitmap_(grMemory,8,8)
  SelectObject_(grTemp,grPattern)
  For i = 0 To 7
    b = fillpattern(i+1)
    For j = 7 To 0 Step -1
      If (b & $01) <> 0
        SetPixelV_(grTemp,j,i,col1)
      Else
        SetPixelV_(grTemp,j,i,col0)
      EndIf
      b = b >> 1
    Next
  Next
  SelectObject_(grTemp,old_Bitmap)
  LeaveCriticalSection_(protect_devices)
  SetFillStyle(#UserFill,color)
EndProcedure

Procedure SetFillStyle(pattern.i, color.i)
  Protected lplb.LOGBRUSH
  Protected old.i  ;HGDIOBJ
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn
  EndIf
  With lplb
    \lbStyle = #BS_HATCHED
    \lbHatch = 0
    Select pattern
      Case #SolidFill  : \lbStyle = #BS_SOLID
      Case #EmptyFill  : \lbStyle = #BS_SOLID
                          color = bkColor
      Case #LineFill   : \lbHatch = #HS_HORIZONTAL
      Case #ColFill    : \lbHatch = #HS_VERTICAL
      Case #HatchFill  : \lbHatch = #HS_CROSS
      Case #SlashFill  : \lbHatch = #HS_BDIAGONAL
      Case #BkSlashFill: \lbHatch = #HS_FDIAGONAL
      Case #XHatchFill : \lbHatch = #HS_DIAGCROSS
      Case #UserFill   : \lbStyle = #BS_PATTERN
                          \lbHatch = grPattern
      Case #NoFill     : \lbStyle = #BS_NULL
    Default
      grResult = #grInvalidParam
      ProcedureReturn
    EndSelect
    \lbColor = color
  EndWith
  fillSettings\pattern = pattern
  fillSettings\color = color
  EnterCriticalSection_(protect_devices)
  grBrush = CreateBrushIndirect_(lplb)
  old = SelectObject_(grWindow,grBrush); 
  SelectObject_(grMemory,grBrush)      
  If old <> old_Brush  
    DeleteObject_(old) 
  EndIf
  LeaveCriticalSection_(protect_devices)
EndProcedure

Procedure SetFloodMode(floodmode.i)
  Select floodmode
    Case #BorderFlood : floodMode = #FLOODFILLBORDER
    Case #SurfaceFlood: floodMode = #FLOODFILLSURFACE
  EndSelect
EndProcedure

;text And font handling routines

Procedure GetFontSettings(fontname.s, *width.integer, *height.integer, *ttfont.integer) ;:BOOLEAN
  Protected *lptm.TEXTMETRIC
  Protected len.i
  Protected x.s = Space(255), tt.s = ""
  len = GetTextFace_(grWindow,255, @x)
  tt = Chr(len-1) + Space(255)
  GetTextFace_(grWindow,255, @tt)
  GetTextMetrics_(grWindow, *lptm)
  With *lptm
    *width  = \tmMaxCharWidth 
    *height = \tmHeight
    *ttfont = Bool((\tmPitchAndFamily & #TMPF_TRUETYPE) <> 0)
  EndWith
EndProcedure

Procedure GetTextSettings(*textinfo.TextSettingsType)
  *textinfo = textSettings
EndProcedure


Procedure.i InstallUserFont(fontname.s)
  Protected.i i,Result
  Protected famName.s = ""
  Result = -1
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn Result
  EndIf
  famName = fontname
  EnterCriticalSection_(protect_devices)
  globalTemp = 0
  EnumFontFamilies_(grWindow,@famName,@EnumFontFamProc(),0)
  If (globalTemp = 1)
    For i = 0 To #NrMaxFonts-1
      If instFont(i) = ""
        instFont(i) = fontname; ;+0H;*)
        Result = i
        Break
      EndIf
    Next
  EndIf
  LeaveCriticalSection_(protect_devices)
  If Result = -1
    grResult = #grInvalidFont 
  EndIf
  ProcedureReturn Result
EndProcedure

Procedure OutText(textstring.s)
  Protected lpPoint.POINT
  Protected len.i
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn
  EndIf
  len = Len(textstring)
  EnterCriticalSection_(protect_devices)
  If grDirect  
    TextOut_(grWindow,0,0,textstring,len) 
  EndIf
  TextOut_(grMemory,0,0,textstring,len)
  LeaveCriticalSection_(protect_devices)
  GetCurrentPositionEx_(grMemory, @lpPoint)
  MoveTo(lpPoint\x - origX, lpPoint\y - origY)
EndProcedure

Procedure OutTextXY(x.i,y.i, textstring.s)
  MoveTo(x,y)
  OutText(textstring)
EndProcedure

Procedure SetTextJustify(horiz.i, vert.i)
  Protected.i htext,vtext
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn
  EndIf
  Select horiz
    Case #LeftText  : htext = #TA_LEFT
    Case #CenterText: htext = #TA_CENTER
    Case #RightText : htext = #TA_RIGHT
  Default
    grResult = #grInvalidParam
    ProcedureReturn
  EndSelect
  Select vert
    Case #TopText     : vtext = #TA_TOP
    Case #BottomText  : vtext = #TA_BOTTOM
    Case #BaselineText: vtext = #TA_BASELINE
  Default
    grResult = #grInvalidParam
    ProcedureReturn
  EndSelect
  textSettings\horiz = horiz
  textSettings\vert = vert
  SetTextAlign_(grWindow,htext | vtext | #TA_UPDATECP)
  SetTextAlign_(grMemory,htext | vtext | #TA_UPDATECP)
EndProcedure

Procedure SetTextStyle(font.i,direction.i,charsize.i)
  Protected.b loByte,hiByte
  Protected.b nrfont
  Protected fontname.s = ""
  Protected lplf.LOGFONT
  Protected old.i ;HGDIOBJ
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn
  EndIf
  loByte = LOBYTE(LOWORD(font))
  hiByte = HIBYTE(HIWORD(font))
  nrfont = loByte % $10
  If (nrfont>=0) And (nrfont <= #NrMaxFonts-1)
    fontname = instFont(nrfont)
  Else
    fontname = ""
  EndIf
  If fontname <> ""
    textSettings\font = font
    textSettings\direction = direction
    textSettings\charsize = charsize
    If charsize <= 5
      charsize = charsize * #MinCharSize 
    EndIf
    lplf\lfHeight = charsize
    lplf\lfWidth = 0
    lplf\lfEscapement = 10 * direction
    lplf\lfOrientation = 10 * direction
    lplf\lfItalic = #False
    lplf\lfWeight = (#FW_BOLD - #FW_NORMAL) * (loByte / $10) + #FW_NORMAL
    If (hiByte / $10) > 0
      lplf\lfItalic = #True
    EndIf
    lplf\lfUnderline = #False
    If (hiByte / $10) > 0
      lplf\lfUnderline = #True
    EndIf
    lplf\lfStrikeOut = #False
    lplf\lfCharSet = #DEFAULT_CHARSET
    lplf\lfOutPrecision = #OUT_DEFAULT_PRECIS
    lplf\lfClipPrecision = #CLIP_DEFAULT_PRECIS
    lplf\lfQuality = #DEFAULT_QUALITY
    lplf\lfPitchAndFamily = #DEFAULT_PITCH | #FF_DONTCARE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;    
;    *lplf\lfFaceName = fontname  ????????????????
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;    
    PokeS(@lplf\lfFaceName[0], fontname)
    EnterCriticalSection_(protect_devices)
    grFont = CreateFontIndirect_(lplf)
    old = SelectObject_(grWindow, grFont)
    SelectObject_(grMemory, grFont)
    If old <> old_Font  
      DeleteObject_(old)
    EndIf
    LeaveCriticalSection_(protect_devices)
  Else
    grResult = #grInvalidFontNum
  EndIf
EndProcedure

Procedure SetUserCharSize(nCharExtra.i,nBreakExtra.i,dummy1.i,dummy2.i)
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn
  EndIf
  SetTextCharacterExtra_(grWindow,nCharExtra)
  SetTextCharacterExtra_(grMemory,nCharExtra)
  SetTextJustification_(grWindow,nBreakExtra,1)
  SetTextJustification_(grMemory,nBreakExtra,1)
EndProcedure

Procedure.i TextHeights(textstring.s)
  Protected lpSize.SIZE
  Protected len.i
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn 0
  EndIf
  len = Len(textstring)
  GetTextExtentPoint32_(grMemory,textstring,len,lpSize)
  ProcedureReturn lpSize\cy
EndProcedure

Procedure.i TextWidths(textstring.s)
  Protected lpSize.SIZE
  Protected len.i
  grResult = #grOK
  If Not(grEnabled)
     grResult = #grNoInitGraph
     ProcedureReturn 0
  EndIf
  len = Len(textstring)
  GetTextExtentPoint32_(grMemory,textstring,len,lpSize)
  ProcedureReturn lpSize\cx
EndProcedure


Procedure THREEDto2DAll(*coords.ThreeDPointType, *pan.ThreeDPointType, *centre.ThreeDPointType, *position.ThreeDPointType, zoom.d, *sx.double, *sy.double)
  Protected new.ThreeDPointType
  *coords\x  =  *coords\x + *position\x
  *coords\y  =  *coords\y + *position\y
  *coords\z  =  *coords\z + *position\z
  new\x  =  *coords\x*Cos(*pan\x) - *coords\z*Sin(*pan\x)
  new\z  =  *coords\x*Sin(*pan\x) + *coords\z*Cos(*pan\x)
  new\y  =  *coords\y*Cos(*pan\y) - new\z*Sin(*pan\y)
  *coords\z  =  new\y*Cos(*pan\y) - new\z*Sin(*pan\y)
  *coords\x  =  new\x*Cos(*pan\z) - new\y*Sin(*pan\z)
  *coords\y  =  new\x*Sin(*pan\z) + new\y*Cos(*pan\z)
  If *coords\z > 0.0
    *sx  =  *coords\x / *coords\z * zoom + *centre\x
    *sy  =  *coords\y / *coords\z * zoom + *centre\y
  Else
    *sx  =  *coords\x * zoom + *centre\x
    *sy  =  *coords\y * zoom + *centre\y
  EndIf
EndProcedure

Procedure THREEDto2D(*coords.ThreeDPointType, zoom.d, *sx.double, *sy.double)
    *sx  =  *coords\x / *coords\z * zoom
    *sy  =  *coords\y / *coords\z * zoom
EndProcedure


Procedure DrawSymbol(x.i, y.i, color.i, symbol.i, width.i, height.i)
  Protected currfcol.i = GetColor()
  SetColor(color)
  Select symbol
    Case #SYMBOLRECTANGLE:
        lines(x - width/2, y - height/2, x + width/2, y - height/2)
        lines(x + width/2, y - height/2, x + width/2, y + height/2)
        lines(x + width/2, y + height/2, x - width/2, y + height/2)
        lines(x - width/2, y + height/2, x - width/2, y - height/2)
    Case #SYMBOLTRIANGLE:
        lines(x - width/2, y + height/2, x, y - height/2)
        lines(x, y - height/2, x + width/2, y + height/2)
        lines(x + width/2, y + height/2, x - width/2, y + height/2)
    Case #SYMBOLDIAMOND:
        lines(x - width/2, y, x, y - height/2)
        lines(x, y - height/2, x + width/2, y)
        lines(x + width/2, y, x, y + height/2)
        lines(x, y + height/2, x - width/2, y)
    Case #SYMBOLCROSS:
        lines(x - width/2, y, x + width/2, y)
        lines(x, y - height/2, x, y + height/2)
    Case #SYMBOLXCROSS:
        lines(x - width/2, y + height/2, x + width/2, y - height/2)
        lines(x - width/2, y - height/2, x + width/2, y + height/2)
    Default
  EndSelect
  SetColor(currfcol)
EndProcedure

Global old_TextSettings.TextSettingsType
Global.i textX,textY,textW,textH

Procedure DrawCaret(nr.i)
  Select nr
    Case 0: SetFillStyle(#SolidFill,GetBkColor())
    Case 1: SetFillStyle(#SolidFill,GetColor())
  EndSelect
  If CaretBlock Or (nr = 0)
    Bar(textX,textY,textX+textW,textY+textH)
  Else
    Bar(textX,textY+textH-1,textX+textW,textY+textH)
  EndIf
EndProcedure

Procedure TextSettings()
  Protected viewport.ViewPortType
  With old_TextSettings
    SetTextStyle(#DefaultFont | (\font / $10) << 4,0, \charsize)  ; keep font format
    SetTextJustify(#LeftText, #TopText)
  EndWith
  textX = GetX()
  textY = GetY()
  textW = TextWidth("W")
  textH = TextHeight("H")
  GetViewSettings(viewport)
  With viewport
    maxX = \x2-\x1
    maxY = \y2-\y1
  EndWith
EndProcedure

Procedure Sound(hz.i, dur.i)
  Beep_(hz,dur)
EndProcedure

EndModule

123
Beiträge: 9
Registriert: 21.07.2015 20:20

Re: bgi modul - farbfehler

Beitrag von 123 »

test proggie

Code: Alles auswählen

XIncludeFile "bgi.pb"
  
  
UseModule BGI
 x.i = #VividRedTangelo 

EnableExplicit 

Global Event.i, Quit.i, wnum.i,MaxX.i,MaxY.i,MaxRadius.i
wnum = OpenWindow(#PB_Any, 100, 200, 600, 600, "PureBasic Window", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
If wnum
  InitGraph(wnum, 600, 600, "tester")
  MaxX = grResult
  SetBkColor(#White)
  ClearDevice()
  ;UpdatesGraph()
    SetColor(#AcidGreen)
    SetFillStyle(#HatchFill, #RichLilac)
    MaxX=GetMaxX(): MaxY=GetMaxY()
    MaxRadius = MaxY / 10
    FillEllipse((MaxX)-100,(MaxY)-100,(MaxRadius)-10,(MaxRadius)-10)
    ;UpdatesGraph()
    
    DrawSymbol(200, 200, #VividRedTangelo, #SYMBOLDIAMOND, 30, 30)
    
    SetColor(#BananaMania)
    OutTextXY(10,10, "dlfdsf dsf sd kdlsfs fkdsf dsf ds")
    ;UpdatesGraph()
    SetColor(#BlueSapphire)
    SetFillStyle(#NoFill, #BlueSapphire)
    Sector(100,100, 20,90, 220,20)
    ;UpdatesGraph()
    ;UpdateGraph(#UpdateNow)
    ;SetWindowSize(800,800);
    
    
    
  Repeat
    Event = WaitWindowEvent()

    If Event = #PB_Event_CloseWindow  ; If the user has pressed on the close button
      Quit = 1
    EndIf

  Until Quit = 1
  
EndIf

End   ; All the opened windows are closed automatically by PureBasic

123
Beiträge: 9
Registriert: 21.07.2015 20:20

Re: bgi modul - farbfehler

Beitrag von 123 »

ein paar farben aus einem forum:

Code: Alles auswählen

  #AcidGreen = $1ABFB0; RGB (176, 191, 26)
  #Aero = $E8B97C; RGB (124, 185, 232)
  #AeroBlue = $E5FFC9; RGB (201, 255, 229)
  #AfricanViolet = $BE84B2; RGB (178, 132, 190)
  #AirForceBlue_RAF = $A88A5D; RGB (93, 138, 168)
  #AirForceBlue_USAF = $8F3000; RGB (0, 48, 143)
  #AirSuperiorityBlue = $C1A072; RGB (114, 160, 193)
  #AlabamaCrimson = $2A00AF; RGB (175, 0, 42)
  #AliceBlue = $FFF8F0; RGB (240, 248, 255)
  #AlizarinCrimson = $3626E3; RGB (227, 38, 54)
  #AlloyOrange = $1062C4; RGB (196, 98, 16)
  #Almond = $CDDEEF; RGB (239, 222, 205)
  #Amaranth = $502BE5; RGB (229, 43, 80)
  #AmaranthDeepPurple = $4F27AB; RGB (171, 39, 79)
  #AmaranthPink = $BB9CF1; RGB (241, 156, 187)
  #AmaranthPurple = $4F27AB; RGB (171, 39, 79)
  #AmaranthRed = $2D21D3; RGB (211, 33, 45)
  #Amazon = $577A3B; RGB (59, 122, 87)
  #Amber = $00BFFF; RGB (255, 191, 0)
  #Amber_SAE_ECE = $007EFF; RGB (255, 126, 0)
  #AmericanRose = $3E03FF; RGB (255, 3, 62)
  #Amethyst = $CC6699; RGB (153, 102, 204)
  #AndroidGreen = $39C6A4; RGB (164, 198, 57)
  #AntiFlashWhite = $F4F3F2; RGB (242, 243, 244)
  #AntiqueBrass = $7595CD; RGB (205, 149, 117)
  #AntiqueBronze = $1E5D66; RGB (102, 93, 30)
  #AntiqueFuchsia = $835C91; RGB (145, 92, 131)
  #AntiqueRuby = $2D1B84; RGB (132, 27, 45)
  #AntiqueWhite = $D7EBFA; RGB (250, 235, 215)
  #Ao_English = $008000; RGB (0, 128, 0)
  #AppleGreen = $00B68D; RGB (141, 182, 0)
  #Apricot = $B1CEFB; RGB (251, 206, 177)
  #Aqua = $FFFF00; RGB (0, 255, 255)
  #Aquamarine = $D4FF7F; RGB (127, 255, 212)
  #ArmyGreen = $20534B; RGB (75, 83, 32)
  #Arsenic = $4B443B; RGB (59, 68, 75)
  #Artichoke = $79978F; RGB (143, 151, 121)
  #ArylideYellow = $6BD6E9; RGB (233, 214, 107)
  #AshGrey = $B5BEB2; RGB (178, 190, 181)
  #Asparagus = $6BA987; RGB (135, 169, 107)
  #AtomicTangerine = $6699FF; RGB (255, 153, 102)
  #Auburn = $2A2AA5; RGB (165, 42, 42)
  #Aureolin = $00EEFD; RGB (253, 238, 0)
  #AuroMetalSaurus = $807F6E; RGB (110, 127, 128)
  #Avocado = $038256; RGB (86, 130, 3)
  #Azure = $FF7F00; RGB (0, 127, 255)
  #Azure_WebColor = $FFFFF0; RGB (240, 255, 255)
  #AzureMist = $FFFFF0; RGB (240, 255, 255)
  #AzureishWhite = $F4E9DB; RGB (219, 233, 244)
  #BabyBlue = $F0CF89; RGB (137, 207, 240)
  #BabyBlueEyes = $F1CAA1; RGB (161, 202, 241)
  #BabyPink = $C2C2F4; RGB (244, 194, 194)
  #BabyPowder = $FAFEFE; RGB (254, 254, 250)
  #BakerMillerPink = $AF91FF; RGB (255, 145, 175)
  #BallBlue = $CDAB21; RGB (33, 171, 205)
  #BananaMania = $B5E7FA; RGB (250, 231, 181)
  #BananaYellow = $35E1FF; RGB (255, 225, 53)
  #BangladeshGreen = $4E6A00; RGB (0, 106, 78)
  #BarbiePink = $8A21E0; RGB (224, 33, 138)
  #BarnRed = $020A7C; RGB (124, 10, 2)
  #BattleshipGrey = $828484; RGB (132, 132, 130)
  #Bazaar = $7B7798; RGB (152, 119, 123)
  #BeauBlue = $E6D4BC; RGB (188, 212, 230)
  #Beaver = $70819F; RGB (159, 129, 112)
  #Beige = $DCF5F5; RGB (245, 245, 220)
  #BdazzledBlue = $94582E; RGB (46, 88, 148)
  #BigDipORuby = $42259C; RGB (156, 37, 66)
  #Bisque = $C4E4FF; RGB (255, 228, 196)
  #Bistre = $1F2B3D; RGB (61, 43, 31)
  #BistreBrown = $177196; RGB (150, 113, 23)
  #BitterLemon = $0DE0CA; RGB (202, 224, 13)
  #BitterLime = $00FFBF; RGB (191, 255, 0)
  #Bittersweet = $5E6FFE; RGB (254, 111, 94)
  #BittersweetShimmer = $514FBF; RGB (191, 79, 81)
  #Black = $000000; RGB (0, 0, 0)
  #BlackBean = $020C3D; RGB (61, 12, 2)
  #BlackLeatherJacket = $293525; RGB (37, 53, 41)
  #BlackOlive = $363C3B; RGB (59, 60, 54)
  #BlanchedAlmond = $CDEBFF; RGB (255, 235, 205)
  #BlastOffBronze = $6471A5; RGB (165, 113, 100)
  #BlazeOrange = $FF6600
  #BleuDeFrance = $E78C31; RGB (49, 140, 231)
  #BlizzardBlue = $EEE5AC; RGB (172, 229, 238)
  #Blond = $BEF0FA; RGB (250, 240, 190)
  #Blue_Crayola = $FE751F; RGB (31, 117, 254)
  #Blue_Munsell = $AF9300; RGB (0, 147, 175)
  #Blue_NCS = $BD8700; RGB (0, 135, 189)
  #Blue_Pantone = $A81800; RGB (0, 24, 168)
  #Blue_Pigment = $993333; RGB (51, 51, 153)
  #Blue_RYB = $FE4702; RGB (2, 71, 254)
  #BlueBell = $D0A2A2; RGB (162, 162, 208)
  #BlueGray = $CC9966; RGB (102, 153, 204)
  #BlueGreen = $BA980D; RGB (13, 152, 186)
  #BlueLagoon = $A1935E; RGB (94, 147, 161)
  #BlueMagentaViolet = $923555; RGB (85, 53, 146)
  #BlueSapphire = $806112; RGB (18, 97, 128)
  #BlueViolet = $E22B8A; RGB (138, 43, 226)
  #BlueYonder = $A77250; RGB (80, 114, 167)
  #Blueberry = $F7864F; RGB (79, 134, 247)
  #Bluebonnet = $F01C1C; RGB (28, 28, 240)
  #Blush = $835DDE; RGB (222, 93, 131)
  #Bole = $3B4479; RGB (121, 68, 59)
  #BondiBlue = $B69500; RGB (0, 149, 182)
  #Bone = $C9DAE3; RGB (227, 218, 201)
  #BostonUniversityRed = $0000CC; RGB (204, 0, 0)
  #BottleGreen = $4E6A00; RGB (0, 106, 78)
  #Boysenberry = $603287; RGB (135, 50, 96)
  #BrandeisBlue = $FF7000; RGB (0, 112, 255)
  #Brass = $42A6B5; RGB (181, 166, 66)
  #BrickRed = $5441CB; RGB (203, 65, 84)
  #BrightCerulean = $D6AC1D; RGB (29, 172, 214)
  #BrightGreen = $00FF66; RGB (102, 255, 0)
  #BrightLavender = $E494BF; RGB (191, 148, 228)
  #BrightLilac = $EF91D8; RGB (216, 145, 239)
  #BrightMaroon = $4821C3; RGB (195, 33, 72)
  #BrightNavyBlue = $D27419; RGB (25, 116, 210)
  #BrightPink = $7F00FF; RGB (255, 0, 127)
  #BrightTurquoise = $DEE808; RGB (8, 232, 222)
  #BrightUbe = $E89FD1      ; RGB (209, 159, 232)
  #BrightViolet = $ff00ff
  #BrilliantAzure = $FF9933; RGB (51, 153, 255)
  #BrilliantLavender = $FFBBF4; RGB (244, 187, 255)
  #BrilliantRose = $A355FF; RGB (255, 85, 163)
  #BrinkPink = $7F60FB; RGB (251, 96, 127)
  #BritishRacingGreen = $254200; RGB (0, 66, 37)
  #Bronze = $327FCD; RGB (205, 127, 50)
  #BronzeYellow = $007073; RGB (115, 112, 0)
  #Brown_Traditional = $004B96; RGB (150, 75, 0)
  #Brown_Web = $2A2AA5; RGB (165, 42, 42)
  #BrownNose = $23446B; RGB (107, 68, 35)
  #BrownYellow = $6699cc; RGB (204, 153, 102)
  #BrunswickGreen = $3E4D1B; RGB (27, 77, 62)
  #BubbleGum = $CCC1FF; RGB (255, 193, 204)
  #Bubbles = $FFFEE7; RGB (231, 254, 255)
  #Buff = $82DCF0; RGB (240, 220, 130)
  #BudGreen = $61B67B; RGB (123, 182, 97)
  #BulgarianRose = $070648; RGB (72, 6, 7)
  #Burgundy = $200080; RGB (128, 0, 32)
  #Burlywood = $87B8DE; RGB (222, 184, 135)
  #BurntOrange = $0055CC; RGB (204, 85, 0)
  #BurntSienna = $5174E9; RGB (233, 116, 81)
  #BurntUmber = $24338A; RGB (138, 51, 36)
  #Byzantine = $A433BD; RGB (189, 51, 164)
  #Byzantium = $632970; RGB (112, 41, 99)
  #Cadet = $726853; RGB (83, 104, 114)
  #CadetBlue = $A09E5F; RGB (95, 158, 160)
  #CadetGrey = $B0A391; RGB (145, 163, 176)
  #CadmiumGreen = $3C6B00; RGB (0, 107, 60)
  #CadmiumOrange = $2D87ED; RGB (237, 135, 45)
  #CadmiumRed = $2200E3; RGB (227, 0, 34)
  #CadmiumYellow = $00F6FF; RGB (255, 246, 0)
  #CafeAuLait = $5B7BA6; RGB (166, 123, 91)
  #CafeNoir = $21364B; RGB (75, 54, 33)
  #CalPolyGreen = $2B4D1E; RGB (30, 77, 43)
  #CambridgeBlue = $ADC1A3; RGB (163, 193, 173)
  #Camel = $6B9AC1; RGB (193, 154, 107)
  #CameoPink = $CCBBEF; RGB (239, 187, 204)
  #CamouflageGreen = $6B8678; RGB (120, 134, 107)
  #CanaryYellow = $00EFFF; RGB (255, 239, 0)
  #CandyAppleRed = $0008FF; RGB (255, 8, 0)
  #CandyPink = $7A71E4; RGB (228, 113, 122)
  #Capri = $FFBF00; RGB (0, 191, 255)
  #CaputMortuum = $202759; RGB (89, 39, 32)
  #Cardinal = $3A1EC4; RGB (196, 30, 58)
  #CaribbeanGreen = $99CC00; RGB (0, 204, 153)
  #Carmine = $180096; RGB (150, 0, 24)
  #Carmine_MAndP = $4000D7; RGB (215, 0, 64)
  #CarminePink = $424CEB; RGB (235, 76, 66)
  #CarmineRed = $3800FF; RGB (255, 0, 56)
  #CarnationPink = $C9A6FF; RGB (255, 166, 201)
  #Carnelian = $1B1BB3; RGB (179, 27, 27)
  #CarolinaBlue = $D3A056; RGB (86, 160, 211)
  #CarrotOrange = $2191ED; RGB (237, 145, 33)
  #Casper = $A7C3CC
  #CastletonGreen = $3F5600; RGB (0, 86, 63)
  #CatalinaBlue = $782A06; RGB (6, 42, 120)
  #Catawba = $423670; RGB (112, 54, 66)
  #CedarChest = $495AC9; RGB (201, 90, 73)
  #Ceil = $CFA192; RGB (146, 161, 207)
  #Celadon = $AFE1AC; RGB (172, 225, 175)
  #CeladonBlue = $A77B00; RGB (0, 123, 167)
  #CeladonGreen = $7C842F; RGB (47, 132, 124)
  #Celeste = $FFFFB2; RGB (178, 255, 255)
  #CelestialBlue = $D09749; RGB (73, 151, 208)
  #Cerise = $6331DE; RGB (222, 49, 99)
  #CerisePink = $833BEC; RGB (236, 59, 131)
  #Cerulean = $A77B00; RGB (0, 123, 167)
  #CeruleanBlue = $BE522A; RGB (42, 82, 190)
  #CeruleanFrost = $C39B6D; RGB (109, 155, 195)
  #CGBlue = $A57A00; RGB (0, 122, 165)
  #CGRed = $313CE0; RGB (224, 60, 49)
  #Chamoisee = $5A78A0; RGB (160, 120, 90)
  #Champagne = $CEE7F7; RGB (247, 231, 206)
  #Charcoal = $4F4536; RGB (54, 69, 79)
  #CharlestonGreen = $2B2B23; RGB (35, 43, 43)
  #CharmPink = $AC8FE6; RGB (230, 143, 172)
  #Chartreuse_Traditional = $00FFDF; RGB (223, 255, 0)
  #Chartreuse_Web = $00FF7F; RGB (127, 255, 0)
  #Cherry = $6331DE; RGB (222, 49, 99)
  #CherryBlossomPink = $C5B7FF; RGB (255, 183, 197)
  #Chestnut = $354595; RGB (149, 69, 53)
  #ChinaPink = $A16FDE; RGB (222, 111, 161)
  #ChinaRose = $6E51A8; RGB (168, 81, 110)
  #ChineseRed = $1E38AA; RGB (170, 56, 30)
  #ChineseViolet = $886085; RGB (133, 96, 136)
  #Chocolate_Traditional = $003F7B; RGB (123, 63, 0)
  #Chocolate_Web = $1E69D2; RGB (210, 105, 30)
  #ChromeYellow = $00A7FF; RGB (255, 167, 0)
  #Cinereous = $7B8198; RGB (152, 129, 123)
  #Cinnabar = $3442E3; RGB (227, 66, 52)
  #Cinnamon = $1E69D2; RGB (210, 105, 30)
  #Citrine = $0AD0E4; RGB (228, 208, 10)
  #Citron = $1FA99F; RGB (159, 169, 31)
  #Claret = $34177F; RGB (127, 23, 52)
  #ClassicRose = $E7CCFB; RGB (251, 204, 231)
  #CobaltBlue = $AB4700; RGB (0, 71, 171)
  #CocoaBrown = $1E69D2; RGB (210, 105, 30)
  #Coconut = $3E5A96; RGB (150, 90, 62)
  #Coffee = $374E6F; RGB (111, 78, 55)
  #ColumbiaBlue = $E2D8C4; RGB (196, 216, 226)
  #CongoPink = $7983F8; RGB (248, 131, 121)
  #CoolBlack = $000000; RGB (0, 0, 0)
  #CoolGrey = $AC928C; RGB (140, 146, 172)
  #Copper = $3373B8; RGB (184, 115, 51)
  #Copper_Crayola = $678ADA; RGB (218, 138, 103)
  #CopperPenny = $696FAD; RGB (173, 111, 105)
  #CopperRed = $516DCB; RGB (203, 109, 81)
  #CopperRose = $666699; RGB (153, 102, 102)
  #Coquelicot = $0038FF; RGB (255, 56, 0)
  #Coral = $507FFF; RGB (255, 127, 80)
  #CoralPink = $7983F8; RGB (248, 131, 121)
  #CoralRed = $4040FF; RGB (255, 64, 64)
  #Cordovan = $453F89; RGB (137, 63, 69)
  #Corn = $5DECFB; RGB (251, 236, 93)
  #CornellRed = $1B1BB3; RGB (179, 27, 27)
  #CornflowerBlue = $ED9564; RGB (100, 149, 237)
  #Cornsilk = $DCF8FF; RGB (255, 248, 220)
  #CosmicLatte = $E7F8FF; RGB (255, 248, 231)
  #CoyoteBrown = $3e6181; RGB (129, 97, 62)
  #CottonCandy = $D9BCFF; RGB (255, 188, 217)
  #Cream = $D0FDFF; RGB (255, 253, 208)
  #Crimson = $3C14DC; RGB (220, 20, 60)
  #CrimsonGlory = $3200BE; RGB (190, 0, 50)
  #CrimsonRed = $000099; RGB (153, 0, 0)
  #CyanAzure = $b4824E; RGB (78, 130, 180)
  #CyanBlueAzure = $BF8246; RGB (70, 130, 191)
  #CyanCobaltBlue = $9C5828; RGB (40, 88, 156)
  #CyanCornflowerBlue = $C28B18; RGB (24, 139, 194)
  #Cyan_Process = $EBB700; RGB (0, 183, 235)
  #CyberGrape = $7C4258; RGB (88, 66, 124)
  #CyberYellow = $00D3FF; RGB (255, 211, 0)
  #Daffodil = $31FFFF; RGB (255, 255, 49)
  #Dandelion = $30E1F0; RGB (240, 225, 48)
  #DarkBlue = $8B0000; RGB (0, 0, 139)
  #DarkBlueGray = $996666; RGB (102, 102, 153)
  #DarkBrown = $214365; RGB (101, 67, 33)
  #DarkBrownTangelo = $4E6588; RGB (136, 101, 78)
  #DarkByzantium = $54395D; RGB (93, 57, 84)
  #DarkCandyAppleRed = $0000A4; RGB (164, 0, 0)
  #DarkCerulean = $7E4508; RGB (8, 69, 126)
  #DarkChestnut = $606998; RGB (152, 105, 96)
  #DarkCoral = $455BCD; RGB (205, 91, 69)
  #DarkCyan = $8B8B00; RGB (0, 139, 139)
  #DarkElectricBlue = $786853; RGB (83, 104, 120)
  #DarkGoldenrod = $0B86B8; RGB (184, 134, 11)
  #DarkGray_X11 = $A9A9A9; RGB (169, 169, 169)
  #DarkGreen = $203201; RGB (1, 50, 32)
  #DarkGreen_X11 = $006400; RGB (0, 100, 0)
  #DarkImperialBlue = $6A4100; RGB (0, 65, 106)
  #DarkImperialBlue_ = $F96E6E; RGB (110, 110, 249)
  #DarkIndigo = $5f3db0
  #DarkJungleGreen = $21241A; RGB (26, 36, 33)
  #DarkKhaki = $6BB7BD; RGB (189, 183, 107)
  #DarkLava = $323C48; RGB (72, 60, 50)
  #DarkLavender = $964F73; RGB (115, 79, 150)
  #DarkLiver = $4F4B53; RGB (83, 75, 79)
  #DarkLiver_Horses = $373D54; RGB (84, 61, 55)
  #DarkMagenta = $8B008B; RGB (139, 0, 139)
  #DarkMediumGray = $A9A9A9; RGB (169, 169, 169)
  #DarkMidnightBlue = $663300; RGB (0, 51, 102)
  #DarkMossGreen = $235D4A   ; RGB (74, 93, 35)
  #DarkOlive = $556B2F
  #DarkOliveGreen = $2F6B55; RGB (85, 107, 47) 
  #DarkOrange = $008CFF; RGB (255, 140, 0)
  #DarkOrchid = $CC3299; RGB (153, 50, 204)
  #DarkPastelBlue = $CB9E77; RGB (119, 158, 203)
  #DarkPastelGreen = $3CC003; RGB (3, 192, 60)
  #DarkPastelPurple = $D66F96; RGB (150, 111, 214)
  #DarkPastelRed = $223BC2; RGB (194, 59, 34)
  #DarkPink = $8054E7; RGB (231, 84, 128)
  #DarkPowderBlue = $993300; RGB (0, 51, 153)
  #DarkPuce = $3C3A4F; RGB (79, 58, 60)
  #DarkPurple = $341930; RGB (48, 25, 52)
  #DarkRaspberry = $572687; RGB (135, 38, 87)
  #DarkRed = $00008B; RGB (139, 0, 0)
  #DarkSalmon = $7A96E9; RGB (233, 150, 122)
  #DarkScarlet = $190356; RGB (86, 3, 25)
  #DarkSeaGreen = $8FBC8F; RGB (143, 188, 143)
  #DarkSienna = $14143C; RGB (60, 20, 20)
  #DarkSkyBlue = $D6BE8C; RGB (140, 190, 214)
  #DarkSlateBlue = $8B3D48; RGB (72, 61, 139)
  #DarkSlateGray = $4F4F2F; RGB (47, 79, 79)
  #DarkSpringGreen = $457217; RGB (23, 114, 69)
  #DarkTan = $518191; RGB (145, 129, 81)
  #DarkTangerine = $12A8FF; RGB (255, 168, 18)
  #DarkTaupe = $323C48; RGB (72, 60, 50)
  #DarkTerraCotta = $5C4ECC; RGB (204, 78, 92)
  #DarkTurquoise = $D1CE00; RGB (0, 206, 209)
  #DarkVanilla = $A8BED1; RGB (209, 190, 168)
  #DarkViolet = $D30094; RGB (148, 0, 211)
  #DarkYellow = $0C879B; RGB (155, 135, 12)
  #DartmouthGreen = $3C7000; RGB (0, 112, 60)
  #DavysGrey = $555555; RGB (85, 85, 85)
  #DebianRed = $530AD7; RGB (215, 10, 83)
  #DeepAquamarine = $6D8240; RGB (64, 130, 109)
  #DeepCarmine = $3E20A9; RGB (169, 32, 62)
  #DeepCarminePink = $3830EF; RGB (239, 48, 56)
  #DeepCarrotOrange = $2C69E9; RGB (233, 105, 44)
  #DeepCerise = $8732DA; RGB (218, 50, 135)
  #DeepChampagne = $A5D6FA; RGB (250, 214, 165)
  #DeepChestnut = $484EB9; RGB (185, 78, 72)
  #DeepCoffee = $414270; RGB (112, 66, 65)
  #DeepFuchsia = $C154C1; RGB (193, 84, 193)
  #DeepGreen = $086605; RGB (5, 102, 8)
  #DeepGreenCyanTurquoise = $617C0E; RGB (14, 124, 97)
  #DeepJungleGreen = $494B00; RGB (0, 75, 73)
  #DeepKoamaru = $663333; RGB (51, 51, 102)
  #DeepLemon = $1AC7F5; RGB (245, 199, 26)
  #DeepLilac = $BB5599; RGB (153, 85, 187)
  #DeepMagenta = $CC00CC; RGB (204, 0, 204)
  #DeepMaroon = $000082; RGB (130, 0, 0)
  #Deep = $D473D4; RGB (212, 115, 212)
  #DeepMossGreen = $3B5E35; RGB (53, 94, 59)
  #DeepPeach = $A4CBFF; RGB (255, 203, 164)
  #DeepPink = $9314FF; RGB (255, 20, 147)
  #DeepPuce = $685CA9; RGB (169, 92, 104)
  #DeepRed = $010185; RGB (133, 1, 1)
  #DeepRuby = $5B3F84; RGB (132, 63, 91)
  #DeepSaffron = $3399FF; RGB (255, 153, 51)
  #DeepSkyBlue = $FFBF00; RGB (0, 191, 255)
  #DeepSpaceSparkle = $6C644A; RGB (74, 100, 108)
  #DeepSpringBud = $2F6B55; RGB (85, 107, 47)
  #DeepTaupe = $605E7E; RGB (126, 94, 96)
  #DeepTuscanRed = $4D4266; RGB (102, 66, 77)
  #DeepViolet = $660033; RGB (51, 0, 102)
  #Deer = $5987BA; RGB (186, 135, 89)
  #Denim = $BD6015; RGB (21, 96, 189)
  #DesaturatedCyan = $999966; RGB (102, 153, 153)
  #Desert = $6B9AC1; RGB (193, 154, 107)
  #DesertSand = $AFC9ED; RGB (237, 201, 175)
  #Desire = $533CEA; RGB (234, 60, 83)
  #Diamond = $FFF2B9; RGB (185, 242, 255)
  #DimGray = $696969; RGB (105, 105, 105)
  #Dirt = $53769B; RGB (155, 118, 83)
  #DodgerBlue = $FF901E; RGB (30, 144, 255)
  #DogwoodRose = $6818D7; RGB (215, 24, 104)
  #DollarBill = $65BB85; RGB (133, 187, 101)
  #DonkeyBrown = $284C66; RGB (102, 76, 40)
  #Drab = $177196; RGB (150, 113, 23)
  #DukeBlue = $9C0000; RGB (0, 0, 156)
  #DustStorm = $C9CCE5; RGB (229, 204, 201)
  #DutchWhite = $BBDFEF; RGB (239, 223, 187)
  #EarthYellow = $5FA9E1; RGB (225, 169, 95)
  #Ebony = $505D55; RGB (85, 93, 80)
  #Ecru = $80B2C2; RGB (194, 178, 128)
  #EerieBlack = $1B1B1B; RGB (27, 27, 27)
  #Eggplant = $514061; RGB (97, 64, 81)
  #Eggshell = $D6EAF0; RGB (240, 234, 214)
  #EgyptianBlue = $A63410; RGB (16, 52, 166)
  #ElectricBlue = $FFF97D; RGB (125, 249, 255)
  #ElectricCrimson = $3F00FF; RGB (255, 0, 63)
  #ElectricCyan = $FFFF00; RGB (0, 255, 255)
  #ElectricGreen = $00FF00; RGB (0, 255, 0)
  #ElectricIndigo = $FF006F; RGB (111, 0, 255)
  #ElectricLavender = $FFBBF4; RGB (244, 187, 255)
  #ElectricLime = $00FFCC; RGB (204, 255, 0)
  #ElectricPurple = $FF00BF; RGB (191, 0, 255)
  #ElectricUltramarine = $FF003F; RGB (63, 0, 255)
  #ElectricViolet = $FF008F; RGB (143, 0, 255)
  #ElectricYellow = $33FFFF; RGB (255, 255, 51)
  #Emerald = $78C850; RGB (80, 200, 120)
  #Eminence = $82306C; RGB (108, 48, 130)
  #EnglishGreen = $3E4D1B; RGB (27, 77, 62)
  #EnglishLavender = $9583B4; RGB (180, 131, 149)
  #EnglishRed = $524BAB; RGB (171, 75, 82)
  #EnglishViolet = $5C3C56; RGB (86, 60, 92)
  #EtonBlue = $A2C896; RGB (150, 200, 162)
  #Eucalyptus = $A8D744; RGB (68, 215, 168)
  #Fallow = $6B9AC1; RGB (193, 154, 107)
  #FaluRed = $181880; RGB (128, 24, 24)
  #Fandango = $8933B5; RGB (181, 51, 137)
  #FandangoPink = $8552DE; RGB (222, 82, 133)
  #FashionFuchsia = $A100F4; RGB (244, 0, 161)
  #Fawn = $70AAE5; RGB (229, 170, 112)
  #Feldgrau = $535D4D; RGB (77, 93, 83)
  #Feldspar = $B1D5FD; RGB (253, 213, 177)
  #FernGreen = $42794F; RGB (79, 121, 66)
  #FerrariRed = $0028FF; RGB (255, 40, 0)
  #FieldDrab = $1E546C; RGB (108, 84, 30)
  #Firebrick = $2222B2; RGB (178, 34, 34)
  #FireEngineRed = $2920CE; RGB (206, 32, 41)
  #Flame = $2258E2; RGB (226, 88, 34)
  #FlamingoPink = $AC8EFC; RGB (252, 142, 172)
  #Flattery = $23446B; RGB (107, 68, 35)
  #Flavescent = $8EE9F7; RGB (247, 233, 142)
  #Flax = $82DCEE; RGB (238, 220, 130)
  #Flirt = $6D00A2; RGB (162, 0, 109)
  #FloralWhite = $F0FAFF; RGB (255, 250, 240)
  #FluorescentOrange = $00BFFF; RGB (255, 191, 0)
  #FluorescentPink = $9314FF; RGB (255, 20, 147)
  #FluorescentYellow = $00FFCC; RGB (204, 255, 0)
  #Folly = $4F00FF; RGB (255, 0, 79)
  #ForestGreen_Traditional = $214401; RGB (1, 68, 33)
  #ForestGreen_Web = $228B22; RGB (34, 139, 34)
  #FrenchBeige = $5B7BA6; RGB (166, 123, 91)
  #FrenchBistre = $4D6D85; RGB (133, 109, 77)
  #FrenchBlue = $BB7200; RGB (0, 114, 187)
  #FrenchFuchsia = $923FFD; RGB (253, 63, 146)
  #FrenchLilac = $8E6086; RGB (134, 96, 142)
  #FrenchLime = $38FD9E; RGB (158, 253, 56)
  #FrenchMauve = $D473D4; RGB (212, 115, 212)
  #FrenchPink = $9E6CFD; RGB (253, 108, 158)
  #FrenchPlum = $531481; RGB (129, 20, 83)
  #FrenchPuce = $09164E; RGB (78, 22, 9)
  #FrenchRaspberry = $482CC7; RGB (199, 44, 72)
  #FrenchRose = $8A4AF6; RGB (246, 74, 138)
  #FrenchSkyBlue = $FEB577; RGB (119, 181, 254)
  #FrenchViolet = $CE0688; RGB (136, 6, 206)
  #FrenchWine = $441EAC; RGB (172, 30, 68)
  #FreshAir = $FFE7A6; RGB (166, 231, 255)
  #Fuchsia = $FF00FF; RGB (255, 0, 255)
  #Fuchsia_Crayola = $C154C1; RGB (193, 84, 193)
  #FuchsiaPink = $FF77FF; RGB (255, 119, 255)
  #FuchsiaPurple = $7B39CC; RGB (204, 57, 123)
  #FuchsiaRose = $7543C7; RGB (199, 67, 117)
  #Fulvous = $0084E4; RGB (228, 132, 0)
  #FuzzyWuzzy = $6666CC; RGB (204, 102, 102)
  #Gainsboro = $DCDCDC; RGB (220, 220, 220)
  #Gamboge = $0F9BE4; RGB (228, 155, 15)
  #GambogeOrange_Brown = $006699; RGB (153, 102, 0)
  #GenericViridian = $667F00; RGB (0, 127, 102)
  #GhostWhite = $FFF8F8; RGB (248, 248, 255)
  #GiantsOrange = $1D5AFE; RGB (254, 90, 29)
  #Grussrel = $0065B0; RGB (176, 101, 0)
  #Glaucous = $B68260; RGB (96, 130, 182)
  #Glitter = $FAE8E6; RGB (230, 232, 250)
  #GOGreen = $66AB00; RGB (0, 171, 102)
  #Gold_Metallic = $37AFD4; RGB (212, 175, 55)
  #Gold_Web_Golden = $00D7FF; RGB (255, 215, 0)
  #GoldFusion = $4E7585; RGB (133, 117, 78)
  #GoldenBrown = $156599; RGB (153, 101, 21)
  #GoldenPoppy = $00C2FC; RGB (252, 194, 0)
  #GoldenYellow = $00DFFF; RGB (255, 223, 0)
  #Goldenrod = $20A5DA; RGB (218, 165, 32)
  #GrannySmithApple = $A0E4A8; RGB (168, 228, 160)
  #Grape = $A82D6F; RGB (111, 45, 168)
  #Gray = $808080; RGB (128, 128, 128)
  #Gray_HTML_CSSGray = $808080; RGB (128, 128, 128)
  #Gray_X11Gray = $BEBEBE; RGB (190, 190, 190)
  #GrayAsparagus = $455946; RGB (70, 89, 69)
  #GrayBlue = $AC928C     ; RGB (140, 146, 172)
  #GrayTeaGreen = $D8F3C9
  #Green_ColorWheel_X11Green = $00FF00; RGB (0, 255, 0)
  #Green_Crayola = $78AC1C; RGB (28, 172, 120)
  #Green_HTML_CSSColor = $008000; RGB (0, 128, 0)
  #Green_Munsell = $77A800; RGB (0, 168, 119)
  #Green_NCS = $6B9F00; RGB (0, 159, 107)
  #Green_Pantone = $43AD00; RGB (0, 173, 67)
  #Green_Pigment = $50A500; RGB (0, 165, 80)
  #Green_RYB = $32B066; RGB (102, 176, 50)
  #GreenBlue = $B46411; RGB (17, 100, 180)
  #GreenCyan = $669900; RGB (0, 153, 102)
  #GreenYellow = $2FFFAD; RGB (173, 255, 47)
  #Grizzly = $185888; RGB (136, 88, 24)
  #Grullo = $869AA9; RGB (169, 154, 134)
  #GuppieGreen = $7FFF00; RGB (0, 255, 127)
  #HalayaUbe = $543866; RGB (102, 56, 84)
  #HanBlue = $CF6C44; RGB (68, 108, 207)
  #HanPurple = $FA1852; RGB (82, 24, 250)
  #HansaYellow = $6BD6E9; RGB (233, 214, 107)
  #Harlequin = $00FF3F; RGB (63, 255, 0)
  #HarlequinGreen = $18CB46; RGB (70, 203, 24)
  #HarvardCrimson = $1600C9; RGB (201, 0, 22)
  #HarvestGold = $0091DA; RGB (218, 145, 0)
  #HeartGold = $008080; RGB (128, 128, 0)
  #Heliotrope = $FF73DF; RGB (223, 115, 255)
  #HeliotropeGray = $A998AA; RGB (170, 152, 169)
  #HeliotropeMagenta = $BB00AA; RGB (170, 0, 187)
  #HollywoodCerise = $A100F4; RGB (244, 0, 161)
  #Honeydew = $F0FFF0; RGB (240, 255, 240)
  #HonoluluBlue = $B06D00; RGB (0, 109, 176)
  #HookersGreen = $6B7949; RGB (73, 121, 107)
  #HotMagenta = $CE1DFF; RGB (255, 29, 206)
  #HotPink = $B469FF; RGB (255, 105, 180)
  #HunterGreen = $3B5E35; RGB (53, 94, 59)
  #Iceberg = $D2A671; RGB (113, 166, 210)
  #Icterine = $5EF7FC; RGB (252, 247, 94)
  #IlluminatingEmerald = $779131; RGB (49, 145, 119)
  #Imperial = $6B2F60; RGB (96, 47, 107)
  #ImperialBlue = $952300; RGB (0, 35, 149)
  #ImperialPurple = $3C0266; RGB (102, 2, 60)
  #ImperialRed = $3929ED; RGB (237, 41, 57)
  #Inchworm = $5DECB2; RGB (178, 236, 93)
  #Independence = $6D514C; RGB (76, 81, 109)
  #IndiaGreen = $088813; RGB (19, 136, 8)
  #IndianRed = $5C5CCD; RGB (205, 92, 92)
  #IndianYellow = $57A8E3; RGB (227, 168, 87)
  #Indigo = $FF006F; RGB (111, 0, 255)
  #IndigoDye = $921F09; RGB (9, 31, 146)
  #Indigo_Web = $82004B; RGB (75, 0, 130)
  #InternationalKleinBlue = $A72F00; RGB (0, 47, 167)
  #InternationalOrange_Aerospace = $004FFF; RGB (255, 79, 0)
  #InternationalOrange_Engineering = $0C16BA; RGB (186, 22, 12)
  #InternationalOrange_GoldenGateBridge = $2C36C0; RGB (192, 54, 44)
  #InternationalOrange = $FF5900
  #Iris = $CF4F5A; RGB (90, 79, 207)
  #Irresistible = $6C44B3; RGB (179, 68, 108)
  #Isabelline = $ECF0F4; RGB (244, 240, 236)
  #IslamicGreen = $009000; RGB (0, 144, 0)
  #ItalianSkyBlue = $FFFFB2; RGB (178, 255, 255)
  #Ivory = $F0FFFF; RGB (255, 255, 240)
  #Jade = $6BA800; RGB (0, 168, 107)
  #JapaneseCarmine = $33299D; RGB (157, 41, 51)
  #JapaneseIndigo = $484326; RGB (38, 67, 72)
  #JapaneseViolet = $56325B; RGB (91, 50, 86)
  #Jasmine = $7EDEF8; RGB (248, 222, 126)
  #Jasper = $3E3BD7; RGB (215, 59, 62)
  #JazzberryJam = $5E0BA5; RGB (165, 11, 94)
  #JellyBean = $4E61DA; RGB (218, 97, 78)
  #Jet = $343434; RGB (52, 52, 52)
  #Jonquil = $16CAF4; RGB (244, 202, 22)
  #JordyBlue = $F1B98A; RGB (138, 185, 241)
  #JuneBud = $57DABD; RGB (189, 218, 87)
  #JungleGreen = $87AB29; RGB (41, 171, 135)
  #KellyGreen = $17BB4C; RGB (76, 187, 23)
  #KenyanCopper = $051C7C; RGB (124, 28, 5)
  #Keppel = $9EB03A; RGB (58, 176, 158)
  #Jawad_ChickenColor_HTML_CSS_Khaki = $91B0C3; RGB (195, 176, 145)
  #Khaki_X11_LightKhaki = $8CE6F0             ; RGB (240, 230, 140)
  #Khaki = $C3B091
  #Kobe = $172D88; RGB (136, 45, 23)
  #Kobi = $C49FE7; RGB (231, 159, 196)
  #KombuGreen = $304235; RGB (53, 66, 48)
  #KUCrimson = $0D00E8; RGB (232, 0, 13)
  #LaSalleGreen = $307808; RGB (8, 120, 48)
  #LanguidLavender = $DDCAD6; RGB (214, 202, 221)
  #LapisLazuli = $9C6126; RGB (38, 97, 156)
  #LaserLemon = $66FFFF; RGB (255, 255, 102)
  #LaurelGreen = $9DBAA9; RGB (169, 186, 157)
  #Lava = $2010CF; RGB (207, 16, 32)
  #Lavender_Floral = $DC7EB5; RGB (181, 126, 220)
  #Lavender = $B378D3
  #Lavender_Web = $FAE6E6; RGB (230, 230, 250)
  #LavenderBlue = $FFCCCC; RGB (204, 204, 255)
  #LavenderBlush = $F5F0FF; RGB (255, 240, 245)
  #LavenderGray = $D0C3C4; RGB (196, 195, 208)
  #LavenderIndigo = $EB5794; RGB (148, 87, 235)
  #LavenderMagenta = $EE82EE; RGB (238, 130, 238)
  #LavenderMist = $FAE6E6; RGB (230, 230, 250)
  #LavenderPink = $D2AEFB; RGB (251, 174, 210)
  #LavenderPurple = $B67B96; RGB (150, 123, 182)
  #LavenderRose = $E3A0FB; RGB (251, 160, 227)
  #LawnGreen = $00FC7C; RGB (124, 252, 0)
  #Lemon = $00F7FF; RGB (255, 247, 0)
  #LemonChiffon = $CDFAFF; RGB (255, 250, 205)
  #LemonCurry = $1DA0CC; RGB (204, 160, 29)
  #LemonGlacier = $00FFFD; RGB (253, 255, 0)
  #LemonLime = $00FFE3; RGB (227, 255, 0)
  #LemonMeringue = $BEEAF6; RGB (246, 234, 190)
  #LemonYellow = $4FF4FF; RGB (255, 244, 79)
  #Lenurple = $D893BA; RGB (186, 147, 216)
  #Licorice = $10111A; RGB (26, 17, 16)
  #Liberty = $A75A54; RGB (84, 90, 167)
  #LightApricot = $B1D5FD; RGB (253, 213, 177)
  #LightBlue = $E6D8AD; RGB (173, 216, 230)
  #LightBrilliantRed = $2e2efe; RGB (254, 46, 46)
  #LightBrown = $1D65B5; RGB (181, 101, 29)
  #LightCarminePink = $7167E6; RGB (230, 103, 113)
  #LightCobaltBlue = $E0AC88; RGB (136, 172, 224)
  #LightCoral = $8080F0; RGB (240, 128, 128)
  #LightCornflowerBlue = $EACC93; RGB (147, 204, 234)
  #LightCrimson = $9169F5; RGB (245, 105, 145)
  #LightCyan = $FFFFE0; RGB (224, 255, 255)
  #LightDeepPink = $CD5CFF; RGB (255, 92, 205)
  #LightFrenchBeige = $7FADC8; RGB (200, 173, 127)
  #LightFuchsiaPink = $EF84F9; RGB (249, 132, 239)
  #LightGoldenrodYellow = $D2FAFA; RGB (250, 250, 210)
  #LightGray = $D3D3D3; RGB (211, 211, 211)
  #LightGrayishMagenta = $CC99CC; RGB (204, 153, 204)
  #LightGreen = $90EE90; RGB (144, 238, 144)
  #LightHotPink = $DEB3FF; RGB (255, 179, 222)
  #LightKhaki = $8CE6F0  ; RGB (240, 230, 140)
  #LightMagenta = $FF42F9
  #LightMediumOrchid = $CB9BD3; RGB (211, 155, 203)
  #LightMossGreen = $ADDFAD; RGB (173, 223, 173)
  #LightOrchid = $D7A8E6; RGB (230, 168, 215)
  #LightPastelPurple = $D99CB1; RGB (177, 156, 217)
  #LightPink = $C1B6FF; RGB (255, 182, 193)
  #LightRedOchre = $5174E9; RGB (233, 116, 81)
  #LightRed = $FFCCCB
  #LightSalmon = $7AA0FF; RGB (255, 160, 122)
  #LightSalmonPink = $9999FF; RGB (255, 153, 153)
  #LightSeaGreen = $AAB220; RGB (32, 178, 170)
  #LightSkyBlue = $FACE87; RGB (135, 206, 250)
  #LightSlateGray = $998877; RGB (119, 136, 153)
  #LightSteelBlue = $DEC4B0; RGB (176, 196, 222)
  #LightTaupe = $6D8BB3; RGB (179, 139, 109)
  #LightThulianPink = $AC8FE6; RGB (230, 143, 172)
  #LightYellow = $E0FFFF; RGB (255, 255, 224)
  #Lilac = $C8A2C8      ; RGB (200, 162, 200)
  #Lime = $99FF00
  #Lime_ColorWheel = $00FFBF; RGB (191, 255, 0)
  #Lime_Web_X11Green = $00FF00; RGB (0, 255, 0)
  #LimeGreen = $32CD32; RGB (50, 205, 50)
  #Limerick = $09C29D; RGB (157, 194, 9)
  #LincolnGreen = $055919; RGB (25, 89, 5)
  #Linen = $E6F0FA; RGB (250, 240, 230)
  #Lion = $6B9AC1; RGB (193, 154, 107)
  #LiseranPurple = $A16FDE; RGB (222, 111, 161)
  #LittleBoyBlue = $DCA06C; RGB (108, 160, 220)
  #Liver = $474C67; RGB (103, 76, 71)
  #Liver_Dogs = $296DB8; RGB (184, 109, 41)
  #Liver_Organ = $1F2E6C; RGB (108, 46, 31)
  #LiverChestnut = $567498; RGB (152, 116, 86)
  #Livid = $CC9966; RGB (102, 153, 204)
  #Lumber = $CDE4FF; RGB (255, 228, 205)
  #Lust = $2020E6; RGB (230, 32, 32)
  #Magenta = $FF00FF; RGB (255, 0, 255)
  #Magenta_Crayola = $A355FF; RGB (255, 85, 163)
  #Magenta_Dye = $7B1FCA; RGB (202, 31, 123)
  #Magenta_Pantone = $7E41D0; RGB (208, 65, 126)
  #Magenta_Process = $9000FF; RGB (255, 0, 144)
  #MagentaHaze = $76459F; RGB (159, 69, 118)
  #MagentaPink = $8B33CC; RGB (204, 51, 139)
  #MagicMint = $D1F0AA; RGB (170, 240, 209)
  #Magnolia = $FFF4F8; RGB (248, 244, 255)
  #Mahogany = $0040C0; RGB (192, 64, 0)
  #Maize = $5DECFB; RGB (251, 236, 93)
  #MajorelleBlue = $DC5060; RGB (96, 80, 220)
  #Malachite = $51DA0B; RGB (11, 218, 81)
  #Manatee = $AA9A97; RGB (151, 154, 170)
  #MangoTango = $4382FF; RGB (255, 130, 67)
  #Mantis = $65C374; RGB (116, 195, 101)
  #MardiGras = $850088; RGB (136, 0, 133)
  #Maroon = $800000
  #Maroon_Crayola = $4821C3; RGB (195, 33, 72)
  #Maroon_HTML_CSS = $000080; RGB (128, 0, 0)
  #Maroon_X11 = $6030B0; RGB (176, 48, 96)
  #Mauve = $FFB0E0; RGB (224, 176, 255)
  #MauveTaupe = $6D5F91; RGB (145, 95, 109)
  #Mauvelous = $AA98EF; RGB (239, 152, 170)
  #MayGreen = $41914C; RGB (76, 145, 65)
  #MayaBlue = $FBC273; RGB (115, 194, 251)
  #MeatBrown = $3BB7E5; RGB (229, 183, 59)
  #MediumAquamarine = $AADD66; RGB (102, 221, 170)
  #MediumBlue = $CD0000; RGB (0, 0, 205)
  #MediumCandyAppleRed = $2C06E2; RGB (226, 6, 44)
  #MediumCarmine = $3540AF; RGB (175, 64, 53)
  #MediumChampagne = $ABE5F3; RGB (243, 229, 171)
  #MediumElectricBlue = $965003; RGB (3, 80, 150)
  #MediumJungleGreen = $2D351C; RGB (28, 53, 45)
  #MediumLavenderMagenta = $DDA0DD; RGB (221, 160, 221)
  #MediumOrchid = $D355BA; RGB (186, 85, 211)
  #MediumPersianBlue = $A56700; RGB (0, 103, 165)
  #MediumPurple = $DB7093; RGB (147, 112, 219)
  #MediumRedViolet = $8533BB; RGB (187, 51, 133)
  #MediumRuby = $6940AA; RGB (170, 64, 105)
  #MediumSeaGreen = $71B33C; RGB (60, 179, 113)
  #MediumSkyBlue = $EBDA80; RGB (128, 218, 235)
  #MediumSlateBlue = $EE687B; RGB (123, 104, 238)
  #MediumSpringBud = $87DCC9; RGB (201, 220, 135)
  #MediumSpringGreen = $9AFA00; RGB (0, 250, 154)
  #MediumTaupe = $474C67; RGB (103, 76, 71)
  #MediumTurquoise = $CCD148; RGB (72, 209, 204)
  #MediumTuscanRed = $3B4479; RGB (121, 68, 59)
  #MediumVermilion = $3B60D9; RGB (217, 96, 59)
  #MediumVioletRed = $8515C7; RGB (199, 21, 133)
  #MellowApricot = $78B8F8; RGB (248, 184, 120)
  #MellowYellow = $7EDEF8; RGB (248, 222, 126)
  #Melon = $B4BCFD; RGB (253, 188, 180)
  #MetallicSeaweed = $8C7E0A; RGB (10, 126, 140)
  #MetallicSunburst = $387C9C; RGB (156, 124, 56)
  #MexicanPink = $7C00E4; RGB (228, 0, 124)
  #MidnightBlue = $701919; RGB (25, 25, 112)
  #MidnightGreen_EagleGreen = $534900; RGB (0, 73, 83)
  #MikadoYellow = $0CC4FF; RGB (255, 196, 12)
  #Mindaro = $88F9E3; RGB (227, 249, 136)
  #Ming = $7D7436; RGB (54, 116, 125)
  #Mint = $89B43E; RGB (62, 180, 137)
  #MintCream = $FAFFF5; RGB (245, 255, 250)
  #MintGreen = $98FF98; RGB (152, 255, 152)
  #MistyRose = $E1E4FF; RGB (255, 228, 225)
  #Moccasin = $D7EBFA; RGB (250, 235, 215)
  #ModeBeige = $177196; RGB (150, 113, 23)
  #MoneyGreen = $065C27
  #MoonstoneBlue = $C2A973; RGB (115, 169, 194)
  #MordantRed19 = $000CAE; RGB (174, 12, 0)
  #MossGreen = $5B9A8A; RGB (138, 154, 91)
  #MountainMeadow = $8FBA30; RGB (48, 186, 143)
  #MountbattenPink = $8D7A99; RGB (153, 122, 141)
  #Monza = $C90014
  #MSUGreen = $3B4518; RGB (24, 69, 59)
  #MughalGreen = $306030; RGB (48, 96, 48)
  #Mulberry = $8C4BC5; RGB (197, 75, 140)
  #Mustard = $58DBFF; RGB (255, 219, 88)
  #MyrtleGreen = $737831; RGB (49, 120, 115)
  #NadeshikoPink = $C6ADF6; RGB (246, 173, 198)
  #NapierGreen = $00802A; RGB (42, 128, 0)
  #NaplesYellow = $5EDAFA; RGB (250, 218, 94)
  #NavajoWhite = $ADDEFF; RGB (255, 222, 173)
  #Navy = $800000; RGB (0, 0, 128)
  #NavyPurple = $EB5794; RGB (148, 87, 235)
  #NeonCarrot = $43A3FF; RGB (255, 163, 67)
  #NeonFuchsia = $6441FE; RGB (254, 65, 100)
  #NeonGreen = $14FF39; RGB (57, 255, 20)
  #NewCar = $C64F21; RGB (33, 79, 198)
  #NewYorkPink = $7F83D7; RGB (215, 131, 127)
  #NonPhotoBlue = $EDDDA4; RGB (164, 221, 237)
  #NorthTexasGreen = $339005; RGB (5, 144, 51)
  #Nyanza = $DBFFE9; RGB (233, 255, 219)
  #OceanBoatBlue = $BE7700; RGB (0, 119, 190)
  #Ochre = $2277CC; RGB (204, 119, 34)
  #OfficeGreen = $008000; RGB (0, 128, 0)
  #OldBurgundy = $2E3043; RGB (67, 48, 46)
  #OldGold = $3BB5CF; RGB (207, 181, 59)
  #OldHeliotrope = $5C3C56; RGB (86, 60, 92)
  #OldLace = $E6F5FD; RGB (253, 245, 230)
  #OldLavender = $786879; RGB (121, 104, 120)
  #OldMauve = $473167; RGB (103, 49, 71)
  #OldMossGreen = $367E86; RGB (134, 126, 54)
  #OldRose = $8180C0; RGB (192, 128, 129)
  #OldSilver = $828484; RGB (132, 132, 130)
  #Olive = $008080    ; RGB (128, 128, 0)
  #OliveDrab = $6b8e23
  #OliveDrab_No3 = $238E6B; RGB (107, 142, 35)
  #OliveDrabNo7 = $1F343C; RGB (60, 52, 31)
  #Olivine = $73B99A; RGB (154, 185, 115)
  #Onyx = $393835; RGB (53, 56, 57)
  #OperaMauve = $A784B7; RGB (183, 132, 167)
  #Orange = $FFA500
  #Orange_ColorWheel = $007FFF; RGB (255, 127, 0)
  #Orange_Crayola = $3875FF; RGB (255, 117, 56)
  #Orange_Pantone = $0058FF; RGB (255, 88, 0)
  #Orange_RYB = $0299FB; RGB (251, 153, 2)
  #Orange_Web = $00A5FF; RGB (255, 165, 0)
  #OrangePeel = $009FFF; RGB (255, 159, 0)
  #OrangeRed = $0045FF; RGB (255, 69, 0)
  #Orchid = $D670DA; RGB (218, 112, 214)
  #OrchidPink = $CDBDF2; RGB (242, 189, 205)
  #OriolesOrange = $144FFB; RGB (251, 79, 20)
  #OtterBrown = $214365; RGB (101, 67, 33)
  #OuterSpace = $4C4A41; RGB (65, 74, 76)
  #OutrageousOrange = $4A6EFF; RGB (255, 110, 74)
  #OxfordBlue = $472100; RGB (0, 33, 71)
  #OUCrimsonRed = $000099; RGB (153, 0, 0)
  #PakistanGreen = $006600; RGB (0, 102, 0)
  #PalatinateBlue = $E23B27; RGB (39, 59, 226)
  #PalatinatePurple = $602868; RGB (104, 40, 96)
  #PaleAqua = $E6D4BC; RGB (188, 212, 230)
  #PaleBlue = $EEEEAF; RGB (175, 238, 238)
  #PaleBrown = $547698; RGB (152, 118, 84)
  #PaleCarmine = $3540AF; RGB (175, 64, 53)
  #PaleCerulean = $E2C49B; RGB (155, 196, 226)
  #PaleChestnut = $AFADDD; RGB (221, 173, 175)
  #PaleCopper = $678ADA; RGB (218, 138, 103)
  #PaleCornflowerBlue = $EFCDAB; RGB (171, 205, 239)
  #PaleCyan = $F8D387; RGB (135, 211, 248)
  #PaleGold = $8ABEE6; RGB (230, 190, 138)
  #PaleGoldenrod = $AAE8EE; RGB (238, 232, 170)
  #PaleGreen = $98FB98; RGB (152, 251, 152)
  #PaleLavender = $FFD0DC; RGB (220, 208, 255)
  #PaleMagenta = $E584F9; RGB (249, 132, 229)
  #PaleMagentaPink = $cc99ff; RGB (255, 153, 204)
  #PalePink = $DDDAFA; RGB (250, 218, 221)
  #PalePlum = $DDA0DD; RGB (221, 160, 221)
  #PaleRedViolet = $9370DB; RGB (219, 112, 147)
  #PaleRobinEggBlue = $D1DE96; RGB (150, 222, 209)
  #PaleSilver = $BBC0C9; RGB (201, 192, 187)
  #PaleSpringBud = $BDEBEC; RGB (236, 235, 189)
  #PaleTaupe = $7E98BC; RGB (188, 152, 126)
  #PaleTurquoise = $EEEEAF; RGB (175, 238, 238)
  #PaleViolet = $FF99CC; RGB (204, 153, 255)
  #PaleVioletRed = $9370DB; RGB (219, 112, 147)
  #PansyPurple = $4A1878; RGB (120, 24, 74)
  #PaoloVeroneseGreen = $7D9B00; RGB (0, 155, 125)
  #PapayaWhip = $D5EFFF; RGB (255, 239, 213)
  #ParadisePink = $623EE6; RGB (230, 62, 98)
  #ParisGreen = $78C850; RGB (80, 200, 120)
  #PastelBlue = $CFC6AE; RGB (174, 198, 207)
  #PastelBrown = $536983; RGB (131, 105, 83)
  #PastelGray = $C4CFCF; RGB (207, 207, 196)
  #PastelGreen = $77DD77; RGB (119, 221, 119)
  #PastelMagenta = $C29AF4; RGB (244, 154, 194)
  #PastelOrange = $47B3FF; RGB (255, 179, 71)
  #PastelPink = $A4A5DE; RGB (222, 165, 164)
  #PastelPurple = $B59EB3; RGB (179, 158, 181)
  #PastelRed = $6169FF; RGB (255, 105, 97)
  #PastelViolet = $C999CB; RGB (203, 153, 201)
  #PastelYellow = $96FDFD; RGB (253, 253, 150)
  #Patriarch = $800080   ; RGB (128, 0, 128)
  #Purple = #Patriarch
  #PaynesGrey = $786853; RGB (83, 104, 120)
  #Peach = $B4E5FF; RGB (255, 229, 180)
  #Peach_ = $A4CBFF; RGB (255, 203, 164)
  #PeachOrange = $99CCFF; RGB (255, 204, 153)
  #PeachPuff = $B9DAFF; RGB (255, 218, 185)
  #PeachYellow = $ADDFFA; RGB (250, 223, 173)
  #Pear = $31E2D1; RGB (209, 226, 49)
  #Pearl = $C8E0EA; RGB (234, 224, 200)
  #PearlAqua = $C0D888; RGB (136, 216, 192)
  #PearlyPurple = $A268B7; RGB (183, 104, 162)
  #Peridot = $00E2E6; RGB (230, 226, 0)
  #Periwinkle = $FFCCCC; RGB (204, 204, 255)
  #PersianBlue = $BB391C; RGB (28, 57, 187)
  #PersianGreen = $93A600; RGB (0, 166, 147)
  #PersianIndigo = $7A1232; RGB (50, 18, 122)
  #PersianOrange = $5890D9; RGB (217, 144, 88)
  #PersianPink = $BE7FF7; RGB (247, 127, 190)
  #PersianPlum = $1C1C70; RGB (112, 28, 28)
  #PersianRed = $3333CC; RGB (204, 51, 51)
  #PersianRose = $A228FE; RGB (254, 40, 162)
  #Persimmon = $0058EC; RGB (236, 88, 0)
  #Peru = $3F85CD; RGB (205, 133, 63)
  #Phlox = $FF00DF; RGB (223, 0, 255)
  #PhthaloBlue = $890F00; RGB (0, 15, 137)
  #PhthaloGreen = $243512; RGB (18, 53, 36)
  #PictonBlue = $E8B145; RGB (69, 177, 232)
  #PictorialCarmine = $4E0BC3; RGB (195, 11, 78)
  #PiggyPink = $E6DDFD; RGB (253, 221, 230)
  #PineGreen = $6F7901; RGB (1, 121, 111)
  #Pineapple = $5C3C56; RGB (86, 60, 92)
  #Pink = $CBC0FF; RGB (255, 192, 203)
  #Pink_Pantone = $9448D7; RGB (215, 72, 148)
  #PinkLace = $F4DDFF; RGB (255, 221, 244)
  #PinkLavender = $D1B2D8; RGB (216, 178, 209)
  #PinkOrange = $6699FF; RGB (255, 153, 102)
  #PinkPearl = $CFACE7; RGB (231, 172, 207)
  #PinkRaspberry = $360098; RGB (152, 0, 54)
  #PinkSherbet = $A78FF7; RGB (247, 143, 167)
  #Pistachio = $72C593; RGB (147, 197, 114)
  #Platinum = $E2E4E5; RGB (229, 228, 226)
  #Plum = $85458E; RGB (142, 69, 133)
  #Plum_Web = $DDA0DD; RGB (221, 160, 221)
  #PompAndPower = $8E6086; RGB (134, 96, 142)
  #Popstar = $624FBE; RGB (190, 79, 98)
  #PortlandOrange = $365AFF; RGB (255, 90, 54)
  #PowderBlue = $E6E0B0; RGB (176, 224, 230)
  #PrincetonOrange = $2580F5; RGB (245, 128, 37)
  #Prune = $1C1C70; RGB (112, 28, 28)
  #PrussianBlue = $533100; RGB (0, 49, 83)
  #PsychedelicPurple = $FF00DF; RGB (223, 0, 255)
  #Puce = $9988CC; RGB (204, 136, 153)
  #PuceRed = $372F72; RGB (114, 47, 55)
  #PullmanBrown_UPSBrown = $174164; RGB (100, 65, 23)
  #PullmanGreen = $1C333B; RGB (59, 51, 28)
  #Pumpkin = $1875FF; RGB (255, 117, 24)
  #Purple_HTML = $800080; RGB (128, 0, 128)
  #Purple_Munsell = $C5009F; RGB (159, 0, 197)
  #Purple_X11 = $F020A0; RGB (160, 32, 240)
  #PurpleHeart = $9C3569; RGB (105, 53, 156)
  #PurpleMountainMajesty = $B67896; RGB (150, 120, 182)
  #PurpleNavy = $80514E; RGB (78, 81, 128)
  #PurplePizzazz = $DA4EFE; RGB (254, 78, 218)
  #PurpleTaupe = $4D4050; RGB (80, 64, 77)
  #Purpureus = $AE4E9A; RGB (154, 78, 174)
  #Quartz = $4F4851; RGB (81, 72, 79)
  #QueenBlue = $956B43; RGB (67, 107, 149)
  #QueenPink = $D7CCE8; RGB (232, 204, 215)
  #QuinacridoneMagenta = $593A8E; RGB (142, 58, 89)
  #Rackley = $A88A5D; RGB (93, 138, 168)
  #RadicalRed = $5E35FF; RGB (255, 53, 94)
  #Rajah = $60ABFB; RGB (251, 171, 96)
  #Raspberry = $5D0BE3; RGB (227, 11, 93)
  #RaspberryGlace = $6D5F91; RGB (145, 95, 109)
  #RaspberryPink = $9850E2; RGB (226, 80, 152)
  #RaspberryRose = $6C44B3; RGB (179, 68, 108)
  #RawUmber = $446682; RGB (130, 102, 68)
  #RazzleDazzleRose = $CC33FF; RGB (255, 51, 204)
  #Razzmatazz = $6B25E3; RGB (227, 37, 107)
  #RazzmicBerry = $854E8D; RGB (141, 78, 133)
  #RebeccaPurple = $993366; RGB (102, 51, 153)
  #Red_Crayola = $4D20EE; RGB (238, 32, 77)
  #Red_Munsell = $3C00F2; RGB (242, 0, 60)
  #Red_NCS = $3302C4; RGB (196, 2, 51)
  #Red_Pantone = $3929ED; RGB (237, 41, 57)
  #Red_Pigment = $241CED; RGB (237, 28, 36)
  #Red_RYB = $1227FE; RGB (254, 39, 18)
  #RedBrown = $2A2AA5; RGB (165, 42, 42)
  #RedDevil = $110186; RGB (134, 1, 17)
  #RedOrange = $4953FF; RGB (255, 83, 73)
  #RedPurple = $7800E4; RGB (228, 0, 120)
  #RedViolet = $8515C7; RGB (199, 21, 133)
  #Redwood = $525AA4  ; RGB (164, 90, 82)
  #Reef = $C7BAA7
  #Regalia = $802D52; RGB (82, 45, 128)
  #RegistrationBlack = $000000; RGB (0, 0, 0)
  #ResolutionBlue = $872300; RGB (0, 35, 135)
  #Rhythm = $967677; RGB (119, 118, 150)
  #RichBlack_Typical = $000000; RGB (0, 0, 0)
  #RichBlack_FOGRA29 = $130B01; RGB (1, 11, 19)
  #RichBlack_FOGRA39 = $030201; RGB (1, 2, 3)
  #RichBrilliantLavender = $FEA7F1; RGB (241, 167, 254)
  #RichCarmine = $4000D7; RGB (215, 0, 64)
  #RichElectricBlue = $D09208; RGB (8, 146, 208)
  #RichLavender = $CF6BA7; RGB (167, 107, 207)
  #RichLilac = $D266B6; RGB (182, 102, 210)
  #RichMaroon = $6030B0; RGB (176, 48, 96)
  #RifleGreen = $384C44; RGB (68, 76, 56)
  #RoastCoffee = $414270; RGB (112, 66, 65)
  #RobinEggBlue = $CCCC00; RGB (0, 204, 204)
  #RocketMetallic = $807F8A; RGB (138, 127, 128)
  #RomanSilver = $968983; RGB (131, 137, 150)
  #Rose = $7F00FF; RGB (255, 0, 127)
  #RoseBonbon = $9E42F9; RGB (249, 66, 158)
  #RoseEbony = $464867; RGB (103, 72, 70)
  #RoseGold = $796EB7; RGB (183, 110, 121)
  #RoseMadder = $3626E3; RGB (227, 38, 54)
  #RosePink = $CC66FF; RGB (255, 102, 204)
  #RoseQuartz = $A998AA; RGB (170, 152, 169)
  #RoseRed = $561EC2; RGB (194, 30, 86)
  #RoseTaupe = $5D5D90; RGB (144, 93, 93)
  #RoseVale = $524EAB; RGB (171, 78, 82)
  #Rosewood = $0B0065; RGB (101, 0, 11)
  #RossoCorsa = $0000D4; RGB (212, 0, 0)
  #RosyBrown = $8F8FBC; RGB (188, 143, 143)
  #RoyalAzure = $A83800; RGB (0, 56, 168)
  #RoyalBlue = $662300; RGB (0, 35, 102)
  #RoyalBlue_ = $E16941; RGB (65, 105, 225)
  #RoyalFuchsia = $922CCA; RGB (202, 44, 146)
  #RoyalPurple = $A95178; RGB (120, 81, 169)
  #RoyalYellow = $5EDAFA; RGB (250, 218, 94)
  #Ruber = $7646CE; RGB (206, 70, 118)
  #RubineRed = $5600D1; RGB (209, 0, 86)
  #Ruby = $5F11E0; RGB (224, 17, 95)
  #RubyRed = $1E119B; RGB (155, 17, 30)
  #Ruddy = $2800FF; RGB (255, 0, 40)
  #RuddyBrown = $2865BB; RGB (187, 101, 40)
  #RuddyPink = $968EE1; RGB (225, 142, 150)
  #Rufous = $071CA8; RGB (168, 28, 7)
  #Russet = $1B4680; RGB (128, 70, 27)
  #RussianGreen = $679267; RGB (103, 146, 103)
  #RussianViolet = $4D1732; RGB (50, 23, 77)
  #Rust = $0E41B7; RGB (183, 65, 14)
  #RustyRed = $432CDA; RGB (218, 44, 67)
  #SacramentoStateGreen = $3F5600; RGB (0, 86, 63)
  #SaddleBrown = $13458B; RGB (139, 69, 19)
  #SafetyOrange = $0078FF; RGB (255, 120, 0)
  #SafetyOrange_BlazeOrange = $0067FF; RGB (255, 103, 0)
  #SafetyYellow = $02D2EE; RGB (238, 210, 2)
  #Saffron = $30C4F4; RGB (244, 196, 48)
  #Sage = $8AB8BC; RGB (188, 184, 138)
  #StPatricksBlue = $7A2923; RGB (35, 41, 122)
  #Salmon = $7280FA; RGB (250, 128, 114)
  #SalmonPink = $A491FF; RGB (255, 145, 164)
  #Sand = $80B2C2; RGB (194, 178, 128)
  #SandDune = $177196; RGB (150, 113, 23)
  #Sandstorm = $40D5EC; RGB (236, 213, 64)
  #SandyBrown = $60A4F4; RGB (244, 164, 96)
  #SandyTaupe = $177196; RGB (150, 113, 23)
  #Sangria = $0A0092; RGB (146, 0, 10)
  #SapGreen = $2A7D50; RGB (80, 125, 42)
  #Sapphire = $BA520F; RGB (15, 82, 186)
  #SapphireBlue = $A56700; RGB (0, 103, 165)
  #SatinSheenGold = $35A1CB; RGB (203, 161, 53)
  #Scarlet = $0024FF; RGB (255, 36, 0)
  #Scarlet_ = $350EFD; RGB (253, 14, 53)
  #SchaussPink = $AF91FF; RGB (255, 145, 175)
  #SchoolBusYellow = $00D8FF; RGB (255, 216, 0)
  #ScreaminGreen = $7AFF76; RGB (118, 255, 122)
  #SeaBlue = $946900; RGB (0, 105, 148)
  #SeaGreen = $578B2E; RGB (46, 139, 87)
  #SealBrown = $141432; RGB (50, 20, 20)
  #Seashell = $EEF5FF; RGB (255, 245, 238)
  #SelectiveYellow = $00BAFF; RGB (255, 186, 0)
  #Sepia = $144270; RGB (112, 66, 20)
  #Shadow = $5D798A; RGB (138, 121, 93)
  #ShadowBlue = $A58B77; RGB (119, 139, 165)
  #Shampoo = $F1CFFF; RGB (255, 207, 241)
  #ShamrockGreen = $609E00; RGB (0, 158, 96)
  #SheenGreen = $00D48F; RGB (143, 212, 0)
  #ShimmeringBlush = $9586D9; RGB (217, 134, 149)
  #ShockingPink = $C00FFC; RGB (252, 15, 192)
  #ShockingPink_Crayola = $FF6FFF; RGB (255, 111, 255)
  #Sienna = $172D88; RGB (136, 45, 23)
  #Silver = $C0C0C0; RGB (192, 192, 192)
  #SilverChalice = $ACACAC; RGB (172, 172, 172)
  #SilverLakeBlue = $BA895D; RGB (93, 137, 186)
  #SilverPink = $ADAEC4; RGB (196, 174, 173)
  #SilverSand = $C2C1BF; RGB (191, 193, 194)
  #Sinopia = $0B41CB; RGB (203, 65, 11)
  #Skobeloff = $747400; RGB (0, 116, 116)
  #SkyBlue = $EBCE87; RGB (135, 206, 235)
  #SkyMagenta = $AF71CF; RGB (207, 113, 175)
  #SlateBlue = $CD5A6A; RGB (106, 90, 205)
  #SlateGray = $908070; RGB (112, 128, 144)
  #Smalt_DarkPowderBlue = $993300; RGB (0, 51, 153)
  #Smitten = $8641C8; RGB (200, 65, 134)
  #Smoke = $768273; RGB (115, 130, 118)
  #SmokyBlack = $080C10; RGB (16, 12, 8)
  #SmokyTopaz = $413D93; RGB (147, 61, 65)
  #Snow = $FAFAFF; RGB (255, 250, 250)
  #Soap = $EFC8CE; RGB (206, 200, 239)
  #SolidPink = $433889; RGB (137, 56, 67)
  #SonicSilver = $757575; RGB (117, 117, 117)
  #SpartanCrimson = $16139E; RGB (158, 19, 22)
  #SpaceCadet = $51291D; RGB (29, 41, 81)
  #SpanishBistre = $327580; RGB (128, 117, 50)
  #SpanishBlue = $B87000; RGB (0, 112, 184)
  #SpanishCarmine = $4700D1; RGB (209, 0, 71)
  #SpanishCrimson = $4C1AE5; RGB (229, 26, 76)
  #SpanishGray = $989898; RGB (152, 152, 152)
  #SpanishGreen = $509100; RGB (0, 145, 80)
  #SpanishOrange = $0061E8; RGB (232, 97, 0)
  #SpanishPink = $BEBFF7; RGB (247, 191, 190)
  #SpanishRed = $2600E6; RGB (230, 0, 38)
  #SpanishSkyBlue = $FFFF00; RGB (0, 255, 255)
  #SpanishViolet = $82284C; RGB (76, 40, 130)
  #SpanishViridian = $5C7F00; RGB (0, 127, 92)
  #SpicyMix = $4D5f8B; RGB (139, 95, 77)
  #SpiroDiscoBall = $FCC00F; RGB (15, 192, 252)
  #SpringBud = $00FCA7; RGB (167, 252, 0)
  #SpringGreen = $7FFF00; RGB (0, 255, 127)
  #StarCommandBlue = $B87B00; RGB (0, 123, 184)
  #SteelBlue = $B48246; RGB (70, 130, 180)
  #SteelPink = $CC33CC; RGB (204, 51, 204)
  #StilDeGrainYellow = $5EDAFA; RGB (250, 218, 94)
  #Stizza = $000099; RGB (153, 0, 0)
  #Stormcloud = $6A664F; RGB (79, 102, 106)
  #Straw = $6FD9E4; RGB (228, 217, 111)
  #Strawberry = $8D5AFC; RGB (252, 90, 141)
  #Sunglow = $33CCFF; RGB (255, 204, 51)
  #Sunray = $57ABE3; RGB (227, 171, 87)
  #Sunset = $A5D6FA; RGB (250, 214, 165)
  #SunsetOrange = $535EFD; RGB (253, 94, 83)
  #SuperPink = $A96BCF   ; RGB (207, 107, 169)
  #SwampGreen = $A3AE7E
  #Tan = $8CB4D2; RGB (210, 180, 140)
  #Tangelo = $004DF9; RGB (249, 77, 0)
  #Tangerine = $0085F2; RGB (242, 133, 0)
  #TangerineYellow = $00CCFF; RGB (255, 204, 0)
  #TangoPink = $7A71E4; RGB (228, 113, 122)
  #Taupe = $323C48; RGB (72, 60, 50)
  #TaupeGray = $89858B; RGB (139, 133, 137)
  #TeaGreen = $C0F0D0; RGB (208, 240, 192)
  #TeaRose = $7983F8; RGB (248, 131, 121)
  #TeaRose_ = $C2C2F4; RGB (244, 194, 194)
  #Teal = $808000; RGB (0, 128, 128)
  #TealBlue = $887536; RGB (54, 117, 136)
  #TealDeer = $B3E699; RGB (153, 230, 179)
  #TealGreen = $7F8200; RGB (0, 130, 127)
  #Telemagenta = $7634CF; RGB (207, 52, 118)
  #Tenne = $0057CD; RGB (205, 87, 0)
  #TerraCotta = $5B72E2; RGB (226, 114, 91)
  #Thistle = $D8BFD8; RGB (216, 191, 216)
  #ThulianPink = $A16FDE; RGB (222, 111, 161)
  #TickleMePink = $AC89FC; RGB (252, 137, 172)
  #TiffanyBlue = $B5BA0A; RGB (10, 186, 181)
  #TigersEye = $3C8DE0; RGB (224, 141, 60)
  #Timberwolf = $D2D7DB; RGB (219, 215, 210)
  #TitaniumYellow = $00E6EE; RGB (238, 230, 0)
  #Tomato = $4763FF; RGB (255, 99, 71)
  #Toolbox = $C06C74; RGB (116, 108, 192)
  #Topaz = $7CC8FF; RGB (255, 200, 124)
  #TractorRed = $350EFD; RGB (253, 14, 53)
  #TrolleyGrey = $808080; RGB (128, 128, 128)
  #TropicalRainForest = $5E7500; RGB (0, 117, 94)
  #TrueBlue = $CF7300; RGB (0, 115, 207)
  #TuftsBlue = $C17D41; RGB (65, 125, 193)
  #Tulip = $8D87FF; RGB (255, 135, 141)
  #Tumbleweed = $88AADE; RGB (222, 170, 136)
  #TurkishRose = $8172B5; RGB (181, 114, 129)
  #Turquoise = $D0E040; RGB (64, 224, 208)
  #TurquoiseBlue = $EFFF00; RGB (0, 255, 239)
  #TurquoiseGreen = $B4D6A0; RGB (160, 214, 180)
  #Tuscan = $A5D6FA; RGB (250, 214, 165)
  #TuscanBrown = $374E6F; RGB (111, 78, 55)
  #TuscanRed = $48487C; RGB (124, 72, 72)
  #TuscanTan = $5B7BA6; RGB (166, 123, 91)
  #Tuscany = $9999C0; RGB (192, 153, 153)
  #TwilightLavender = $6B498A; RGB (138, 73, 107)
  #TyrianPurple = $3C0266; RGB (102, 2, 60)
  #UABlue = $AA3300; RGB (0, 51, 170)
  #UARed = $4C00D9; RGB (217, 0, 76)
  #Ube = $C37888; RGB (136, 120, 195)
  #UCLABlue = $956853; RGB (83, 104, 149)
  #UCLAGold = $00B3FF; RGB (255, 179, 0)
  #UFOGreen = $70D03C; RGB (60, 208, 112)
  #Ultramarine = $8F0A12; RGB (18, 10, 143)
  #UltramarineBlue = $F56641; RGB (65, 102, 245)
  #UltraPink = $FF6FFF; RGB (255, 111, 255)
  #UltraRed = $856CFC; RGB (252, 108, 133)
  #Umber = $475163; RGB (99, 81, 71)
  #UnbleachedSilk = $CADDFF; RGB (255, 221, 202)
  #UnitedNationsBlue = $E5925B; RGB (91, 146, 229)
  #UniversityOfCaliforniaGold = $2787B7; RGB (183, 135, 39)
  #UnmellowYellow = $66FFFF; RGB (255, 255, 102)
  #UPForestGreen = $214401; RGB (1, 68, 33)
  #UPMaroon = $13117B; RGB (123, 17, 19)
  #UpsdellRed = $2920AE; RGB (174, 32, 41)
  #Urobilin = $21ADE1; RGB (225, 173, 33)
  #USAFABlue = $984F00; RGB (0, 79, 152)
  #USCCardinal = $000099; RGB (153, 0, 0)
  #USCGold = $00CCFF; RGB (255, 204, 0)
  #UniversityOfTennesseeOrange = $007FF7; RGB (247, 127, 0)
  #UtahCrimson = $3F00D3; RGB (211, 0, 63)
  #Vanilla = $ABE5F3; RGB (243, 229, 171)
  #VanillaIce = $A98FF3; RGB (243, 143, 169)
  #VegasGold = $58B3C5; RGB (197, 179, 88)
  #VenetianRed = $1508C8; RGB (200, 8, 21)
  #Verdigris = $AEB343; RGB (67, 179, 174)
  #Vermilion = $3442E3; RGB (227, 66, 52)
  #Vermilion_ = $1E38D9; RGB (217, 56, 30)
  #Veronica = $F020A0; RGB (160, 32, 240)
  #VeryLightAzure = $FBBB74; RGB (116, 187, 251)
  #VeryLightBlue = $FF6666; RGB (102, 102, 255)
  #VeryLightMalachiteGreen = $86E964; RGB (100, 233, 134)
  #VeryLightTangelo = $77B0FF; RGB (255, 176, 119)
  #VeryPaleOrange = $BFDFFF; RGB (255, 223, 191)
  #VeryPaleYellow = $BFFFFF; RGB (255, 255, 191)
  #Violet = $FF008F; RGB (143, 0, 255)
  #Violet_ColorWheel = $FF007F; RGB (127, 0, 255)
  #Violet_RYB = $AF0186; RGB (134, 1, 175)
  #Violet_Web = $EE82EE; RGB (238, 130, 238)
  #VioletBlue = $B24A32; RGB (50, 74, 178)
  #VioletEggplant = $991199
  #VioletRed = $9453F7; RGB (247, 83, 148)
  #Viridian = $6D8240; RGB (64, 130, 109)
  #ViridianGreen = $989600; RGB (0, 150, 152)
  #VistaBlue = $D99E7C; RGB (124, 158, 217)
  #VividAmber = $0099cc; RGB (204, 153, 0)
  #VividAuburn = $242792; RGB (146, 39, 36)
  #VividBurgundy = $351D9F; RGB (159, 29, 53)
  #VividCerise = $811DDA; RGB (218, 29, 129)
  #VividCerulean = $eeaa00; RGB (0, 170, 238)
  #VividCrimson = $3300CC; RGB (204, 0, 51)
  #VividGamboge = $0099FF; RGB (255, 153, 0)
  #VividLimeGreen = $08d6a6; RGB (166, 214, 8)
  #VividMalachite = $33cc00; RGB (0, 204, 51)
  #VividMulberry = $E30CB8; RGB (184, 12, 227)
  #VividOrange = $005FFF; RGB (255, 95, 0)
  #VividOrangePeel = $00A0FF; RGB (255, 160, 0)
  #VividOrchid = $FF00CC; RGB (204, 0, 255)
  #VividRaspberry = $6C00FF; RGB (255, 0, 108)
  #VividRed = $1A0DF7; RGB (247, 13, 26)
  #VividRedTangelo = $2461DF; RGB (223, 97, 36)
  #VividSkyBlue = $FFCC00; RGB (0, 204, 255)
  #VividTangelo = $2774F0; RGB (240, 116, 39)
  #VividTangerine = $89A0FF; RGB (255, 160, 137)
  #VividVermilion = $2460e5; RGB (229, 96, 36)
  #VividViolet = $FF009F; RGB (159, 0, 255)
  #VividYellow = $02E3FF; RGB (255, 227, 2)
  #WarmBlack = $000000; RGB (0, 0, 0)
  #Waterspout = $F9F4A4; RGB (164, 244, 249)
  #Wenge = $525464; RGB (100, 84, 82)
  #Wheat = $B3DEF5; RGB (245, 222, 179)
  #White = $FFFFFF; RGB (255, 255, 255)
  #WhiteSmoke = $F5F5F5; RGB (245, 245, 245)
  #WildBlueYonder = $D0ADA2; RGB (162, 173, 208)
  #WildOrchid = $A270D4; RGB (212, 112, 162)
  #WildStrawberry = $A443FF; RGB (255, 67, 164)
  #WildWatermelon = $856CFC; RGB (252, 108, 133)
  #WillpowerOrange = $0058FD; RGB (253, 88, 0)
  #WindsorTan = $0255A7; RGB (167, 85, 2)
  #Wine = $372F72; RGB (114, 47, 55)
  #WineDregs = $473167; RGB (103, 49, 71)
  #Wisteria = $DCA0C9; RGB (201, 160, 220)
  #WoodBrown = $6B9AC1; RGB (193, 154, 107)
  #Xanadu = $788673; RGB (115, 134, 120)
  #YaleBlue = $924D0F; RGB (15, 77, 146)
  #YankeesBlue = $41281C; RGB (28, 40, 65)
  #Yellow_Crayola = $83E8FC; RGB (252, 232, 131)
  #Yellow_Munsell = $00CCEF; RGB (239, 204, 0)
  #Yellow_NCS = $00D3FF; RGB (255, 211, 0)
  #Yellow_Pantone = $00DFFE; RGB (254, 223, 0)
  #Yellow_Process = $00EFFF; RGB (255, 239, 0)
  #Yellow_RYB = $33FEFE; RGB (254, 254, 51)
  #YellowGreen = $32CD9A; RGB (154, 205, 50)
  #YellowOrange = $42AEFF; RGB (255, 174, 66)
  #YellowRose = $00F0FF; RGB (255, 240, 0)
  #Zaffre = $A81400; RGB (0, 20, 168)
  #ZinnwalditeBrown = $08162C; RGB (44, 22, 8)
  #Zinnwaldite = $2c1608
  #Zomp = $8EA739            ; RGB (57, 167, 142)

Benutzeravatar
NicTheQuick
Ein Admin
Beiträge: 8807
Registriert: 29.08.2004 20:20
Computerausstattung: Ryzen 7 5800X, 64 GB DDR4-3200
Ubuntu 24.04.2 LTS
GeForce RTX 3080 Ti
Wohnort: Saarbrücken

Re: bgi modul - farbfehler

Beitrag von NicTheQuick »

Vielleicht sind die Farben bei dir im Format BGR und nicht RGB gespeichert. Je nachdem, ob du direkt in den Speicher schreibst oder nicht, macht das nämlich einen Unterschied. Siehe auch 'DrawingBufferPixelFormat()'.
123
Beiträge: 9
Registriert: 21.07.2015 20:20

Re: bgi modul - farbfehler

Beitrag von 123 »

habe das jetzt verifiziert. die farbwerte sind in ordnung, dass ist also leider nicht der fehler.
cptdark
Beiträge: 56
Registriert: 28.02.2010 14:13
Kontaktdaten:

Re: bgi modul - farbfehler

Beitrag von cptdark »

Hilft zwar noch nicht weiter, aber pass mit den Datentypen auf. Bei den SetColor-Funktionen von Windows ist der Datentyp der Farbe DWORD, also 32 Bit, .i hat bei 64 Bit aber auch 64 Bit - da dann besser .l benutzen.

Weiters ist lt msdn wohl

SelectObject_(hDC, GetStockObject_(#DC_PEN))
SelectObject_(hDC, GetStockObject_(#DC_BRUSH))

erforderlich, bevor die Farbe gesetzt wird.
Manjaro x64 * Windows 10 x64 * PureBasic 5.50
planet-RK
Nino
Beiträge: 1300
Registriert: 13.05.2010 09:26
Wohnort: Berlin

Re: bgi modul - farbfehler

Beitrag von Nino »

123 hat geschrieben:Als anfänger versuche ich ein bgi graph modul zu programmieren.
Ich weiß nicht ob das -- gerade auch mit den diversen WinApi-Funktionen -- ein gutes Projekt für einen Anfänger ist.
Es ist außerdem eine ungewöhnliche große Menge an Code, die Du hier gepostet hast. Ich habe -- wie viele andere wohl auch -- keine Lust das alles genau zu lesen.

Mein Tipp: Mache etwas das Du besser durchschaust, und stelle dann hier lieber gezielte Fragen.
Antworten