|
-
Apr 8th, 2001, 01:39 PM
#1
I am trying to make a screen saver, a logo for a Band moves about the screen (with a space background thingy) bouncing off the walls. I have got all the other code working fine. However i dont like using vbsrcinvert or vbsrcinvert as these look weard when the logo crosses the earth of the moon. So i created this code so that it uses vbsrccopy and then writes each pixel manually from the background to create a transparent effect using a mask as a guide.
My problem is this code is way to slow, any ideas on how to fix this?
Sub MakeTrans()
Dim PixelX As Integer
Dim PixelY As Integer
Dim BackPixelColour
Dim MaskPixelColour
For PixelX = 0 To Form1.PicMask.ScaleWidth
For PixelY = 0 To Form1.PicMask.ScaleHeight
MaskPixelColour = GetPixel(Form1.PicMask.hdc, PixelX, PixelY) 'get colour from mask
If MaskPixelColour >= 0 And MaskPixelColour <= 500 Then 'if the pixel is black copy to the buffer the pixel from the background
BackPixelColour = GetPixel(Form1.PicBack.hdc, (Position.X + PixelX), (Position.Y + PixelY)) 'get background pixel colour
Call SetPixelV(Form1.PicBuf.hdc, (Position.X + PixelX), (Position.Y + PixelY), BackPixelColour) 'draw to buffer the pixel colour
End If
Next
Next
End Sub
-
Apr 8th, 2001, 01:51 PM
#2
Good Ol' Platypus
This is an ongoing problem in the graphics world of programming: drawing things pixel by pixel.
I suggest using SrcAND for the mask and SrcPAINT for the sprite, it should work. (get 'em in the declaration explorer)
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Apr 8th, 2001, 02:19 PM
#3
transcendental analytic
the rasterop constants can be found within the runtimes too:
VBRUN.RasterOpConstants.vbSrcPaint
VBRUN.RasterOpConstants.vbSrcAnd
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.
-
Apr 8th, 2001, 02:30 PM
#4
Or you can just use them plain (without any reference to another object)
Code:
Print vbSrcPaint
Print vbSrcAnd
-
Apr 8th, 2001, 02:44 PM
#5
Thanks anyway Guys. Its a shame i liked that code.
-
Apr 8th, 2001, 03:37 PM
#6
Good Ol' Platypus
Is it just me kedaman or do you change your signature every 2 seconds?
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Apr 8th, 2001, 03:42 PM
#7
transcendental analytic
it's because of me, me changed my signature twice in 20 mins
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.
-
Apr 9th, 2001, 12:17 PM
#8
Thanks Sastraxi that works great, but why didn't i think of that? Oh well.
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
|