|
From: graham.reeds on 2 May 2008 04:08 I'm trying to display a transparent monochrome bitmap but having real difficulty with it. I've got a 256+ color bitmaps displaying transparently. Unfortunately I can't use TransparentBlt as we need to support pre NT4 machines still. The code that works for the non-mono bitmaps perfectly only displays the bitmaps as white on black, whereas I need it to display transparently with the text color being used as the foreground. The page with the information I seem to need on MSDN is unavailable - it's a page in the archived GDI section. Can anyone give me a simple example of displaying a monochrome bitmap? I have a class that is a simple wrapper around HBITMAP to load the images and another class that displays the image. This takes an instance of the previous class, the mode to display (SRCCOPY, etc), the output rect, and the src rect. The function Blit takes the CDC for the output. Also does using stretchblt pose any issues with monochrome bitmaps? It seems not to, but I thought it might. Can anyone help?
From: Joseph M. Newcomer on 2 May 2008 10:14 It is fairly straightforward. For example, BitBlt it with an operation like SRCAND, which computes dest & src. Every place there is black the result is the 'and' of black (0) with the destination, or black; every place there is white, the result is 'and' of white (0xFF) with the destination, or whatever value is in the destination already. There are a bunch of different BitBlt options that will produce different results. But B&W bitmaps are really easy to deal with because there are only two colors, black (all 0s) and white (all 1s). joe On Fri, 2 May 2008 01:08:07 -0700 (PDT), "graham.reeds" <graham.reeds(a)gmail.com> wrote: >I'm trying to display a transparent monochrome bitmap but having real >difficulty with it. > >I've got a 256+ color bitmaps displaying transparently. Unfortunately >I can't use TransparentBlt as we need to support pre NT4 machines >still. > >The code that works for the non-mono bitmaps perfectly only displays >the bitmaps as white on black, whereas I need it to display >transparently with the text color being used as the foreground. > >The page with the information I seem to need on MSDN is unavailable - >it's a page in the archived GDI section. > >Can anyone give me a simple example of displaying a monochrome bitmap? >I have a class that is a simple wrapper around HBITMAP to load the >images and another class that displays the image. This takes an >instance of the previous class, the mode to display (SRCCOPY, etc), >the output rect, and the src rect. The function Blit takes the CDC for >the output. > >Also does using stretchblt pose any issues with monochrome bitmaps? It >seems not to, but I thought it might. > >Can anyone help? Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm
|
Pages: 1 Prev: How to call DLL file from Visual C++ 4.2? Next: remplacer recordset |