DrawWidth DrawMode FillStyle Font FrameSize
Draw/Line LineTo Box RoundRect Triangle QuadPoly Pentagon Hexagon Circle Ellipse Arc Wedge Curve Text Erase
Flood LoadPic SavePic FixPic GetPixel SetPixel ShowPixels
Frame, Picture, and Bitmap
When you display an image on a Windows computer, you are typically dealing with three separate display layers:
1. The memory that holds the full image information. This is often referred to as the DIB, for Device Independent Bitmap. It is normally a True Color (32 or 24 bit) pixel representation of the image. In ArtWonk, this True Color bitmap is called the Bitmap.
2. The memory that holds the image formatted to your particular display settings. This is often referred to as the DDB, for Device Dependent Bitmap. Depending on your display settings (which you can change by right clicking on an empty area of the Windows Desktop area, and selecting "Properties," then "Settings"), this can be an 8, 16 or 32 bit image. When an image is displayed, normally Windows translates the DIB to the DDB. In ArtWonk this DDB is called the Picture.
3. The actual window the image is displayed in. This can be a browser page, a part of a window, or a full window. In ArtWonk there is a single window dedicated to showing the Picture, which is called the Frame.
While the purpose of the Frame is self evident - it supplies a holder for the Picture - the reason for a separate Bitmap and Picture is a bit more subtle. Simply put, the Bitmap is guaranteed to be the best possible representation of the pixels in an image, but it has the disadvantage of using a large amount of computer memory, and manipulating it requires CPU reads and writes to this memory, which can be slow.
And while the Picture is not guaranteed to be an ideal representation of the pixels in an image, it is formatted in whatever manner your display hardware (usually your video card) requires for fastest display. Also, in most Windows computers, the Picture is held within the video card, and therefore is usually ultra fast, especially when altering an already displayed image, such as when drawing on the image.
In order to take maximum advantage of the computer picture displaying systems, ArtWonk divides the graphics processes into two separate sets of functions, Drawing functions that work on the Picture, and Image Processing functions that work on the Bitmap. This allows drawing to be ultra fast, while image processing to be ultra accurate. The disadvantage is that if you choose to combine drawing and image processing, you need to also combine the Bitmap with the Picture.
Graphics modules, which mainly do drawing functions, handle this semi automatically. That is, you can use the drawing functions, which only draw on the Picture and therefore are very fast, and you can Load or Save an image which uses the Bitmap, but automatically updates to or from the Picture. In such cases, where the Bitmap and Picture are used together, they may be referred to collectively simply as an Image, and the window that holds them as the Graphics Frame.
The only place where you need to be careful with the graphics modules is when drawing individual pixels. Pixels are drawn in the Bitmap, not the Picture, because the overhead to set individual pixels would be very large (if you really want to draw pixels directly to the Picture, use 1-pixel lines). However by first setting the pixels in the Bitmap, then loading them all at once into the Picture, most single pixel functions are speeded up dramatically. The most often used single pixel function is to read pixels from an image in order to use images as source material for music, so by reading pixels from the Bitmap only this often used function requires very little processing overhead.
Unlike Grapics Functions, which can use multiple Bitmaps, Graphics Modules use one Bitmap only, and the Bitmap Number parameter found in Graphics Functions does not exist for the modules. Modules always use Bitmap #0. Thus, while you are free to mix graphics modules and functions, any settings made by the graphics setup modules, such as DrawWidth, DrawStyle, etc., will apply only to the module graphics bitmap, which is Bitmap #0 by default but may be changed with the Graphics Function SetModuleBitmap().
Sets line width for all drawing functions that follow. Once set, the draw width does not need to be reset unless different drawing widths are required for different drawing functions. When using different draw widths, use a separate module just before drawing functions that need a new width.
Outputs: (none)
Inputs:
Width: Draw Width 1 - 32,767 pixels.
Chng: Any change causes update.
Sets drawing mode and line styles for all drawing functions that follow.
Outputs: (none)
Inputs:
Mode: Use this input value (1-16) to produce visual effects when drawing with the graphics methods. The draw function compares each pixel in the draw pattern to the corresponding pixel in the existing background and then applies bit-wise operations. For example, setting 7 (Xor Pen) uses the Xor operator to combine a draw pattern pixel with a background pixel. The exact effect of a draw Mode setting depends on the way the color of a line drawn at run time combines with colors already on the screen. Settings 1, 6, 7, 11, 13, and 16 yield the most predictable results.
1 Blackness.
2 Not Merge Pen — Inverse of setting 15 (MergePen).
3 Mask Not Pen — Combination of the colors common to the background color and the inverse of the pen.
4 Not Copy Pen — Inverse of setting 13 (Copy Pen).
5 Mask Pen Not — Combination of the colors common to both the pen and the inverse of the display.
6 Invert — Inverse of the display color.
7 Xor Pen — Combination of the colors in the pen and in the display color, but not in both.
8 Not Mask Pen — Inverse of setting 9 (Mask Pen).
9 Mask Pen — Combination of the colors common to both the pen and the display.
10 Not Xor Pen — Inverse of setting 7 (Xor Pen).
11 Nop — No operation — output remains unchanged. In effect, this setting turns drawing off.
12 Merge Not Pen — Combination of the display color and the inverse of the pen color.
13 Copy Pen (Default) — Color specified by the ForeColor property.
14 Merge Pen Not — Combination of the pen color and the inverse of the display color.
15 Merge Pen — Combination of the pen color and the display color.
16 Whiteness.
Style: Sets line style (0-5). If DrawWidth is set to a value greater than 1, DrawStyle settings 1 through 5 is ignored and it produces a solid line. If DrawWidth is set to 1, DrawStyle produces the following effect:
0 Transparent
1 Solid
2 Dash
3 Dot
4 Dash-Dot
5 Dash-Dot-Dot
Chng: Any change causes update.
Sets fill style for enclosed drawn objects.
Outputs: (none)
Inputs:
Style: Fill style (0-7):
0 Solid
1 Transparent
2 Horizontal Line
3 Vertical Line
4 Downward Diagonal
5 Upward Diagonal
6 Cross
7 Diagonal Cross
Chng: Any change causes update.
Sets font metrics for the graphics text functions.
Outputs: (none)
Inputs:
Name: Font name (text). This should be the name of a font that is currently installed on the computer.
Size: Font Size.
Bold: NZ=Font Bold.
Italic: NZ=Font Italic.
ULine: NZ=Font Underline.
Strike: NZ=Font Strikeout.
Strb: Strobe to update.
Read/Set Frame Width & Height.
Outputs:
Width: Current Frame width in pixels.
MaxX: Maximum X (Width-1).
Height: Current Frame height in pixels.
MaxY: Maximum Y (Height-1).
Inputs:
Width: Value to set Frame width.
Height: Value to set Frame height.
Strb: Strobe to set new Frame width & height.
Draw a line at X1,Y1 X2,Y2.
Outputs: (none)
Inputs:
X1, Y1, X2, Y2: Line endpoints in pixels.
Color: Line draw color (&hBBGGRR).
Chng: Any change causes update.
Draw/Move Line to X, Y from previous position.
Outputs: (none)
Inputs:
X, Y: Line/move endpoint in pixels.
Pen: If NZ, the line is drawn, if 0, the position is updated but the line is not drawn.
Color: Line draw color (&hBBGGRR).
Chng: Any change causes update.
Draw a box at X1,Y1 X2,Y2.
Outputs: (none)
Inputs:
X1, Y1, X2, Y2: Opposing box corners in pixels.
Color: Box outline color (&hBBGGRR).
Chng: Any change causes update.
Draw a rounded rectangle.
Outputs: (none)
Inputs:
X1, Y1, X2, Y2: Opposing rectangle corners in pixels.
Width: Width of the ellipse used to draw the rounded corners.
Height: Height of the ellipse used to draw the rounded corners.
Color: Outline color (&hBBGGRR).
Chng: Any change causes update.
Draw a triangle at given vertices.
Outputs: (none)
Inputs:
X1, Y1 - X3, Y3: Vertices in pixels.
Color: Outline color (&hBBGGRR).
Chng: Any change causes update.
Draw a quadrilateral polygon at given vertices.
Outputs: (none)
Inputs:
X1, Y1 - X4, Y4: Vertices in pixels.
Color: Outline color (&hBBGGRR).
Chng: Any change causes update.
Draw a pentagon at given vertices.
Outputs: (none)
Inputs:
X1, Y1 - X5, Y5: Vertices in pixels.
Color: Outline color (&hBBGGRR).
Chng: Any change causes update.
Draw a hexagon at given vertices.
Outputs: (none)
Inputs:
X1, Y1 - X6, Y6: Vertices in pixels.
Color: Outline color (&hBBGGRR).
Chng: Any change causes update.
Draw a circle at given center point, of given radius.
Outputs: (none)
Inputs:
X, Y: Center point in pixels.
Radius: Radius.
Color: Outline color (&hBBGGRR).
Chng: Any change causes update.
Draw a circle at given center point, of given radius.
Outputs: (none)
Inputs:
X, Y: Center point in pixels.
Radius: Radius.
Aspct: Aspect ratio: 1.0 gives circle.
Color: Outline color (&hBBGGRR).
Chng: Any change causes update.
Draw an elliptical arc bounded within given rectangle.
Outputs: (none)
Inputs:
X1, Y1, X2, Y2: Opposing corners in pixels of bounding rectangle.
Start: Start angle degrees 0-360.
End: End angle degrees 0-36.
Color: Outline color (&hBBGGRR).
Chng: Any change causes update.
Draw a pie shaped wedge bounded within given rectangle.
Outputs: (none)
Inputs:
X1, Y1, X2, Y2: Opposing corners in pixels of bounding rectangle.
Start: Start angle degrees 0-360.
End: End angle degrees 0-36.
Color: Outline color (&hBBGGRR).
Chng: Any change causes update.
Draw a Bezier curve between end points, with two stretch points.
Outputs: (none)
Inputs:
X1, Y1: Start point of Bezier curve.
X2, Y2: 1st stretch point of Bezier curve.
X3, Y3: 2nd stretch point of Bezier curve.
X4, Y4: Start point of Bezier curve.
Color: Line color (&hBBGGRR).
Chng: Any change causes update.
Draw text string. Use Font module to set charastics.
Outputs: (none)
Inputs:
X, Y: Upper left coordinates for the text.
Text: Text string to draw.
Color: Text color (&hBBGGRR).
Chng: Any change causes update.
Erase drawn image with given background color. This module is similar to Flood (below), but it only erases the Picture, not the Bitmap. Like all the Draw functions, it is done in video hardware on most computers and is much faster than Flood.
Outputs: (none)
Inputs:
Color: Background color (&hBBGGRR).
Chng: Any change causes update.
Flood image with given color. This module erases both Picture and Bitmap.
Outputs: (none)
Inputs:
Color: Flood color (&hBBGGRR).
Strb: Strobe to update.
Load a picture bitmap from given file name.
Outputs: (none)
Inputs:
Name: File name string of picture to load. Use Text/Filename module to create file name string.
ASize: Autosize: 0=frame sized to image, 1=image sized to frame.
Strb: Strobe to load picture.
Save current picture bitmap.
Outputs: (none)
Inputs:
Name: File name string of picture to save. Use Text/Filename module to create file name string.
Strb: Strobe to save picture.
Make image drawn on the picture permanent by merging it with the bitmap. This is needed when you are using Draw functions, then want to read back the pixels with GetPixel, or to use an image processing function (found in the Function module graphics functions). Not needed for saving with SavePic, which automatically merges picture with bitmap prior to saving.
Outputs: (none)
Inputs:
Strb: Strobe to fix (merge) picture and bitmap.
Read pixel color at X,Y.
Outputs:
Color: Pixel color read at X,Y.
Inputs:
X, Y: Address of pixel to read.
Chng: Any change causes pixel read.
Set (write) pixel into bitmap at X,Y. Use ShowPixels to display.
Outputs: (none)
Inputs:
Color: Pixel color read at X,Y.
X, Y: Address of pixel to read.
Chng: Any change causes update.
Display any newly set pixels. This copies the bitmap to the picture. Previous picture contents are lost.
Outputs: (none)
Inputs:
Strb: Strobe to update.
ArtWonk is Copyright © 2003-2007 by John Dunn and Algorithmic Arts. All Rights Reserved.