Performance problems

J

James Dean

I am wondering is there an easier way to save memory than splitting a
whole image into blocks. If the block is white then it takes up no
memory basically at all and so storing image data in an array of blocks
is efficient. But i am thinking with C# there must be a less complicated
way.....At the moment i have 1bpp data stored in an array to tell me if
a bit is turned on or off. I only deal with 4 colors so i create a new
1bpp byte array for each color and then create my bitmap by seeing which
colors are set in each array and displaying one 24bpp bitmap from
that.If colors overlap i set it to an average color. I take it that this
clone method will be useful to clone only the rectangle that the
graphics region needs at any time. So maybe is my best option to only
draw the graphics rectangle thats needed by the program each time rather
than creating the full bitmap and then returning parts of that all the
time?. I would like some expert advice if u can advise me whats best to
do.
Thanks in advance.
 
G

Guest

Hi James,

If you fight with performance problem then you should choose the one:
a) more speed, more memory
b) less speed, less memory

Second option is usually accomplished by a image compression.
I am wondering is there an easier way to save memory than splitting a
whole image into blocks. If the block is white then it takes up no
memory basically at all and so storing image data in an array of blocks
is efficient. But i am thinking with C# there must be a less complicated
way.....

This algorithm looks like Q-TREE (or OCT-TREE in 3D).
But i'm affraid that csharp doesn't have any support for
this algorithm in a standard version.
At the moment i have 1bpp data stored in an array to tell me if
a bit is turned on or off. I only deal with 4 colors so i create a new
1bpp byte array for each color and then create my bitmap by seeing which
colors are set in each array and displaying one 24bpp bitmap from
that.If colors overlap i set it to an average color. I take it that this
clone method will be useful to clone only the rectangle that the
graphics region needs at any time. So maybe is my best option to only
draw the graphics rectangle thats needed by the program each time rather
than creating the full bitmap and then returning parts of that all the
time?.

I think, that it depends on how fast the changes occures in your data.
A second way, is to refresh only changed area (as you mentioned),
eg. by its extend (rectangle).
You should keep (at least) one buffer (eg. 24bpp Bitmap) for
displaying purposes.
I would like some expert advice if u can advise me whats best to
do.

Hey experts!
Join this thread ;)

Cheers

Marcin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top