|
-
Apr 20th, 2001, 12:06 PM
#1
Thread Starter
Member
I am using the RGB function in compositing. It is like this:
Code:
res = RGB((red1 + red2) / 2, (green1 + green2) / 2, (blue1 + blue2) / 2)
All the variables being used are integers. When I run the app, it says "Invalid procedure or argument". What can I do?
-
Apr 20th, 2001, 12:11 PM
#2
PowerPoster
On of these values seems to be out of range (smaller 0), check this before calling the function:
Code:
Sub CalcColor()
Dim Red1 As Long
Dim Red2 As Long
Dim Green1 As Long
Dim Green2 As Long
Dim Blue1 As Long
Dim Blue2 As Long
Dim R As Long
Dim G As Long
Dim B As Long
Dim Res As Long
R = (Red1 + Red2) / 2
G = (Green1 + Green2) / 2
B = (Blue2 + Red2) / 2
If R < 0 Then: R = 0
If G < 0 Then: G = 0
If B < 0 Then: B = 0
Res = RGB(R, G, B)
End Sub
-
Apr 20th, 2001, 01:11 PM
#3
Fanatic Member
The values of Red, Green and Blue need to be between 0 and 255 .
-
Apr 20th, 2001, 02:26 PM
#4
PowerPoster
No, the RGB function cuts values over 255, therefore I only check the < 0 case.
-
Apr 21st, 2001, 06:49 AM
#5
Fanatic Member
Yes, but I meant that a RGB value is a Long containing 3 bytes, each from 0 to 255.
VB does the check if greather than 255.
If a RGB byte is >255 and <32768 then this byte will be 255.
If a RGB byte is >32767 then "Overflow" is generated.
If a RGB byte is <0 then "Invalid prodcedure call/argument" is generated"
Last edited by Mad Compie; Apr 22nd, 2001 at 06:08 AM.
-
Apr 21st, 2001, 11:45 AM
#6
Thread Starter
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
|