I think you are looking for something like this.

Context.getTarget will get you the surface the Context is drawing to, this most likely isn't a ImageSurface. So you will need to create an pixbuf from the returned surface, with the Pixbuf you can then get the raw pixel data using getPixelsWithLength().

```
import gdk.Pixbuf;

bool drawCallback(Scoped!Context cr, Widget widget)
{
    GtkAllocation size;
    Pixbuf surafce;

    getAllocation(size);

    //Draw something;

surface = getFromSurface(cr.getTarget(), 0, 0, size.width, size.height);

    ubyte[] data = cast(ubyte[])surface.getPixelsWithLength();

    //Do somthing with data.

    return true;
}
```

getPixelsWithLength has the wrong return type, which will probably be fixed some time.

--
Mike Wey

Reply via email to