This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Friday, December 1, 2006 5:53:51 AM(UTC)
Groups: Registered
Posts: 15
I have a lead main control that I am drawing transparent rectangles on using the digital paint control. When I display the recto on the main control the color looks fine (Transparent Red). When I save the image with the LeadMain control the color of the transparet rect is not correct (Transparent Blue). Any help would be greatly appreciated.
Code to draw rect:
m_leadMainControlFinish.SetBitmap(m_leadMainControlAOI.GetBitmap());
m_leadMainControlFinish.ColorRes(32, CRP_FIXEDPALETTE, CRD_NODITHERING, 0);
m_leadPaintControl.SetMetrics(m_leadMainControlFinish.GetHWnd(), m_leadMainControlFinish.GetBitmap());
m_leadPaintControl.GetShape().SetBorderColor(RGB(255, 0, 0));
m_leadPaintControl.GetShape().SetBackgroundColor(RGB(255, 0, 0));
m_leadPaintControl.GetShape().SetOpacity(128);
m_leadPaintControl.GetShape().DrawRect(lLeft, lTop, lWidth, lHeight);
Code to save image:
m_leadMainControlFinish.Save(szFilename, FILE_PPM_BINARY, 24, -1, 0);
#2
Posted
:
Sunday, December 3, 2006 8:25:05 PM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
I have tried to generate this using our MFC
Digital Paint Automation and it seem to work fine. Can you try to generate your
issue using this demo? If it works fine, can you please make a small project (not
your full application) and attach it here in a zip file so I can check it for
you.
#3
Posted
:
Monday, December 4, 2006 4:48:01 AM(UTC)
Groups: Registered
Posts: 15
I have included a sample program that show this behavior. Inside the sample app I load up an image, draw a transparent rect using digital paint, save the image to file then display the resulting image. The rect on the original image is transparent red. The rect on the saved image is transparent blue.
jp
#4
Posted
:
Wednesday, December 6, 2006 6:51:13 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
To solve your issue add "CRP_BYTEORDERBGR" to the
m_leadMainCtrl.ColorRes function as follows:
m_leadMainCtrl.ColorRes(32, (CRP_FIXEDPALETTE |
CRP_BYTEORDERBGR), CRD_NODITHERING, 0);
The reason for this is, when you are converting a grayscale
image into color RGB image the Red and Blue colors are swapped. You should use
the BGR flag to get the correct order.
#5
Posted
:
Wednesday, December 6, 2006 7:15:03 AM(UTC)
Groups: Registered
Posts: 15
That was it!! Thanks for the info.
jp
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.