Set color to a single point in Cairo
TheDGuy via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Dec 20 03:16:06 PST 2015
On Sunday, 20 December 2015 at 01:17:50 UTC, Basile B. wrote:
> 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.
Thanks for your answer,
but a bit disappointing that cairo doesn't offer a real
"setPixel" function :(
More information about the Digitalmars-d-learn