Set color to a single point in Cairo
Basile B. via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Dec 19 17:17:50 PST 2015
On Saturday, 19 December 2015 at 14:16:23 UTC, TheDGuy wrote:
> is it possible to set the color of a single pixel with Cairo?
Not like you would do with a classic canvas (2d grid), because
colors are applied with `cairo_fill()` and `cairo_stroke()` on a
particular path.
but you can define a path that represents a single pixel and fill
it:
```
cairo_rectangle (cr, x, y, 1, 1); // 1 pix rectangle
cairo_set_source_rgba (cr, 0, 0, 0, 1); // color
cairo_fill (cr); // fill the rectangle with source rgba
```
However cairo is node made to be used like this. The workflow is
usually more based on stacked layers (1 layer = 1 path) with
different filling, different transparency.
More information about the Digitalmars-d-learn
mailing list