Dark Bit Factory &  Gravity
		PROGRAMMING => Freebasic => Topic started by: Clyde on August 25, 2007
		
			
			- 
				Does anyone know of a way to get hold of the image data r/g/b and have it stored as Data statements within Freebasic? I'll be using TinyPTC which I always use.
What I'd like to do is have the data setout so it can be read in, by using for example ImageData1(Width,Height)=RGB
Cheers and thanks very much,
Clyde.
			 
			
			- 
				I don't know about other graphics libs like tinyptc or whatever, however if you are using FB's internal fbgfx graphics library and have the image loaded into an FB.Image ptr, you can use "Point (x, y), img" to get the color attribute for each pixel in the image, and then "PSet img, (x,y), color" to rebuild the image from data. One thing to remember though is that the results will vary depending on what bit depth you have the screen set to.
			
 
			
			- 
				You should use bmp2raw and bin2bas by rbraz, those tools are in the showcase and also contain examples of how to use them :)
			
 
			
			- 
				If I remember rightly the images are stored as an entire block (Width*Height)
Thanks I'll have a search for them.
			 
			
			- 
				The images are stored as an entire block of colour palette references Clyde. The colour palette is in R G B order. :)
			
 
			
			- 
				You could probably use the incfile macro for this too, just as long as your image loader functions support loading from memory.  ;)
			
 
			
			- 
				Thanks for the heads up.
I've been using a similar method, with storing my graphics in a resource file and compiling them to the exe. I'm after trying to reduce my exe sizes, as doing it the way I am makes for quite big exes, as in essence the bmps files ( music ) are being attached.
I don't know how much by using the new methods, and a program called upx ( http://upx.sourceforge.net/ ) will reduce them by. Need to get my act together and download it, and test this new found knowledge with Rbraz's tools. Firstly I need to rewrite my tinyptc rendering methods.
Cheers,
Clyde.