|
-
Feb 2nd, 2003, 07:28 PM
#1
Thread Starter
Addicted Member
Create "layers" like Photoshop/Paint shop pro **resolved**
OK. I got a webcam program that I'm writing. I got everything I need including the camera capture, and the upload portion. I just want to do one thing.
I want to add a watermark based on an image and a position that the user specifies. I have the underlying image on a picturebox and I want to put the watermark image overtop of it like another layer, then add it to the picture property.
Anybody have any good methods of doing this?
Last edited by WALDO; Feb 3rd, 2003 at 09:44 AM.
-
Feb 2nd, 2003, 09:36 PM
#2
Lively Member
look up the BitBlt function in the search box. look up the raster op codes also for it, i forget which ones will give you that transparent watermark effect
-
Feb 2nd, 2003, 10:56 PM
#3
Thread Starter
Addicted Member
Been trying BitBlt, no success
VB Code:
hdcWatermark = LoadImage(0, strPath, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE)
lResult = BitBlt(frmCapture.Picture1.hdc, 0, 0, _
96 * 15, _
11 * 15, _
hdcWatermark, 0, 0, vbSrcCopy)
No effect
-
Feb 3rd, 2003, 12:40 AM
#4
Good Ol' Platypus
* 15 is for..? BitBlt uses pixels, so you needn't worry about Twips. And, SrcCopy will give you a big ol' rectangle around the image...
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Feb 3rd, 2003, 12:52 AM
#5
Frenzied Member
LoadImage doesnt reaturn an HDC.
Z.
-
Feb 3rd, 2003, 08:06 AM
#6
Good Ol' Platypus
Create a DC with CreateCompatibleDC, and use SelectObject to select the bitmap you get from LoadImage into it.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Feb 3rd, 2003, 09:43 AM
#7
Thread Starter
Addicted Member
Yeah, that worked.
Originally posted by Sastraxi
Create a DC with CreateCompatibleDC, and use SelectObject to select the bitmap you get from LoadImage into it.
VB Code:
lResult = LoadImage(0, strPath, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE)
hdcWatermark = CreateCompatibleDC(0)
Call SelectObject(hdcWatermark, lResult)
lResult = BitBlt(frmCapture.Picture1.hdc, 0, 0, _
96 * 15, _
11 * 15, _
hdcWatermark, 0, 0, vbSrcCopy)
-
Feb 3rd, 2003, 12:27 PM
#8
Hyperactive Member
don't forget to delete the object or you'll crash after about 15-20 iterations depending on your memory. This code might help you delete it properly:
Dim hMemDC As Long
Dim hOldBMP As Long
' Create memory DC
hMemDC = CreateCompatibleDC(Me.hdc)
' Select bitmap into it, storing the previous value
' (SelectObject returns the previous bitmap which
' was selected into the DC)
hOldBMP = SelectObject(hMemDC, CreateCompatibleBitmap(Me.hdc, Width, Height))
'
' Now you can draw...
'
' First, select the old bitmap back into the DC and delete our bitmap
DeleteObject(SelectObject(hMemDC, hOldBMP))
' Now delete the DC
DeleteDC(hMemDC)
-
Feb 3rd, 2003, 12:40 PM
#9
Thread Starter
Addicted Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|