• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 560
  • Last Modified:

BitBlt

I've seen the documentation in MSDN on the ROPs.Can someone give me a detailed explanations on the various common ROPs, like SRCCOPY, SRCAND, SRCINVERT etc, in the form like

src =
blue background + red text

destination = black bg + yellow text

using SRCINVERT

result == ???

Thanks :)
0
RodneyYeo
Asked:
RodneyYeo
  • 4
  • 3
1 Solution
 
chensuCommented:
For detailed explanation, see

Ternary Raster Operations
http://msdn.microsoft.com/library/psdk/gdi/pantdraw_6n77.htm

For results, writing a simple testing program to try it out may be better and more accurate.
0
 
RodneyYeoAuthor Commented:
I've already seen that page :)
But it's very confusing. Any way to make it simpler to understand
0
 
Jan LouwerensSoftware EngineerCommented:
BitBlt doesn't distinguish between backgrounds or text. It's a bit by bit block transfer of one section of memory to another (for flipping images to the screen, or copying sections of the screen to another location on the screen).

SRCCOPY = an exact duplicate of the source is copied to the destination

SRCAND = the bits of the source are bitwise ANDed with the bits of the destination

SRCINVERT = the source is "inverted" as it is copied to the destination. ("inverted" meaning that the "opposite" colors will be diplayed - sorry, not being an expert in color theory, my explanation of this can't be any better)
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
RodneyYeoAuthor Commented:
If I have a bitmap with a green background with a red circle in the centre, how can i make the background look transparent? Can you explain your answer. THanks :)
0
 
chensuCommented:
Transparent Bitmap - True Mask Method
http://www.codeguru.com/bitmap/CISBitmap.shtml
0
 
RodneyYeoAuthor Commented:
I've seen the code that you have suggested..just a question..why do you have to do these 2 lines?

dcImage.SetBkColor(crColour);
dcTrans.BitBlt(0, 0, nWidth, nHeight, &dcImage, 0, 0, SRCCOPY);

0
 
chensuCommented:
That is to build a monochrome mask based on the transparent color. dcTrans is a monochrome DC while dcImage is a color DC that contains the original bitmap. When BitBlting a color bitmap to a monochrome bitmap, it sets pixels that match the background color of the color DC to white (1) and sets all other pixels to black (0).
0
 
RodneyYeoAuthor Commented:
Thanks. I think I'm have a better understanding now.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now