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 : Monday, June 11, 2007 2:45:05 AM(UTC)

VadimR  
VadimR

Groups: Registered
Posts: 20


Hi,

I use the LEADTOOLS C++ Classlib Version 14.5. I try to change color order in the dialog Color Resolution. In the window "After " I get a changing in the image. But after press button OK I obtain a same image without changing. Please, help solve this problem.

I use code shown below:

CUserBitmapWin m_Image;

int OnColorResolution()
{
 COLORRESDLGPARAMS DlgParams;

   m_Image.DialogColor( )->Initialize(DLG_INIT_COLOR);
   memset ( &DlgParams, 0, sizeof ( COLORRESDLGPARAMS ) ) ;

   DlgParams.uStructSize = sizeof ( COLORRESDLGPARAMS ) ;
   DlgParams.uDlgFlagsEx = DLG_COLORRES_SHOW_BITALL |
                           DLG_COLORRES_SHOW_DITHER_ALL |
                           DLG_COLORRES_SHOW_PAL_ALL ;
   DlgParams.uDlgFlags   = DLG_COLORRES_SHOW_OPENPALFILE |
                           DLG_COLORRES_SHOW_ORDER;


   m_Image.DialogColor()->EnableCallBack(FALSE);
   m_Image.DialogColor()->EnablePreview(TRUE );
   m_Image.DialogColor()->EnableAutoProcess(TRUE);
   m_Image.DialogColor()->EnableToolbar(TRUE);
   m_Image.DialogColor()->SetColorResParams(&DlgParams) ;
   return  m_Image.DialogColor()->DoModalColorRes(hWnd);
}

Files UserBitmapWin.h  and UserBitmapWin.cpp are attached.

Best regards,

VadimR 

File Attachment(s):
UserBitmapWin.zip (2kb) downloaded 23 time(s).
 

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 : Tuesday, June 12, 2007 9:02:10 AM(UTC)

Adnan Ismail  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)


VadimR,


I looked at the attached files, but they do not contain a complete project.


I tested this using our main C++ Class Library demo, and the
image does change. If you can't get it to work in your application, please create
a complete small test working project (not your application) that shows this issue and send it to me.

 
#3 Posted : Wednesday, June 13, 2007 5:08:15 AM(UTC)

VadimR  
VadimR

Groups: Registered
Posts: 20


Hi, Adnan Ismail !

The project for testing is made and attached.

Best regard,

Vadim

File Attachment(s):
TestColRes.zip (331kb) downloaded 24 time(s).
 
#4 Posted : Thursday, June 14, 2007 8:03:20 AM(UTC)

Adnan Ismail  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

Vadim,









I checked the issue and found it reason.
When you use the color resolution function to change the byte order from BGR to RGB, 2 things happen:
1. The Blue and Red bytes are swapped.
2. The bitmap's internal flag that determines byte order is set to ORDER_RGB.






When you save the image after that to BMP, the BMP format
only supports BGR byte order, so the toolkit internally returns the byte back to BGR during saving to disk.
If you want the image to keep the bytes reversed, you should
swap them without flagging the image as ORDER_RGB. To do that, call the following function instead of using the dialog:
m_Image.SwapColors(SWAP_RB);

 
#5 Posted : Sunday, June 17, 2007 12:48:21 AM(UTC)

VadimR  
VadimR

Groups: Registered
Posts: 20


Hi, Adnan Ismail !

How to distinguish user change ORDER_BGR to ORDER_RGB after dialog closing or not change?

Best regard,

Vadim

 
#6 Posted : Tuesday, June 19, 2007 7:09:48 AM(UTC)

Adnan Ismail  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

Vadim,





Use the uColorResFlags member in the COLORRESDLGPARAMS structure to retrieve the color order after closing the dialog.
If you bitwise-AND (&) this flag with CRF_BYTEORDERBGR (4), and the result is also 4, this means the user selected BGR.
If the result is zero, this means the user selected RGB (or selected a bit depth that doesn't have BGR/RGB option).

 
#7 Posted : Tuesday, June 19, 2007 10:57:48 PM(UTC)

VadimR  
VadimR

Groups: Registered
Posts: 20


Hi, Adnan Ismail !

Thank for help.

Sincerely,

VadimR

 
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.122 seconds.