FillRGBEffectLib — Solid Color Fill (RGB)
Fills a visual control with a solid colour overlay using a numeric ARGB value. Wraps FireMonkey’s TFillRGBEffect. Functionally very similar to FillEffectLib — both accept ARGB numeric colours and both replace all pixels. 12 functions.
| Category | Count | Description |
|---|---|---|
| Error Handling | 4 | fillrgb_error, errormsg$, strerror$, clearerror |
| Creation & Destruction | 2 | fillrgb# (create), fillrgb_free (destroy) |
| Properties | 2 | color (get/set) |
| Effect Control | 4 | enabled, trigger (get/set) |
Fill vs FillRGB
Both libraries accept numeric ARGB colour values and produce the same visual result. The underlying FireMonkey classes (TFillEffect vs TFillRGBEffect) differ in their internal shader implementation, but from the Plan9Basic programmer’s perspective they are interchangeable.
| Feature | FillEffectLib | FillRGBEffectLib |
|---|---|---|
| Colour input | Numeric ARGB | Numeric ARGB |
| Function count | 12 | 12 |
| Prefix | fill_ | fillrgb_ |
| Wraps | TFillEffect | TFillRGBEffect |
ⓘ Which to use? Either works. Pick whichever prefix you prefer. Both accept the same ARGB decimal/hex values.
Cross-Platform Support
| Platform | Status | Notes |
|---|---|---|
| Windows | ✅ Full Support | GPU-accelerated via Direct2D |
| Linux | ✅ Full Support | Software rendering fallback |
| Android | ✅ Full Support | GPU-accelerated |
Error Handling
| Function | Signature | Description |
|---|---|---|
fillrgb_error() | fillrgb_error@ | Returns last error code (0 = no error) |
fillrgb_errormsg$() | fillrgb_errormsg$@ | Returns last error message as string |
fillrgb_strerror$(code) | fillrgb_strerror$@n | Converts an error code to descriptive text |
fillrgb_clearerror() | fillrgb_clearerror@ | Clears the error state |
Error Codes
| Code | Constant | Meaning |
|---|---|---|
| 0 | ERR_NONE | No error |
| 1 | ERR_NIL_EFFECT | Effect pointer is nil |
| 2 | ERR_INVALID_EFFECT | Pointer is not a valid TFillRGBEffect |
| 3 | ERR_INVALID_VALUE | Property value out of range |
| 4 | ERR_NIL_PARENT | Parent control pointer is nil |
| 5 | ERR_INVALID_PARENT | Pointer is not a valid TFmxObject |
Creation & Destruction
| Function | Signature | Description |
|---|---|---|
fillrgb#(parent#) | fillrgb#@# | Creates a fill RGB effect on the given control. Returns the effect pointer. |
fillrgb_free(effect#) | fillrgb_free@# | Destroys the effect and removes it from the parent. |
Color
| Function | Signature | Description |
|---|---|---|
fillrgb_color#(effect#, color) | fillrgb_color#@#n | Sets fill colour (ARGB number) |
fillrgb_color(effect#) | fillrgb_color@# | Gets current fill colour |
Effect Control
Enabled
| Function | Signature | Description |
|---|---|---|
fillrgb_enabled#(effect#, value) | fillrgb_enabled#@#n | Enables (1) or disables (0) |
fillrgb_enabled(effect#) | fillrgb_enabled@# | Gets enabled state |
Trigger
| Function | Signature | Description |
|---|---|---|
fillrgb_trigger#(effect#, trigger$) | fillrgb_trigger#@#$ | Sets trigger string |
fillrgb_trigger$(effect#) | fillrgb_trigger$@# | Gets current trigger string |
Complete Examples
Basic Fill on Image
let frm# = Pointer#(0) let img# = Pointer#(0) let fl# = Pointer#(0) frm# = form#("Fill RGB Demo", 400, 320) img# = image#(frm#) image_bounds#(img#, 100, 40, 200, 150) image_load#(img#, "https://picsum.photos/200/150") fl# = fillrgb#(img#) fillrgb_color#(fl#, 4294901760) ' Red ($FFFF0000) form_show(frm#)
Colour Switcher
let frm# = Pointer#(0) let img# = Pointer#(0) let fl# = Pointer#(0) let lbl# = Pointer#(0) frm# = form#("Fill RGB Colors", 450, 380) img# = image#(frm#) image_bounds#(img#, 125, 30, 200, 150) image_load#(img#, "https://picsum.photos/200/150") fl# = fillrgb#(img#) fillrgb_enabled#(fl#, 0) lbl# = label#(frm#, "Fill: Off", 180, 200) let btn1# = button#(frm#, "Off") button_bounds#(btn1#, 40, 240, 80, 30) button_onclick#(btn1#, "SetOff") let btn2# = button#(frm#, "Red") button_bounds#(btn2#, 130, 240, 80, 30) button_onclick#(btn2#, "SetRed") let btn3# = button#(frm#, "Green") button_bounds#(btn3#, 220, 240, 80, 30) button_onclick#(btn3#, "SetGreen") let btn4# = button#(frm#, "Blue") button_bounds#(btn4#, 310, 240, 80, 30) button_onclick#(btn4#, "SetBlue") form_show(frm#) function SetOff(sender#) fillrgb_enabled#(fl#, 0) label_text#(lbl#, "Fill: Off") endfunction function SetRed(sender#) fillrgb_color#(fl#, 4294901760) fillrgb_enabled#(fl#, 1) label_text#(lbl#, "Fill: Red") endfunction function SetGreen(sender#) fillrgb_color#(fl#, 4278255360) fillrgb_enabled#(fl#, 1) label_text#(lbl#, "Fill: Green") endfunction function SetBlue(sender#) fillrgb_color#(fl#, 4278190335) fillrgb_enabled#(fl#, 1) label_text#(lbl#, "Fill: Blue") endfunction
Toggle Fill On/Off
let frm# = Pointer#(0) let img# = Pointer#(0) let fl# = Pointer#(0) frm# = form#("Toggle Fill", 400, 320) img# = image#(frm#) image_bounds#(img#, 100, 40, 200, 150) image_load#(img#, "https://picsum.photos/200/150") fl# = fillrgb#(img#) fillrgb_color#(fl#, 4294967040) ' Yellow ($FFFFFF00) fillrgb_enabled#(fl#, 0) let btn# = button#(frm#, "Toggle Fill") button_bounds#(btn#, 130, 220, 120, 35) button_onclick#(btn#, "OnToggle") form_show(frm#) function OnToggle(sender#) if fillrgb_enabled(fl#) = 1 then fillrgb_enabled#(fl#, 0) else fillrgb_enabled#(fl#, 1) endif endfunction
Quick Reference
| Function | Signature | Description |
|---|---|---|
| ERROR HANDLING | ||
fillrgb_error() | fillrgb_error@ | Last error code |
fillrgb_errormsg$() | fillrgb_errormsg$@ | Last error message |
fillrgb_strerror$(code) | fillrgb_strerror$@n | Error code to text |
fillrgb_clearerror() | fillrgb_clearerror@ | Clear error state |
| CREATION & DESTRUCTION | ||
fillrgb#(parent#) | fillrgb#@# | Create effect on control |
fillrgb_free(effect#) | fillrgb_free@# | Destroy effect |
| PROPERTIES | ||
fillrgb_color#(effect#, color) | fillrgb_color#@#n | Set colour (ARGB number) |
fillrgb_color(effect#) | fillrgb_color@# | Get colour |
| EFFECT CONTROL | ||
fillrgb_enabled#(effect#, val) | fillrgb_enabled#@#n | Enable (1) / disable (0) |
fillrgb_enabled(effect#) | fillrgb_enabled@# | Get enabled state |
fillrgb_trigger#(effect#, str$) | fillrgb_trigger#@#$ | Set trigger string |
fillrgb_trigger$(effect#) | fillrgb_trigger$@# | Get trigger string |
12 functions. Part of the Plan9Basic visual effects library system.
See Also
- FillEffectLib — Same fill effect, same ARGB API
- MonochromeEffectLib — Convert to a single colour tone
- ColorKeyAlphaEffectLib — Make a specific colour transparent
