GTKD - Write Pixbuf back to context

TheDGuy via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jan 7 12:36:01 PST 2016


Hello,

after i found out how i can access the pixel data in this thread:

http://forum.dlang.org/thread/ljktabqxzdjprrqcaeow@forum.dlang.org

i want to know how i can write the Pixbuf back to my context?

This code doesn't work because the color does not change:

cr.setSourceRgb(0,0,0);
cr.rectangle(0,0,125,125);
cr.fill();

GtkAllocation size;
Pixbuf surface;
getAllocation(size);
this.width = size.width;
this.height = size.height;

surface = 
getFromSurface(cr.getTarget(),0,0,size.width,size.height);
auto pixelArray = surface.getPixels();
for (int i = 0; i < (this.width*this.height*3);i++){
	pixelArray[i] = 125;
}

setSourcePixbuf(cr,surface,0,0);



More information about the Digitalmars-d-learn mailing list