Tuesday, September 16, 2014
 
    Search Web Link
Search Software
    
API Home » Bitmap » StretchBlt

StretchBlt

Category: Bitmap
Hits: 8916 Rating: StretchBlt has been rated 3.70 by  600 users (3.70) votes 600
Rate: 1-star  2-stars  3-stars  4-stars  5-stars
E-mail this API to friend E-mail this Code to a friend  save Bookmark this VB API Function
API Explanation
StretchBlt copies a section of an image from one device to another. This function also allows you to change the original size and dimensions of the image section, unlike the related function BitBlt. In addition to using the straight "copy" method, you can specify other ways of copying the image with the dwRop parameter. What the function actually does is perform a binary operation on the color of the source and destination pixel to calculate the color of the pixel in the transfered image. The point you specify as the location of the copied image in the target object will be the upper-left corner of the image portion. The function returns 0 if the function failed and 1 if it succeeded.

Parameter Information
Declare Function StretchBlt Lib "gdi32.dll" (ByVal hdc 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 hSrcWidth As Long, _
ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long

hDestDC
The device context of the target object (the one that receives the image piece).
x
The x coordinate of the point to put the image inside the target.
y
The y coordinate of the point to put the image inside the target.
nWidth
The width of the image piece in the target.
nHeight
The height of the image piece in the target.
xSrc
The x coordinate of the upper-left corner of the image piece in the source.
ySrc
The y coordinate of the upper-left corner of the image piece in the source.
nSrcWidth
The width of the image piece in the source.
nSrcHeight
The height of the image piece in the source.
dwRop
Exactly one of the following flags specifying what method to use to copy the source image:
SRCAND = &H8800C6
Logically And the two color values (destination = source And destination).
SRCCOPY = &HCC0020
Copy the source image exactly (destination = source).
SRCERASE = &H440328
Logically And the source image and the destination's binary inverse (destination = source And (Not destination).
SRCINVERT = &H660046
Logically Xor the two color values (destination = source Xor destination).
SRCPAINT = &HEE0086
Logically Or the two color values (destination = source Or destination).
Code



' Copy a portion of the image in PictureBox1 to PictureBox2 and
' stretch it to triple its original width. The image's original dimensions are
' 16x32; its new ones are 48x32.
' Source image coordinates: (45,50)-(60,81)
' Target image coordinates: (0,0)-(47,31)

Dim retval As Long ' function return value

retval = BitBlt(PictureBox2.hdc, 0, 0, 48, 32, PictureBox1.hdc, 45, 50, 16, 32, SRCCOPY)





HOME | MUSIC | DOWNLOADS |  GAMES | TEST-QUIZZES | SITEMAP | ABOUT | HELP
Copyright © 2000 - 2013 Ex-designz. All rights reserved. Website Developed By Dexter Zafra of Myasp-net.com
Link to us | Advertisement | Contact us | Privacy Policy | Terms of use | Accessibility