Forums > Javascript

JSUI / MGraphics : instance to image – alpha channel bug ?

March 16, 2014 | 12:29 pm

Hello !

im trying to draw separate "mgraphics" context  into the Image , to reuse later within main context . Everything is working fine unless my drawings use alpha  .

when alpha is provided im getting differences within colors .

 

mgraphics.init();
mgraphics.relative_coords = 0;
mgraphics.autofill = 0;
autowatch = 1;

var image ;

function offline(){
	var mg = new MGraphics(100,100);

	with(mg){
		set_source_rgba(0, 1, 0, .5);
		rectangle(0, 0, 100, 100);
		fill();		
	}

	image = new Image(mg);

};

function paint(){

	with(mgraphics){
		save();

		set_source_rgba(0, 1, 0, .5);
		rectangle(0, 0, 100, 100);	
		fill();	

		restore();

		translate(100, 0);
		// set_source_rgba(0, 0, 0, 1); 
		image_surface_draw(image);		
	}
};

offline();
mgraphics.redraw();

March 19, 2014 | 1:44 pm

I can confirm a bit of an issue here with the alpha calculation. Looks like its been this way since the beginning. We will take a closer look, thanks!

-Ben


March 19, 2014 | 2:36 pm

thank you Ben


Viewing 3 posts - 1 through 3 (of 3 total)