Solved

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

Posted on 2004-04-08
2
256 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

830 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