Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Friday, December 1, 2006 5:53:51 AM(UTC)
jon-paul.faucher

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);
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Sunday, December 3, 2006 8:25:05 PM(UTC)

Adnan Ismail  
Guest

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)
jon-paul.faucher

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

File Attachment(s):
TestSave.zip (2,253kb) downloaded 26 time(s).
 
#4 Posted : Wednesday, December 6, 2006 6:51:13 AM(UTC)

Adnan Ismail  
Guest

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)
jon-paul.faucher

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.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.091 seconds.