www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - GTKD - Write Pixbuf back to context

reply TheDGuy <loder.feuer googlemail.com> writes:
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);
Jan 07 2016
parent reply Gerald <me me.com> writes:
https://developer.gnome.org/gtkmm-tutorial/stable/sec-draw-images.html.en

Does this work for you?
Jan 07 2016
parent TheDGuy <loder.feuer googlemail.com> writes:
On Thursday, 7 January 2016 at 21:35:40 UTC, Gerald wrote:
 https://developer.gnome.org/gtkmm-tutorial/stable/sec-draw-images.html.en

 Does this work for you?
Yes, thank you very much! cr.paint();
Jan 08 2016