|
-
Jun 17th, 2012, 06:23 AM
#1
Thread Starter
PowerPoster
[VB6] - the Graphics Class
Last edited by joaquim; Oct 5th, 2012 at 11:03 AM.
-
Jun 18th, 2012, 07:11 AM
#2
New Member
Re: [VB6] - the Graphics Class
"Overflow error " !!
Function RGBValues() ReturnColor.Green = (Color And 65535) / 256
should be ReturnColor.Green = (Color And 65535) \ 256
-
Jun 18th, 2012, 01:24 PM
#3
Thread Starter
PowerPoster
Re: [VB6] - the Graphics Class
 Originally Posted by Tmax
"Overflow error " !!
Function RGBValues() ReturnColor.Green = (Color And 65535) / 256
should be ReturnColor.Green = (Color And 65535) \ 256
you correct me more than that.
THANKS
-
Sep 18th, 2012, 11:13 AM
#4
Thread Starter
PowerPoster
Re: [VB6] - the Graphics Class
now i'm working with shadow effect... but the code don't work... give me an ranger index error
i have the image in ChangeImage() array with outWidth and outHeight limits. know i just compare the pixels colors for give the image shadow in same array. but the code gives me the index error
Code:
'Shadow Effect
If lngShadowX <> 0 Or lngShadowY <> 0 Then
'convert backcolor to RGB values
clrOldColor = RGBValues(lngBackColor)
'test if the color is a backcolor
If ChangedImage(X, Y) <> RGB(clrOldColor.Blue, clrOldColor.Green, clrOldColor.Red) Then
'for avoid the range index error
If X + lngShadowX <= outWidth Or Y + lngShadowY <= outHeight Then
'test if the shadow position have a backcolor
If ChangedImage(X + lngShadowX, Y + lngShadowY) = RGB(clrOldColor.Blue, clrOldColor.Green, clrOldColor.Red) Then
clrOldColor = RGBValues(lngShadowColor)
'if so then change it to shadow color
ChangedImage(X + lngShadowX, Y + lngShadowY) = RGB(clrOldColor.Blue, clrOldColor.Green, clrOldColor.Red)
'Debug.Print "hi"
End If
End If
End If
End If
can anyone advice me?
(if my explication\code is confused, please tell me)
-
Sep 23rd, 2012, 11:54 AM
#5
Thread Starter
PowerPoster
Re: [VB6] - the Graphics Class
i correct the range index error... instead 'or' i must use 'and':
Code:
'Shadow Effect
clrOldColor = RGBValues(lngBackColor)
If ((lngShadowX <> 0) Or (lngShadowY <> 0)) And (lngShadowColor <> lngBackColor) Then
If (ChangedImage(X, Y) <> RGB(clrOldColor.Blue, clrOldColor.Green, clrOldColor.Red)) Then
If X + lngShadowX <= outWidth - 1 And Y + ShadowY <= outHeight - 1 Then
If (ChangedImage(X + lngShadowX, Y + lngShadowY) = RGB(clrOldColor.Blue, clrOldColor.Green, clrOldColor.Red)) Then
Debug.Print "hi"
clrOldColor = RGBValues(lngShadowColor)
ChangedImage(X + lngShadowX, Y + lngShadowY) = vbRed
'Debug.Print RGB(clrOldColor.Blue, clrOldColor.Green, clrOldColor.Red)
End If
End If
End If
but by some reason don't enter on these 'if':
Code:
If (ChangedImage(X + lngShadowX, Y + lngShadowY) = RGB(clrOldColor.Blue, clrOldColor.Green, clrOldColor.Red)) Then
Debug.Print "hi"
clrOldColor = RGBValues(lngShadowColor)
ChangedImage(X + lngShadowX, Y + lngShadowY) = vbRed
'Debug.Print RGB(clrOldColor.Blue, clrOldColor.Green, clrOldColor.Red)
End If
these 'if' test if ChangedImage(X + lngShadowX, Y + lngShadowY) pixel position have these backcolor(RGB(clrOldColor.Blue, clrOldColor.Green, clrOldColor.Red)). on image test, i know that have it, but it's ignored and i don't understand why
can anyone advice me?
-
Sep 24th, 2012, 05:33 AM
#6
Thread Starter
PowerPoster
Re: [VB6] - the Graphics Class
after some work and test, the shadow only works with negative positions(on left side):
Code:
'Shadow Effect
If ((lngShadowX <> 0) Or (lngShadowY <> 0)) And (lngShadowColor <> lngBackColor) Then
'Covert the backcolor from RGB to BGR
clrOldColor = RGBValues(lngBackColor)
TempColor = RGB(clrOldColor.Blue, clrOldColor.Green, clrOldColor.Red)
'test if the index have the backcolor
'if not do something
If (ChangedImage(X, Y) <> TempColor) Then
'avoiding the range index error
If X + lngShadowX <= outWidth - 1 And Y + ShadowY <= outHeight - 1 Then
'test if the index have the backcolor
'if yes then do something
If (ChangedImage(X + lngShadowX, Y + lngShadowY) = TempColor) Then
'convert lngShadowColor from RGB to BGR
clrOldColor = RGBValues(lngShadowColor)
TempColor = RGB(clrOldColor.Blue, clrOldColor.Green, clrOldColor.Red)
'change the pixel to shadow color
ChangedImage(X + lngShadowX, Y + lngShadowY) = TempColor
Debug.Print ChangedImage(X + lngShadowX, Y + lngShadowY), ChangedImage(X + lngShadowX, Y + lngShadowY)
End If
End If
End If
End If
but i don't understand why i can't use positive positions
any advices?
-
Oct 1st, 2012, 11:57 AM
#7
Thread Starter
PowerPoster
Re: [VB6] - the Graphics Class
finally i isolate the problem to minium
Code:
'.................
for Y = 0 To outHeight - 1
'................................
If lngShadowY <= 0 Then
'error
TempY = outHeight - 1 - (Y + lngShadowY)
TempX = X + lngShadowX
Else
TempY = Y - lngShadowY
TempX = X + lngShadowX
'Debug.Print TempX; TempY
End If
i know that DIB's Y work upside down. can anyone advice me on convert Y coordenate?
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
|