The principle of transparent led displays

- Jan 09, 2019 -

   In fact, the ubiquitous ICONS in Windows are a typical example of a transparent bitmap.

  The first bitmap, which is made up of a black (all color bits are 0) background and a color icon pattern, is called an XOR bitmap because it is combined with the current screen display through an XOR (XOR) operation.The second bitmap is composed of a white (all-color bitwise 1) background AND a black (all-color bitwise 0) icon pattern, which is combined with the current screen display through the (AND) operation, so it is called an AND bitmap.The icon is displayed in two steps:

   The current screen display is combined with AND bitmap by AND operation;

   The current screen display is combined with the XOR bitmap via the XOR operation.


   As you know, the result of 1 AND any numerical AND operation will maintain the original value, while the result of 0 AND any numerical AND operation is 0. Therefore, in step 1, white (1) AND screen display in the AND bitmap are shielded by the original color after AND operation, while black (0) will shield the original color.After step 1, a black icon pattern will be left on the screen.In the following step 2, since the result of 0 being different or different from any value will be the original value, after XOR bitmap and screen display are different or, the black part of the bitmap and screen will be shielded by the corresponding color part.After step 2, an irregularly shaped icon icon appears on the screen.This is how ICONS are displayed.


  Implementation code (VC)

  The usual way to draw a transparent bitmap is to use a mask.The so-called mask is a black and white bitmap, which corresponds to the bitmap to be transparent. The mask describes the part of the bitmap that needs to be transparent, the transparent part is black, and the opaque part is white, and the white part is transparent.


  Suppose figure A is the transparent bitmap to be drawn, figure B is the mask, figure A is A capital letter A, the letter is red, the background is black, figure B is white, there is A black letter A and the shape of figure A is the same.


  For example, if we want to draw picture A transparently on A background of blue sky and white clouds, we will only draw the letter A in red.We can operate on figure B and background first, and then perform or operate on figure B and background

  

594cb12fa374c