The predefined colors are:
Black, NavyBlue, Blue, BrightBlue ForestGreen, Green, Cyan, SkyBlue BrightGreen, BrightCyan, DarkGray, Eggplant Red, Magenta, DarkBrown, Olive Gray, Brown, LightGray, Purple White, BrightRed, BrightMagenta, Violet Orange, Pink, Yellow, Parchment, BrightWhite
The higher the factor, the brighter the output color.
Example:
constant win=create(Window,"Test",0,Default,Default,Default,Default,0),
btn=create(PushButton,"1.2 times brighter",win,10,10,100,30,0)
procedure slightlyBrighter(integer id,integer event,sequence data)
integer newColor
newColor=adjustBrightness(getControlInfo(win,CONTROLINFO_bcolor),1.2)
setWindowBackColor(win,newColor)
end procedure
setHandler(btn,w32HClick,routine_id("slightlyBrighter"))
setWindowBackColor(win,Parchment)
WinMain(0,Normal)
See Also: bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
The bitBlt function can be used to rapidly copy images, or portions of images.
If you want to copy the entire source image with the SRCCOPY ROP code, copyBlt does the same thing, but requires less arguments.
To copy images with transparency, use transBlt.
The arguments are:
The ROP (raster operation) specifies how to combine the source with the destination. The codes are listed here./n:
Note: The coordinates are relative to zero.
Note: The destination and source can be the same control.
Example:
-- draw a bitmap in a window
atom hDIB
-- load the bitmap
hDib = loadBitmapFromFile( "lizard.bmp" )
-- copy 40x40 portion of source image to destination
bitBlt( TheWindow, -- copy to TheWindow
10, 10, -- put at {10,10} in TheWindow
hDIB, -- copy from loaded bitmap
0, 0 -- upper left hand corner is {0,0}
40, 40, -- copy a 40x40 pixel portion
SRCCOPY ) -- replace destination with image
See Also: adjustBrightness, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
The Color parameter can take one of the following forms ...
Example:
atom theColor
theColor = colorValue( -"Parchment" )
theColor = colorValue( {45,82,191} )
theColor = colorValue( Magenta )
theColor = colorValue( COLOR_ACTIVEBORDER )
theColor = colorValue( #C0C0C0 )
See Also: adjustBrightness, bitBlt, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
If you only want to copy a portion of the source or need to combine the source and destination, use bitBlt.
To copy images with transparency, use transBlt.
The arguments are:
Note: At the moment, the coordinates are zero relative; this will be changed in later releases. Example:
-- draw a bitmap in a window
atom hDIB
-- load the bitmap
hDib = loadBitmapFromFile( "shuttle.bmp" )
-- copy the entire image to TheWindow
copyBlt( TheWindow, 10, 10, hDib )
See Also: adjustBrightness, bitBlt, colorValue, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
x1 and y1 refer to the top left pixel corner of the image, and x2 and y2 refer to the bottom right corner of the image.
There are a number of caveats:
Example:
-- save {0,0} {100,100} on the screen to a file
copyToBitmapFile( Screen, "screen.bmp", 0, 0, 100, 100 )
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
x1 and y1 refer to the top left pixel corner of the image, and x2 and y2 refer to the bottom right corner of the image.
Note 1: It uses getPixel , so it's slow.
Note 2: It uses the full 24-bit color range (16+ million colors).
Example:
-- save {0,0} {100,100} on the screen to a file
copyToTrueColorBitmapFile( Screen, "screen.bmp", 0, 0, 100, 100 )
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
The data is in the form { pal, data }.
You only need to supply as many palette entries that are actually used by the image. Pixel indexes into the palette start at 0 (to be compatible with how Euphoria uses bitmaps)
Palette entries are color tuples in the form { r, g, b }, with each color value ranging from 0 to 255.
Example:
-- create a bitmap, and display it
atom hBitmap
sequence pixels, pal
-- the pixels data
pixels = {
{ 0,0,0,0 }, -- scan line 1
{ 0,1,1,0 }, -- scan line 2
{ 0,1,1,0 }, -- scan line 3
{ 0,0,0,0 } } -- scan line 4
-- the pal data (color tuples)
pal = {
{ 255, 0, 0 }, -- color 0 is bright red
{ 0, 0, 255 } } -- color 1 is bright blue
-- create the DIB
hBitmap = createDIB( {Pal, Pixels} )
-- display the bitmap in TheWindow at {1,1}
drawBitmap( theWindow, hBitmap, 1, 1 )
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
Draws the arc in the current pen color. The arc's bounding rectangle is defined as { x1, y1 } to { x2, y2 }. If filled is true, the ellipse is filled in the current pen color.
The arc is defined by the intersection between the radial start point and radial end point. The radial start point is a line running from the center of the bounding rectangle to { xStart, yStart }, and radial end point by a line running from the center of the bounding rectangle to { xEnd, yEnd }.
If filled is true, the arc will be filled.
Example:
-- draw a bright cyan filled arc in TheWindow
setPenColor( TheWindow, BrightCyan )
drawArc( TheWindow,
w32True, -- filled
1, 1, -- upper left boundary
100, 100, -- lower right boundary
49, 1, -- top center of rectangle
100, 49 ) -- right center of rectangle
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
Note: The term bitmap is inconsistant; I expect to be renaming these routines in the future.
Example:
-- load a bitmap, and display in window
atom hBitmap
-- load the bitmap
hBitmap = loadBitmapFromFile( "graphic.bmp" )
-- display the bitmap in TheWindow at {1,1}
drawBitmap( theWindow, hBitmap, 1, 1 )
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
Draws the chord in the current pen color.
A chord is a region bounded by the intersection of an ellipse and a line segment. The ellipse is bounding rectangle is defined { x1, y1 } to { x2, y2 }. If filled is true, the chord is filled in the current pen color.
The chord is defined by the intersection between the radial start point and radial end point. The radial start point is a line running from the center of the bounding rectangle to { xStart, yStart }, and radial end point by a line running from the center of the bounding rectangle to { xEnd, yEnd }.
If filled is true, the chord will be filled.
Example:
-- draw a yellow chord in TheWindow
setPenColor( TheWindow, Yellow )
drawChord( TheWindow,
w32True, -- filled
1, 1, -- upper left boundary
100, 100, -- lower right boundary
49, 1, -- top center of rectangle
100, 49 ) -- right center of rectangle
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
Draws the ellipse in the current pen color within the rectangle bounded by { x1, y1 } and { x2, y2 }. If filled is true, the ellipse is filled in the current pen color.
Example:
-- draw a black ellipse in TheWindow
setPenColor( TheWindow, Black )
drawEllipse( TheWindow, w32True, 10, 10, 100, 100 )
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
The line is drawn in the current pen color between { pStartX, pStartY } and { pEndX, pEndY }.
Example:
-- draw a line in TheWindow from {10,10} to {100,100}
drawLine( TheWindow, 10, 10, 100, 100 )
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
The lines are drawn between the sets of coordinates in coords.
This sequence can contain Colors, Points, Lines, or Rects.
If no color parameters are supplied, the current pen color for the control is used.
Example:
-- draw a shape in TheWindow
drawLines( TheWindow, {White,{40,0,0,80},{80,80},{40,0},
Blue,{40,5,0,85},{80,85},{40,5}
} )
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
Draws the pie slice in the current pen color. The bounding rectangle is defined as { x1, y1 } to { x2, y2 }. If filled is true, the slice is filled in the current pen color.
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
Draws the polygon in id in the current pen color using points. If i/ filled is true, the polygon will be filled.
points is either a set of two-element co-ordinates or a list of alternating x,y coordinates.
Example:
-- draw a blue filled triangle in TheWindow
sequence points
-- define the points
points = { { 10, 10 },
{ 80, 40 },
{ 40, 80 } }
-- alternative method to define the points
points = { 10, 10,
80, 40,
40, 80 }
-- set pen color
setPenColor( TheWindow, Blue )
-- draw a filled polygon using the points
drawPolygon( TheWindow, w32True, points )
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
Draws the rectangle in the current pen color from { x1, y1 } to { x2, y2 }. If filled is true, the rectangle is filled in the current pen color.
Example:
-- draw a filled green rectangle in TheWindow
setPenColor( TheWindow, Green )
drawRectangle( TheWindow, w32True, 10, 10, 100, 100 )
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
Draws the rounded rectangle in the current pen color. The upper left of the carved out rectangle is at { x1, y1 }, and its lower right corner at to { x2, y2 }. The ellipse corner width and height are specified in xc and yc. If filled is true, the rectangle is filled in the current pen color.
Example:
-- draw a filled blue round rectangle in TheWindow
setPenColor( TheWindow, Green )
drawRoundRect( TheWindow, w32True, 10, 10, 100, 100, 5, 5 )
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
Filename is either ...
** the name of a file
** a 2-element sequence containing a filename and a 1-based index of which icon to extract.
** a 3-element sequence containing a filename, a 1-based index of which icon to extract,
and a code indicating which size icon to return: 0 --> small, 1 --> large, 2 --> both. When
you ask to return both, a 2-element sequence is returned that contains {small, large}.
Example:
atom hIcon
sequence lIcons
-- Get the first icon
hIcon = extractIcon( "C:\\WINDOWS\\WINFILE.EXE")
-- Get the second icon
hIcon = extractIcon( {"C:\\WINDOWS\\WINFILE.EXE", 2} )
-- Get the fourth icon, large size
hIcon = extractIcon( {"C:\\WINDOWS\\WINFILE.EXE", 4, 1} )
-- Get the fifth icon, both sizes
lIcons = extractIcon( {"C:\\WINDOWS\\SYSTEM32\SHELL32.DLL", 5, 2} )
lBig = lIcons[2]
lSmall = lIcons[1]
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
If the isColor is not w32False, filler designates a color, and this call is equivalent to one to drawRectangle() with the filled parameter nonzero. Otherwise:
rectangle may be specified as:
transp is nonzero to request a background mode of TRANSPARENT, and 0 to have it OPAQUE, during this operation.
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
This routine will fill an area of adjacent pixels with the same color. It works by searching for a specific color, the Search Color, and changing pixels to the Flood Color as it goes. There are two types of searching. One searches for a border and all pixels inside the border are changed to the flood color. The other type searches for a specific color and only changes adjacent pixels with that color to the flood color.
pControl is either a valid control ID, or a Device Context returned by getDC. If pControl is a control Id, then the default flood color is the current pen color ( setPenColor ) otherwise you need to create your own brush before calling this ( createBrush ).
pXStart and pYStart are the pixel coordinates of the flood starting position.
pFillType is one of either FLOODFILLBORDER or FLOODFILLSURFACE. A border fill changes each pixel until the border is encountered. A surface fill changes each adjacent pixel that is the same color as the pColor value.
pColor is used to supply the search color or both colors. To supply just the search color then
pColor is a single value. To supply both search and flood colors, then pColor is
a two-element sequence in the form { SearchColor, FloodColor }.
Either color can be a single atom color value, a 3-element {R,G,B} value or the name of one of
the predefined color names, eg. "Black", "BrightCyan", etc...
The Search Color's usage depends on the flood type. If doing a border fill, then
the search color is the border's color. If a surface fill, this is the color of the pixels to change from.
There is a special value for Search Color. If you supply a value of -1, then Search Color is taken from the
pixel currently at pXStart, pYStart. This means that for a border fill, nothing happens. For a
surface fill, the pixel at the start position and all adjacent pixels will be changed to the flood
color.
Note that if no Flood Color is supplied the current pen color is used when pControl
is a control ID, or the current brush if pControl is a device context.
If the Flood Color is supplied, and it has the value -1, then the current pen color for the control
is used.
Examples:
-- Using the current pen, set all pixels inside the black border.
VOID = floodFill( myPixmap, x, y, Black, FLOODFILLBORDER)
-- Set the start pixel and all adjacent pixels of the same color to Pink
VOID = floodFill( myPixmap, x, y, {-1, Pink}, FLOODFILLSURFACE)
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
Example:
-- get a pixel color from {10,10} in TheWindow
atom rgb
rgb = getPixel( TheWindow, 10, 10 )
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
Note: The name bitmap is a bit confusing; it should be more properly called loadDIBFromFile. At some point, the graphic routines need to be renamed in a more consistant manner.
Example:
-- load a bitmap, and display in window
atom hBitmap
-- load the bitmap
hBitmap = loadBitmapFromFile( "graphic.bmp" )
-- display the bitmap in TheWindow at {1,1}
drawBitmap( theWindow, hBitmap, 1, 1 )
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
If output_triple is not zero, a RGB triple is returned, or else a 24 bit integer value.
Always returns -1 on error.
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
The function will fail if the name is already known, or if the color specification is invalid, ie is not understood by colorValue(). Color names are case insensitive.
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
This triggers an w32HPaint event for that window, requesting that the entire window be repainted.
It is different to repaintWindow() in that the window is not cleared to its background color first.
Example:
-- force MyWindow to be repainted
repaintFG( myWindow )
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
This sends repaints at the specified portion of the window with the background color, erasing that portion of it. It then triggers an Paint event for that window, passing the erased area as parameters.
Example:
-- repaint only a portion of MyWindow
repaintRect( myWindow, 1, 1, 10, 10 )
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
This repaints the entire window in it's background color, effectively erasing everything in it. It then triggers an w32HPaint event for that window, requesting that the entire window be repainted.
Example:
-- force MyWindow to be repainted
repaintWindow( myWindow )
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
Converts the red, green and blue values (ranging from 0-255) into an atom representing that color tuple. Each value represents the relative brightness of each primary color element.
Example:
-- set the pen color to a random blue setPenColor( MyControl, rgb( 0, 0, rand( 255 )
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
When the pen mode is set to OPAQUE, this specifies the color used to fill the 'gaps'.
When used on a MonthCalendar control, it changes the background color imediately.
When used on a Pixmap control, it clears the entire Pixmap to the specified color.
Example:
-- set pen opaque color
setPenBkMode( TheWindow, OPAQUE)
setBackColor( TheWindow, Red )
wPuts( TheWindow, "This text is on red" )
-- Clear a pixmap
setBackColor( pixmap1, BrightWhite)
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
By default, the library prevents w32HPaint events to reach controls which are already in the process of painting. Pass a positive value in pFlag to enable recursion during paint events, w32False to disable it or a negative value to just get the current value.
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
Example:
setPenBkColor( Fld1, BrightCyan )
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
Modes are:
If mode is OPAQUE, the color set in setBackColor is used. The default mode is TRANSPARENT.
Example:
-- draw an XOR line in TheWindow
setPenBkMode( TheWindow, OPAQUE )
drawLine( TheWindow, 10, 10, 100, 100 )
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
The current pen color is used until this is called for the first time.
Example:
setPenBrushColor( MyCanvas, Blue)
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
This is the color that is used by other graphics routines.
To set the color of text, use setTextColor.
Example:
-- set pen color to red
setPenColor( TheWindow, Red )
-- draw a red line
drawLine( TheWindow, 10, 10, 40, 40 )
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
The default value is R2_COPYPEN. The list mode codes is here.
Example:
-- draw an XOR line in TheWindow
setPenMode( TheWindow, R2_XORPEN )
drawLine( TheWindow, 10, 10, 100, 100 )
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
This allows the creation of various dotted line styles. Use setBackColor to define the background fill used on the line.
The following styles are defined:
Note: This routine will probably be dropped in later releases.
Example:
-- set pen style
setPenStyle( TheWindow, Dot )
-- draw a line using that pen style
drawLine( TheWindow, 10, 10, 100, 100 )
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
The default thickness of the pen is 1 pixel.
Example:
-- set pen thickness of 3
setPenWidth( TheWindow, 3 )
-- draw a thick line
drawLine( TheWindow, 10, 10, 40, 40 )
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPixel, split_rgb, stretchBlt, textToBitmap, transBlt
Example:
-- set pixel at {10,10} to Red
setPixel( TheWindow, 10, 10, Red )
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, split_rgb, stretchBlt, textToBitmap, transBlt
Converts the color value into its component colors.
Example:
-- get the colors got a pixel RGB = split_rgb( getPixel(myBMP, 4,7) ) RGB = split_rgb( "BrightCyan" ) RGB = split_rgb( COLOR_BUTTONFACE ) RGB = split_rgb( Magenta )
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, stretchBlt, textToBitmap, transBlt
This is used to resize an image and/or create mirror images. If the dstWide and dstHigh parameters are negative, the image is also reflected in the X-axis and Y-axis respectively.
The arguments are:
The ROP (raster operation) specifies how to combine the source with the destination. The codes are listed here.
Note: The coordinates are relative to zero.
Note: The destination and source can be the same control.
Example:
-- draw a bitmap in a window
atom hDIB
-- load the bitmap
hDib = loadBitmapFromFile( "lizard.bmp" )
-- copy 40x40 portion of source image to destination
stretchBlt( TheWindow, -- copy to TheWindow
10, 10, -- put at {10,10} in TheWindow
100, 50, -- cause it to be this size
hDIB, -- copy from loaded bitmap
0, 0 -- upper left hand corner is {0,0}
40, 40, -- copy a 40x40 pixel portion
SRCCOPY ) -- replace destination with image
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, textToBitmap, transBlt
Spaces are converted to White pixels; all other characters are converted to Black pixels.
Note: This routine should probably be deprecated, or at least renames.
Example:
-- create a bitmap, and display it
atom hBitmap
sequence image
-- the image
image = { " xxxxxx ",
"x x",
"x x x x",
"x x",
"x x x x",
"x x x x",
"x xxxx x",
" xxxxxx ",
-- create the bitmap
hBitmap = textToBitmap( image )
-- display the bitmap in TheWindow at {1,1}
drawBitmap( theWindow, hBitmap, 1, 1 )
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, transBlt
TransBlt is typically used for displaying non-rectangular bitmaps - sprites. It is a computationally expensive operation; if there is no transparency in your image, you should use copyBlt or bitBlt instead.
By default, transBlt assumes that the color {255,0,255} is to be treated as transparent. To change the transparent color, use setTransparentColor.
The arguments are:
Note: At the moment, the coordinates are zero relative; this will be changed in later releases. Example:
-- draw a bitmap using transparency
atom hDIB
sequence size
-- get the size of TheWindow
size = getCtlSize( TheWindow )
-- load the bitmap
hDib = loadBitmapFromFile( "shuttle.bmp" )
-- treat the color BrightWhite as transparent
setTransparentColor( BrightWhite )
-- copy multiple images to TheWindow
for i = 1 to 20 do
transBlt( TheWindow, -- destination
rand( size[1] ), -- x position
rand( size[2] ), -- y position
hDib ) -- image to copy
end for
See Also: adjustBrightness, bitBlt, colorValue, copyBlt, copyToBitmapFile, copyToTrueColorBitmapFile, createDIB, drawArc, drawBitmap, drawChord, drawEllipse, drawLine, drawLines, drawPie, drawPolygon, drawRectangle, drawRoundRect, extractIcon, fillRectangle, floodFill, getPixel, loadBitmapFromFile, mixColors, newColor, repaintFG, repaintRect, repaintWindow, rgb, setBackColor, setPaintPolicy, setPenBkColor, setPenBkMode, setPenBrushColor, setPenColor, setPenMode, setPenStyle, setPenWidth, setPixel, split_rgb, stretchBlt, textToBitmap