By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,650 Members | 812 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,650 IT Pros & Developers. It's quick & easy.

SelectActiveFrame bug

P: n/a
It looks like this problem was already posted (in two different newsgroups):

http://groups.google.com/groups?hl=e...mework.drawing
http://groups.google.com/groups?hl=e...oogle%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

Nov 22 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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.
--------------------

Nov 22 '05 #2

P: n/a
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.
--------------------

Nov 22 '05 #3

P: n/a
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=e...readm=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.publi c.dotnet.framework.drawing http://groups.google.com/groups?hl=e...readm=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


Nov 22 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.