Page 1 of 1

Saving pixels on canvas?

PostPosted: Tue Nov 05, 2013 10:24 pm
by benzoe590
Is there any way you can save pixels on a canvas? Maybe to a bmp file?

Re: Saving pixels on canvas?

PostPosted: Wed Nov 06, 2013 3:43 am
by skydereign
benzoe590 wrote:Is there any way you can save pixels on a canvas?

Currently no. You can save out bmp files from gE, and use canvas to display them, but if you wanted to use draw_from and have it save out the canvas to a bmp file, that would not work. If however you can handle the array that stores the rgb values of the canvas, you can use that to write out the bmp. For example:
Code: Select all
setpen(0, 0, 0, 0, 1);
putpixel(10, 10);
bmp_array[10][10][0] = 0; // r
bmp_array[10][10][1] = 0; // g
bmp_array[10][10][2] = 0; // b

// this would work because you are updating an array that holds the values of the bmp

Code: Select all
draw_from("player", 0, 0, 5);
// this can't be saved, as there is no way of storing it into an array

Re: Saving pixels on canvas?

PostPosted: Sun Nov 10, 2013 1:28 am
by benzoe590
Thanks!