Question How to efficiently draw data?

SaschaP

New member
Joined
Jun 20, 2017
Messages
1
Programming Experience
3-5
Hi!

I've the following aim:
I would like to draw a huge image on a WinForms Panel or Image/Bitmap.

The base data for the image are about 50.000 datasets with a length of about 1024 bytes each. Each byte is splitted into bits, if the bit is 1 the related pixel is black, if 0 the pixel is white (or better transparent). Each dataset is a column in the image, each bit a row.

What I have so far:
I'm using a Bitmap to draw the data on it. The Bitmap is shown inside a Picurebox so I can scroll the whole image without repainting the whole data every time.
This works very well, BUT I would like to provide a zoom-function. At the moment the user can choose how many pixels a bit should require, after that the image gets repainted. But as you can imagine with a "zoom-factor" greater than 5-7 pixel per bit I get an OutOfMemoryException... Also, at the moment I only provide zoom in vertical direction, not in horizontal!

My question:
Is there an elegant way to solve my task without using the whole memory?
One of my ideas would be to draw the data directly to the viewing panel, but then I only could draw a portion of the image and would have to create a complicated (?) logic for repainting the right part of the image... But with this solution I also would be able to provide unlimited zoom-functionality as I wouldn't need more memory...
Any Ideas or hints I could follow?

Thanks in advance,
Sascha
 
Back
Top Bottom