Solved

Get the amount of red, green and blue from given 32 bit pixel value.

Posted on 2004-04-08
2
254 Views
Last Modified: 2010-05-02
HI!

Function RGB creates a color value based on given Red, Green and Blue values.

I need a function which will do the oposite:   extract amounts of Red, Green and Blue from color value created by GetPixel and RGB functions.

Thanks!
0
Comment
Question by:dbrckovi
2 Comments
 
LVL 26

Accepted Solution

by:
EDDYKT earned 250 total points
ID: 10782557
where color is RGB color

function GetRed(color)
      
On Error Resume Next
GetRed = color And &HFF
end Function

function GetGreen(color)
      
On Error Resume Next
GetGreen = ((color And &HFF00) / &H100) And &HFF
end Function

function GetBlue(color)
      
On Error Resume Next
GetBlue = ((color And &HFF0000) / &H10000) And &HFF
end Function
0
 
LVL 11

Author Comment

by:dbrckovi
ID: 10782582
Perfect.    Thanks!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now