Author Topic: Loading & pre-storeing Images  (Read 2982 times)

0 Members and 1 Guest are viewing this topic.

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Loading & pre-storeing Images
« 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.
« Last Edit: August 25, 2007 by Clyde »
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Merick

  • Atari ST
  • ***
  • Posts: 113
  • Karma: 7
    • View Profile
Re: Loading & pre-storeing Images
« Reply #1 on: August 25, 2007 »
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.

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17394
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Loading & pre-storeing Images
« Reply #2 on: August 25, 2007 »
You should use bmp2raw and bin2bas by rbraz, those tools are in the showcase and also contain examples of how to use them :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Loading & pre-storeing Images
« Reply #3 on: August 25, 2007 »
If I remember rightly the images are stored as an entire block (Width*Height)

Thanks I'll have a search for them.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Shockwave

  • good/evil
  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 17394
  • Karma: 498
  • evil/good
    • View Profile
    • My Homepage
Re: Loading & pre-storeing Images
« Reply #4 on: August 25, 2007 »
The images are stored as an entire block of colour palette references Clyde. The colour palette is in R G B order. :)
Shockwave ^ Codigos
Challenge Trophies Won:

Offline Merick

  • Atari ST
  • ***
  • Posts: 113
  • Karma: 7
    • View Profile
Re: Loading & pre-storeing Images
« Reply #5 on: August 26, 2007 »
You could probably use the incfile macro for this too, just as long as your image loader functions support loading from memory.  ;)

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: Loading & pre-storeing Images
« Reply #6 on: August 26, 2007 »
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.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won: