Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Multimedia (https://www.delphipraxis.net/16-multimedia/)
-   -   Delphi Is this correct? (https://www.delphipraxis.net/160608-correct.html)

WojTec 22. Mai 2011 18:32

Is this correct?
 
Get RGB from TColor:
Delphi-Quellcode:
R := AColor and $FF;
G := (AColor shr $8) and $FF;
B := (AColor shr $10) and $FF;
Set TColor from RGB:
Delphi-Quellcode:
Result := (B shl $10) or (G shl $8) or R;
Is it ok?

implementation 22. Mai 2011 18:43

AW: Is this correct?
 
Yes, that should be right :thumb:
Code:
$00 FF FF FF
 |  |  |  |
 A  B  G  R
where Alpha is ignored by the GDI.

Namenloser 22. Mai 2011 18:49

AW: Is this correct?
 
As implementation already said, it should work, but why don’t you just try it out? On a side note, I find using hexadecimal numbers for bitshifting a little confusing, but maybe that’s just me.
Zitat:

Zitat von implementation (Beitrag 1102220)
where Alpha is ignored by the GDI.

Actually, it isn’t ignored, but it represents a palette entry instead of an alpha value.

DeddyH 23. Mai 2011 07:25

AW: Is this correct?
 
By the way: Delphi-Referenz durchsuchenColorToRGB, MSDN-Library durchsuchenRGB, you do not need to implement these functions yourself.


Alle Zeitangaben in WEZ +1. Es ist jetzt 03:57 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz