Changeset 7 for trunk/ColorFormats/UColorGray8.pas
- Timestamp:
- Sep 19, 2014, 9:25:56 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ColorFormats/UColorGray8.pas
r5 r7 15 15 function GetBitDepth: Integer; override; 16 16 function GetName: string; override; 17 function GetChannelB ytePos(Channel: TGColorChannel): Integer; override;17 function GetChannelBitPos(Channel: TGColorChannel): Integer; override; 18 18 function GetChannelBitWidth(Channel: TGColorChannel): Integer; override; 19 19 function ColorToTColor(Color: TGColor): TColor; override; … … 41 41 end; 42 42 43 function TGColorFormatGray8.GetChannelB ytePos(Channel: TGColorChannel): Integer;43 function TGColorFormatGray8.GetChannelBitPos(Channel: TGColorChannel): Integer; 44 44 begin 45 45 case Channel of … … 58 58 function TGColorFormatGray8.ColorToTColor(Color: TGColor): TColor; 59 59 begin 60 Result := $010101 * PByte(Color.Data + GetChannelBytePos(ccGray))^;60 Result := $010101 * PByte(Color.Data + (GetChannelBitPos(ccGray) shr 3))^; 61 61 end; 62 62 63 63 procedure TGColorFormatGray8.ColorFromTColor(GColor: TGColor; Color: TColor); 64 64 begin 65 PByte(GColor.Data + GetChannelBytePos(ccGray))^ := ((Color and $ff) +65 PByte(GColor.Data + (GetChannelBitPos(ccGray) shr 3))^ := ((Color and $ff) + 66 66 ((Color shr 8) and $ff) + 67 67 ((Color shr 16) and $ff)) div 3;
Note:
See TracChangeset
for help on using the changeset viewer.