SelectActiveFrame bug


C

Christopher Bohn

It looks like this problem was already posted (in two different newsgroups):

http://groups.google.com/groups?hl=...p%3Dmicrosoft.public.dotnet.framework.drawing
http://groups.google.com/groups?hl=...tactiveframe+drawimage+bug&btnG=Google+Search

but neither really had a response that addressed the issue. My company
has also run into this problem. Searching news groups and the web found
very little else on this subject.

Here is an example of the problem:

---------------------------

void Page::LoadImage()
{
int imageHeight = 0;
int imageWidth = 0;

Bitmap* overlayImage;
Bitmap* retrievalImage;
Bitmap* image;

overlayImage = new Bitmap(String::Format("{0}.tiff", pageVariantID));
retrievalImage = new Bitmap(String::Format("image{0}.img",
__box(PageKey)));

// select the correct frame
retrievalImage->SelectActiveFrame(FrameDimension::page, frameNumber);
imageWidth = max(overlayImage->Width, retrievalImage->Width);
imageHeight = max(overlayImage->Height, retrievalImage->Height);

image = new Bitmap(imageWidth, imageHeight,
PixelFormat::Format16bppRgb555);
Graphics* g = Graphics::FromImage(image);
g->Clear(Color::White);

ImageAttributes* imageAttrs = new ImageAttributes();
ColorMap* colorMapOverlay[] = new ColorMap*[1];

colorMapOverlay[0] = new ColorMap();
colorMapOverlay[0]->OldColor = Color::Black;
colorMapOverlay[0]->NewColor = Color::Firebrick;
imageAttrs->SetRemapTable(colorMapOverlay);
g->DrawImage(overlayImage, System::Drawing::Rectangle(Point::Empty,
retrievalImage->Size), 0, 0, retrievalImage->Width,
retrievalImage->Height, GraphicsUnit::pixel, imageAttrs);

colorMapOverlay[0] = new ColorMap();
colorMapOverlay[0]->OldColor = Color::White;
colorMapOverlay[0]->NewColor = Color::Transparent;
imageAttrs->SetRemapTable(colorMapOverlay);
g->DrawImage(retrievalImage, System::Drawing::Rectangle(Point::Empty,
retrievalImage->Size), 0, 0, retrievalImage->Width,
retrievalImage->Height, GraphicsUnit::pixel, imageAttrs);

overlayImage->Dispose();
overlayImage = NULL;
retrievalImage->Dispose();
retrievalImage = NULL;
}

---------------------------

The active frame seems ignored when another image is overlayed. The
older, referenced post gives more details and another example. Is this
a known bug? Is there any work-around (other than extracting each frame
of a multi-image tiff)? Is a fix expected, and if so, in what time frame?

thanks
Chris
 
Ad

Advertisements

G

Gary Chang

Hi Christopher,

Thanks for using Microsoft MSDN Managed Newsgroup.

Currently I am looking for somebody who could help you on it. We will reply
here with more information as soon as possible.
If you have any more concerns on it, please feel free to post here.


Best regards,

Gary Chang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
 
Ad

Advertisements

J

John Hornick [MSFT]

Hi,

This does look like a bug in GDI+. The problem is with the interaction
between the ImageAttributes and the active frame. It appears that any
changes to the ImageAttributes cause the DrawImage() call to use frame 0.

So, one workaround would be to not use the DrawImage() call which uses
ImageAttributes. Another, as you've noted, would be to extract the frame
into another Bitmap and use that instead.

Please post follow-ups only in microsoft.public.dotnet.framework.drawing,
or microsoft.public.win32.programmer.gdi.

Thanks,
- John
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights.
Visit http://www.microsoft.com/security for current information on security.


It looks like this problem was already posted (in two different newsgroups):http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=utf-8&threadm=08f701c3
9712%24d47cf3b0%24a401280a%40phx.gbl&rnum=2&prev=/groups%3Fhl%3Den%26lr%3D%2
6ie%3DUTF-8%26oe%3Dutf-8%26q%3Dselectactiveframe%2Bdrawimage%2Bbug%26btnG%3D
Google%2BSearch%26meta%3Dgroup%253Dmicrosoft.public.dotnet.framework.drawinghttp://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=utf-8&threadm=u9LmR16l
DHA.2772%40TK2MSFTNGP12.phx.gbl&rnum=2&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3
DUTF-8%26oe%3Dutf-8%26q%3Dselectactiveframe%2Bdrawimage%2Bbug%26btnG%3DGoogl
e%2BSearch

but neither really had a response that addressed the issue. My company
has also run into this problem. Searching news groups and the web found
very little else on this subject.

Here is an example of the problem:

---------------------------

void Page::LoadImage()
{
int imageHeight = 0;
int imageWidth = 0;

Bitmap* overlayImage;
Bitmap* retrievalImage;
Bitmap* image;

overlayImage = new Bitmap(String::Format("{0}.tiff", pageVariantID));
retrievalImage = new Bitmap(String::Format("image{0}.img",
__box(PageKey)));

// select the correct frame
retrievalImage->SelectActiveFrame(FrameDimension::page, frameNumber);
imageWidth = max(overlayImage->Width, retrievalImage->Width);
imageHeight = max(overlayImage->Height, retrievalImage->Height);

image = new Bitmap(imageWidth, imageHeight,
PixelFormat::Format16bppRgb555);
Graphics* g = Graphics::FromImage(image);
g->Clear(Color::White);

ImageAttributes* imageAttrs = new ImageAttributes();
ColorMap* colorMapOverlay[] = new ColorMap*[1];

colorMapOverlay[0] = new ColorMap();
colorMapOverlay[0]->OldColor = Color::Black;
colorMapOverlay[0]->NewColor = Color::Firebrick;
imageAttrs->SetRemapTable(colorMapOverlay);
g->DrawImage(overlayImage, System::Drawing::Rectangle(Point::Empty,
retrievalImage->Size), 0, 0, retrievalImage->Width,
retrievalImage->Height, GraphicsUnit::pixel, imageAttrs);

colorMapOverlay[0] = new ColorMap();
colorMapOverlay[0]->OldColor = Color::White;
colorMapOverlay[0]->NewColor = Color::Transparent;
imageAttrs->SetRemapTable(colorMapOverlay);
g->DrawImage(retrievalImage, System::Drawing::Rectangle(Point::Empty,
retrievalImage->Size), 0, 0, retrievalImage->Width,
retrievalImage->Height, GraphicsUnit::pixel, imageAttrs);

overlayImage->Dispose();
overlayImage = NULL;
retrievalImage->Dispose();
retrievalImage = NULL;
}

---------------------------

The active frame seems ignored when another image is overlayed. The
older, referenced post gives more details and another example. Is this
a known bug? Is there any work-around (other than extracting each frame
of a multi-image tiff)? Is a fix expected, and if so, in what time frame?

thanks
Chris
 

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

Similar Threads


Top