Graphics Object on indexed Bitmap
-
Hi there, I have a huge problem with Graphics Object. My application shows pictures in a picturebox. Now I want to draw multiple frames (rectangles) onto the shown image (regions of interest). The most easy and acceptable way is to create a graphics object from the image and do the drawRectangle function on it. If the image is scaled or zoomed the rectangle(s) will always grow and shrink in same relations! this is very important! Problem: My bitmap is format8bppindexed with a monochrome colorPalette added by myself, so I isn't possible to create a graphics object! It's very important, that I can refresh the images as fast as possible (best with just changing the scan0 pointer). Is there a possible way to get a graphics object from such an image? Or has anyone an idea how I could come up with that rectangle drawing thing? I would be so happy about a good answer! Thanks and have a nice day...
-
Hi there, I have a huge problem with Graphics Object. My application shows pictures in a picturebox. Now I want to draw multiple frames (rectangles) onto the shown image (regions of interest). The most easy and acceptable way is to create a graphics object from the image and do the drawRectangle function on it. If the image is scaled or zoomed the rectangle(s) will always grow and shrink in same relations! this is very important! Problem: My bitmap is format8bppindexed with a monochrome colorPalette added by myself, so I isn't possible to create a graphics object! It's very important, that I can refresh the images as fast as possible (best with just changing the scan0 pointer). Is there a possible way to get a graphics object from such an image? Or has anyone an idea how I could come up with that rectangle drawing thing? I would be so happy about a good answer! Thanks and have a nice day...
I've personally always kept regions of interest separate from the image, just drawing the ROIs at render time instead of drawing on the actual image data. A couple possibilities: 1) Use double buffering. Use a graphics object created for a bitmap with the same bit depth as the screen. Draw the image to the graphics, draw the ROIs on the graphics, and render the bitmap to the screen. 2) Use GDI directly via platform invoke.
Mark Salsbery Microsoft MVP - Visual C++ :java: