On Wednesday, 30 December 2015 at 23:20:23 UTC, Basile B. wrote:
On Wednesday, 30 December 2015 at 20:44:44 UTC, TheDGuy wrote:
Hello,

is there any way to get the pixel color of a single pixel by x and y coordinates of a context?

render to a png back buffer.

see cairo_image_surface_create_for_data

then you'll be able to access the data and, at the same time, to blit your buffer to screen.

Thanks for your answer. But how do i access the function via the context?

It does not work like this:

class DW:DrawingArea{
        this(){
                addOnDraw(&drawCallback);
        }
        bool drawCallback(Scoped!Context cr, Widget widget){
                char[] c = new char[](256*256);
auto val = cr.cairo_image_surface_create_for_data(c,cairo_format_t.CAIRO_FORMAT_ARGB32, 256,256, cairo.format_stride_for_width(cairo_format_t.CAIRO_FORMAT_ARGB32,256));
                return true;
        }
}
"no property 'cairo_image_surface_create_for_data' for type 'Scoped'"

Reply via email to