Saving pixels on canvas?

Talk about making games.

Saving pixels on canvas?

Postby benzoe590 » Tue Nov 05, 2013 10:24 pm

Is there any way you can save pixels on a canvas? Maybe to a bmp file?
benzoe590
 
Posts: 12
Joined: Sat Jan 26, 2013 2:15 am
Score: 0 Give a positive score

Re: Saving pixels on canvas?

Postby skydereign » Wed Nov 06, 2013 3:43 am

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
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Saving pixels on canvas?

Postby benzoe590 » Sun Nov 10, 2013 1:28 am

Thanks!
benzoe590
 
Posts: 12
Joined: Sat Jan 26, 2013 2:15 am
Score: 0 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: Google [Bot] and 1 guest

cron