VoyForums
[ Show ]
Support VoyForums
[ Shrink ]
VoyForums Announcement: Programming and providing support for this service has been a labor of love since 1997. We are one of the few services online who values our users' privacy, and have never sold your information. We have even fought hard to defend your privacy in legal cases; however, we've done it with almost no financial support -- paying out of pocket to continue providing the service. Due to the issues imposed on us by advertisers, we also stopped hosting most ads on the forums many years ago. We hope you appreciate our efforts.

Show your support by donating any amount. (Note: We are still technically a for-profit company, so your contribution is not tax-deductible.) PayPal Acct: Feedback:

Donate to VoyForums (PayPal):

Login ] [ Contact Forum Admin ] [ Main index ] [ Post a new message ] [ Search | Check update time | Archives: 123456789[10] ]


[ Next Thread | Previous Thread | Next Message | Previous Message ]

Date Posted: 23:01:10 06/16/00 Fri
Author: Michel
Subject: Re: How can I convert Tcolor to RGB?
In reply to: Carlos Ramírez 's message, "How can I convert Tcolor to RGB?" on 20:01:58 06/16/00 Fri


Hi Carlos,

By looking at the online help on TColor I found,

If you specify TColor as a specific 4-byte hexadecimal number instead of using the constants defined in the Graphics unit, the low three bytes represent RGB color
intensities for blue, green, and red, respectively. The value $00FF0000 represents full-intensity, pure blue, $0000FF00 is pure green, and $000000FF is pure red.
$00000000 is black and $00FFFFFF is white.

So using the "and" mask and the shr (shift right) operator you can extract the R,G,B values.
For example,

Blue := (Color and $00FF0000) shr 16;
Green := (Color and $0000FF00) shr 8;
Red := (Color and $000000FF);

Best regards,

Michel

> I´m developing a database about characters of
> videogames and I want that the user can make a web
> page of the character of his election, but i need to
> convert TColor to RGB, how can I do this?

[ Next Thread | Previous Thread | Next Message | Previous Message ]

[ Contact Forum Admin ]


Forum timezone: GMT-5
VF Version: 3.00b, ConfDB:
Before posting please read our privacy policy.
VoyForums(tm) is a Free Service from Voyager Info-Systems.
Copyright © 1998-2019 Voyager Info-Systems. All Rights Reserved.