CodeBase - Create image from Data

Return to the CodeBase listing

Category: Bitmap

Version: 1.0

0
0

Information

Uploaded: 2nd Mar 2008 12:15

Modified: 2nd Mar 2008 12:20

Author:  Dewi Morgan

Summary

Very simple but handy li'l function to read in RGB triplets from data statements, and make an X*Y image from them, via a memblock. Very handy for making medialess programs.

Full Description

Very simple but handy li'l function to read in RGB triplets from data statements, and make an X*Y image from them, via a memblock.<br /> <br /> I'm sure this has been done a billion times, since it's so handy for making medialess programs.<br /> <br /> Changes you might want to make:<br /> 1) I write the fourth byte, alpha transparency, as the constant &quot;255&quot;, meaning &quot;completely opaque&quot;. You might want to read it in from a data statement instead, so you can make images with transparent areas.<br /> <br /> 2) I read from a data statement. You might want to read from a file or array or memblock or the screen or some other data source, instead.<br /> <br /> 3) I use IanM's &quot;find free memblock()&quot; and &quot;find free image()&quot; functions - if you do not want to use these, just give them an id, possibly passed as an optional parameter, or read from the data statement. In that case you might also want to do something like &quot;if image exist ImageID then delete image ImageID&quot;, or &quot;...endfunction 0&quot; or something.<br /> <br /> 4) There's no reason the header of the image couldn't be stored in the data statement too. In which case, of course, you needn't pass parameters to the function.

Comments

No comments yet.