|
-
Mar 2nd, 2001, 01:41 PM
#1
Thread Starter
Addicted Member
can I alpha blend a image or picturebox control to what ever is behind it?
-
Mar 2nd, 2001, 08:25 PM
#2
transcendental analytic
Yes if you know what's behind it in the first place
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Mar 2nd, 2001, 10:07 PM
#3
Thread Starter
Addicted Member
-
Mar 3rd, 2001, 03:29 AM
#4
Frenzied Member
For each pixel, you can average the red, green and blue components of the colour, using the ratio of the two alphas as a bias, so it's a weighted average.
Harry.
"From one thing, know ten thousand things."
-
Mar 3rd, 2001, 08:48 AM
#5
transcendental analytic
Or for alpha channels involved, multiply soruce component with alpha, and add target component multiplied by 1-alpha
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Mar 3rd, 2001, 07:45 PM
#6
Good Ol' Platypus
Most of us know this, but:
HOW do you alpha-blend with a good framerate? Must you use GetObject and Get and Set Bitmap Bits? Or is there a DLL out there that returns an hDC or something?
If there is, I'm sure we'd all like to know!
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Mar 3rd, 2001, 08:14 PM
#7
transcendental analytic
DMA is the answer, have a look at them at http://www.ur.co.nz/ and check out the DMA samples that uses array pointers to manipulate bitmaps directly. Calling a C++ dll would be a lot faster though, if anyone have this i'd like to know.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Mar 4th, 2001, 07:47 PM
#8
Addicted Member
Why not using the AlphaBlend function????
Here's the code taken from API Guide:
Code:
'This project requires two picture boxes
'Both picture boxes should contain a picture
Private Type BLENDFUNCTION
BlendOp As Byte
BlendFlags As Byte
SourceConstantAlpha As Byte
AlphaFormat As Byte
End Type
Private Declare Function AlphaBlend Lib "msimg32.dll" (ByVal hdc As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal hdc As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal lInt As Long, ByVal BLENDFUNCT As Long) As Long
Private Declare Sub RtlMoveMemory Lib "kernel32.dll" (Destination As Any, Source As Any, ByVal Length As Long)
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: [email protected]
Dim BF As BLENDFUNCTION, lBF As Long
'Set the graphics mode to persistent
Picture1.AutoRedraw = True
Picture2.AutoRedraw = True
'API uses pixels
Picture1.ScaleMode = vbPixels
Picture2.ScaleMode = vbPixels
'set the parameters
With BF
.BlendOp = AC_SRC_OVER
.BlendFlags = 0
.SourceConstantAlpha = 128
.AlphaFormat = 0
End With
'copy the BLENDFUNCTION-structure to a Long
RtlMoveMemory lBF, BF, 4
'AlphaBlend the picture from Picture1 over the picture of Picture2
AlphaBlend Picture2.hdc, 0, 0, Picture2.ScaleWidth, Picture2.ScaleHeight, Picture1.hdc, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, lBF
End Sub
-
Mar 5th, 2001, 08:52 PM
#9
Good Ol' Platypus
lInt, lInt, lInt... ARGH!
The programmer must've gotten kinda bored on that one.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Mar 5th, 2001, 08:57 PM
#10
Good Ol' Platypus
THANK YOU VERY MUCH!
Thank you, Arcom!!!
That saved me! Since it uses hDCs, I can also use it for DDRAW! BRILLIANT!
Thank you Arcom, thank you!
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Mar 6th, 2001, 01:21 AM
#11
Thread Starter
Addicted Member
Nice code Arcom, I'll look at it later when I got time.
-
Mar 9th, 2001, 04:18 PM
#12
Hyperactive Member
just 1 thing: AlphaBlend isn't supported on Win95, so you'd have to distribute the new version of msimg32.dll with your app
buzzwords are the language of fools
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
|