Naming conventions ​
General ​
Graphics32 follows standard Delphi/FPC identifier naming practices:
| Category | Prefix | Example |
|---|---|---|
| Classes | T | TBitmap32, TImage32, TCustomSampler |
| Interfaces | I | IBackend, INotify |
| Types / Records | T | TColor32, TFloatPoint, TRect |
| Color Constants | cl | clWhite32, clRed32 |
| Global Functions | PascalCase | Color32, RedComponent, Intensity |
Line and Pixel methods ​
The TBitmap32 class provides a large number of methods for single pixel access and single pixel width line drawing. While the prefix of these methods indicate what they do (draw a line, access a pixel, etc.), the postfix denotes how they behave. The methods can include one or more of the following postfixes:
| Postfix | Name | Description | Sample (magnified x4) | Examples |
|---|---|---|---|---|
| (none) | Methods without modifiers offer maximum performance. Lines and pixels are rendered without anti-aliasing and without color blending. No clipping is performed so coordinates are expected to be within bitmap boundaries. Out of bounds coordinates can cause access violations and memory overwrites. | LineHorzLinePixelFillRect | ||
| S | Safe | Clipping is performed when coordinates extend beyond bitmap boundaries. This modifier can be combined with any one of the anti-aliasing or transparent modifiers below (T, A, X or F) and also with the stippling (P) modifier. | LineSLineToSPixelS | |
| T | Transparent | Semi-transparent pixels are merged onto the background image (though still without anti-aliasing). | LineTSLineToTSFillRectTS | |
| A | Anti-aliased | Uses a modified version of Bresenham’s algorithm known as Wu’s antialiasing. | LineALineAS | |
| X | Fixed | Coordinates are in fixed point (TFixed) format.These methods also employ a more sophisticated anti-aliasing algorithm than that used in the ‘A’ methods above. | LineXLineXSPixelXS | |
| F | Float | Coordinates are in floating point (TFloat) format.These methods employ the same anti-aliasing algorithm used in the ‘X’ methods. | LineFSPixelFS | |
| P | Stippling | Lines are drawn using a stippling pattern. This modifier must be combined with either the ‘X’ or ‘F’ modifiers above. | LineFSPLineXSP |
Note
For lines, all the methods listed above draw line segments that are a single pixel wide. To draw thicker lines, see the Polyline and PolyPolyline functions in the GR32_Polygons unit. Those functions also produce better anti-aliased blending over fully transparent backgrounds (when compared with X & F modified methods above).
Blend functions ​
Most blend functions are named using a scheme that clearly identify how they operate:
| Name | Example | Meaning |
|---|---|---|
| *Reg* | BlendReg | The result foreground color is returned as the function Result. |
| *Mem* | BlendMem | The result foreground color is returned in the F parameter. |
| Ex* | MergeRegEx | The the foreground alpha is scaled with a master alpha value. |
| *Mems* | BlendMems | Apply a single foreground color onto an array of background colors. |
| *Line* | MergeLine | Apply an array of foreground colors onto an array of background colors. |
| *RGB* | BlendMemRGB | Operate independently on each color channel using separate alpha values. |
| *Line1* | MergeLine1 | Deprecated. Same as *Mems*. |