kiranreddys.com
Kiran's personal website
Blog    Forums   Sitemap   Social    Phone
 
     

 
Knowledgebase
 
Home
Knowledge base home, and site home.
Categories
List of all Knowledge base categories.
Glossary
An alphabetical list of technical terms.
Contact Me
Contact me for knowledge base questions
My Blog
My articles, white papers, ideas and thoughts.
 

 
 


Painting using BitBlt

Date Added January 1, 1970 | Print | Bookmark
'Code By Kiran
'Painting a normal picture and a transparent picture using Bitblt API
'Constant Declarations
'Copies the source bitmap to destination bitmap

Public Const SRCCOPY = &HCC0020
'Combines pixels of the destination with source bitmap using the boolean AND operator.
Public Const SRCAND = &H8800C6
'Combines pixels of the destination with source bitmap using the boolean XOR operator.
Public Const SRCINVERT = &H660046
'Combines pixels of the destination with source bitmap using the boolean OR operator.
Public Const SRCPAINT = &HEE0086
'Inverts the destination bitmap and then combines the results with the source bitmap using the boolean AND operator.

Public Const SRCERASE = &H4400328
'Turns all output to white.
Public Const WHITENESS = &HFF0062
'Turns output to black.
Public Const BLACKNESS = &H42
'API Declarations
Public Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long

'Painting picture from Picture2 to Picture1 (You can use diferent constants as per your requirements)
Dim RetVal as Long
RetVal = BitBlt(Picture1.hDC, 0, 0, 320, 200, Picture2.hDC, 0, 0, SRCCOPY)

'To paint transparent picture, you need to create two mask pictures, Picture2 and Picture3 one with white background another with black background
Dim RetVal as Long
RetVal = BitBlt(Picture1.hDC, 0, 0, 320, 200, Picture2.hDC, 0, 0, SRCAND)
RetVal = BitBlt(Picture1.hDC, 0, 0, 320, 200, Picture3.hDC, 0, 0, SRCPAINT)

Was this article helpful?

Yes No

Category: VB Graphics and API

Last updated on January 1, 1970 with 4005 views

0 User Comments

There are no comments yet...Kick things off by filling out the form below.

Leave a Comment

CAPTCHA Image
Security code

 



Home | About Me | Products | Support | Contact | Knowledgebase | Forums | Blog | Site map | Site Search | Subscribe | Links | Social | News

Travel | Guest Book | All Pages | History | Site Calendar | Recipes | Ex-Rates | UK Stuff | Downloads | Telugu Stuff | Tell a Friend | Feedback

Bookmark and Share
www.kiranreddys.com
Terms of Use
Site contents Copyright © 2008-2009 Kiran Reddy. All rights reserved.