Jump to content



Photo
- - - - -

Memory Consumption With Pictures


  • Please log in to reply
4 replies to this topic

#1 Fez

Fez

    Casio Freak

  • Members
  • PipPipPipPip
  • 162 posts
  • Gender:Male
  • Location:Australia

  • Calculators:
    Casio fx-9860G AU

Posted 01 February 2008 - 02:16 PM

I just want to know, is there a way around memory consumption with pictures. I create my images in paint and then convert it to an array using sebholls converter. But with every new void that i create to do this, it creates a new array with a size of 1024 each. Is there a way around this?

At the moment I'm thinking of just creating a main void called draw_pic, with a number as it's param. Then depending on what the number is it will declare the array with the appropiate data. But i'm not sure if you can declare within a switch statement.

Someones help here would be wonderfull XD

#2 Andreas B

Andreas B

    Casio Freak

  • Members
  • PipPipPipPip
  • 160 posts
  • Gender:Male
  • Location:Norway

  • Calculators:
    fx-9860G SD

Posted 01 February 2008 - 05:23 PM

But with every new void that i create to do this, it creates a new array with a size of 1024 each.

That does not really explain much.

Can't you keep the image data global?

#3 Fez

Fez

    Casio Freak

  • Members
  • PipPipPipPip
  • 162 posts
  • Gender:Male
  • Location:Australia

  • Calculators:
    Casio fx-9860G AU

Posted 02 February 2008 - 12:45 AM

I Tried that, but with every new void that draws it, it wont accept the new data.

const char imgdata[1024];void draw_main_screen(){imgdata = {0xFF ... }// Draw it to screen junk}
const char imgdata[1024];void draw_main_screen(){imgdata[] = {0xFF ... }// Draw it to screen junk}

Thats everything ive tried with a global array. But the first one says

Illegal Token "{"
Illiegal Token "{"


Then the second one says

Illegal Token "]"
Illegal Token "{"
Source file to complex


What am I doing wrong here XD

#4 Andreas B

Andreas B

    Casio Freak

  • Members
  • PipPipPipPip
  • 160 posts
  • Gender:Male
  • Location:Norway

  • Calculators:
    fx-9860G SD

Posted 02 February 2008 - 01:55 PM

You have to specify the initialization data when the array is declared;

const char myimg[500] = {0xFF, ...}
const char anotherimg8 = {0xFE, ...}

and so on. Those won't take up space in 'memory', only in the addin.

#5 Fez

Fez

    Casio Freak

  • Members
  • PipPipPipPip
  • 162 posts
  • Gender:Male
  • Location:Australia

  • Calculators:
    Casio fx-9860G AU

Posted 02 February 2008 - 02:24 PM

Oops XD. I meant decrease the size of the addin. I know that with each new array[1024] is declared its adding more to the size of the addin, i think it adds 4056 bytes but im not sure. I have 4 Pics so far and the addin size has just hit over 30000 bytes. How would I decrease this size with so many pictures.

As a last(and i mean VERY last) resort i am going to open the pics up in paint and do a Bdisp_DrawLineVRAM() for every line on the pic. it might just reduce the size XD.

sorry for not being clearer. I'm gonna hafta work on that :P




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users