LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

RGB vs BGR 24bit bitmaps

CVI stores 24bit bitmaps as 3 bytes RGB values. Windows stores bitmaps in
BGR format. The use of 3rd parts image manipulation library is made
difficult (slow) since we need to swap R & B bytes before displaying image
in order to have right colors.

Is there any way to make bitmaps compatible (like compiler directives) ? Is
there any way to have the Device Contest (Win32 sdk, GetDC) or the window
handle of a child panel ? This will allow us to speed up our application.

Thank's in advance

--
Marco Turra
Soft. Department

HI-TEC S.r.l.
Via Agrigento 9
20148 - MILAN
ITALY

Tel. +39.02.39262464
Fax. +39.02.39260434

Web Site: http://www.hi-tec.it
E-mail : marco.turra@hi-tec.it
0 Kudos
Message 1 of 8
(6,732 Views)
Hi,

I pretty sure that CVI does not have any compiler directive that would force it to use BGR colors. However I was able to get the device context and draw a rectangle directly into the Window. It's a bit tricky for child panels. You must launch the CVI panel as a top level panel; and use the SDK functions to force it to be a child otherwise the Window handle is not valid.

Please take a look at this small example and let me know if you have any further questions.

Regards,

Juan Carlos
N.I.
0 Kudos
Message 2 of 8
(6,732 Views)
Ok, i've saw your samples. This works but require a redisign of my
application. So i keep my "slow" method for now.

I'm almost surprised that cvi doesn't use standard window manager to draw ui
objects.

Thank's

--
Marco Turra
Soft. Department

HI-TEC S.r.l.
Via Agrigento 9
20148 - MILAN
ITALY

Tel. +39.02.39262464
Fax. +39.02.39260434

Web Site: http://www.hi-tec.it
E-mail : marco.turra@hi-tec.it

"JuanCarlos" wrote in message
news:5065000000050000008AAA0100-1079395200000@exchange.ni.com...
> Hi,
>
> I pretty sure that CVI does not have any compiler directive that would
> force it to use BGR colors. However I was able to get the device
> context and draw a rectangle directly into the Window. It's a bit
> tricky for child panels. You must
launch the CVI panel as a top level
> panel; and use the SDK functions to force it to be a child otherwise
> the Window handle is not valid.
>
> Please take a look at this small example and let me know if you have
> any further questions.
>
> Regards,
>
> Juan Carlos
> N.I.
0 Kudos
Message 3 of 8
(6,732 Views)
It' kind of trade-off; bitmap files are stored in RGB format and our IMAQ image processing libraries use RGB. Also most applications use CVI native functions to handle bitmaps.

Let us know if you have any further questions.

Regards,

Juan Carlos
N.I.
0 Kudos
Message 4 of 8
(6,732 Views)
Thank's Juan,

but I am not using IMAQ. Just to make you understand my little problem, I'm
using a third part library to decode movies (avi, mpeg, etc) and using
picture control to display frames. The library give me native BGR bitmaps,
as almost any windows compilant bitmap library should. For every frame i
need to translate in RGB to properly display colors in picture ctrl.

You can se the software "in action" in attached jpg 😉

CVI is very painless, usefull and easy C development system. A new control
that allow to use device contest in it and an implementation of WM_PAINT for
that control may be very usefull for advanced programming. Also an embedded
interface for standard windows contols (xp style buttons, checkbox etc..)
will
make us happy, but this is another point.

Thank's again


--
Marco Turra
Soft. Department

HI-TEC S.r.l.
Via Agrigento 9
20148 - MILAN
ITALY

Tel. +39.02.39262464
Fax. +39.02.39260434

Web Site: http://www.hi-tec.it
E-mail : marco.turra@hi-tec.it

"JuanCarlos" wrote in message
news:506500000005000000B1AC0100-1079395200000@exchange.ni.com...
> It' kind of trade-off; bitmap files are stored in RGB format and our
> IMAQ image processing libraries use RGB. Also most applications use
> CVI native functions to handle bitmaps.
>
> Let us know if you have any further questions.
>
> Regards,
>
> Juan Carlos
> N.I.



[Attachment crashmovie.jpg, see below]
0 Kudos
Message 5 of 8
(6,732 Views)
Marco,

That is quite an amazing application you have. I think this are very good suggestions. Having the device context helps, however having an attribute in the picture control to change between RGB and BGR would be best. The best way to get your suggestions heard is throug http://www.ni.com/contact (select product feedback) those go directly to our engineering department. I would appreciate if you file these ideas through that wizard.

Thanks and good luck in your project.

Ciao.
0 Kudos
Message 6 of 8
(6,732 Views)
Hi Juan,

I'm posted my suggestions to ni product feedback.

My project is (relative) slow but actually complete 😉

Ciao

"JuanCarlos" wrote in message
news:5065000000050000006CAD0100-1079395200000@exchange.ni.com...
> Marco,
>
> That is quite an amazing application you have. I think this are very
> good suggestions. Having the device context helps, however having an
> attribute in the picture control to change between RGB and BGR would
> be best. The best way to get your suggestions heard is throug
> http://www.ni.com/contact (select product feedback) those go directly
> to our engineering department. I would appreciate if you file these
> ideas through that wizard.
>
> Thanks and good luck in your project
.
>
> Ciao.
0 Kudos
Message 7 of 8
(6,732 Views)
Thanks for your comments, we realy appreciate it. The more we know what customers need from CVI, the better we can make the product.

Have good weekend.

Juan Carlos
0 Kudos
Message 8 of 8
(6,732 Views)