DirectDraw Image Processing
From: Steve Severance (anonymous_at_discussions.microsoft.com)
Date: Tue, 25 May 2004 13:16:08 -0700
I am attempting to use DirectDraw to perform image processing on very large 2D medical images. Using reqular windows stuff is just not fast enough for what I am doing. I have been trying to get a small piece of loading code to work for a number of weeks. Here is the problem:
My image data is 12 bit grayscale data packed into 2 bytes. I can take that and load it and perform a manual conversion to 8 bit grayscale and then store it in a bitmap which is not a problem to do but it is very slow, requiring 10 seconds to load. I want to store the 12 bit data in a direct draw surface and then create another surface with the 8bit data in it. I tried making the second surface a 24 bit rgb surface but it throws an expection when I create the surface saying that the format is invalid.
PixelFormat format = new PixelFormat();
format.Rgb = true;
format.RgbBitCount = 24 ;
desc2.PixelFormatStructure = format;
If I don't make it 24 bit it throws another exception about something inside directx being null. I am really kind of lost. The docs are terrible and haven't really been any help. I think this is fairly unique as a problem but maybe not. Any help would be appreciated.