Changeset 9 for trunk/ColorFormats/UColorGray1.pas
- Timestamp:
- Sep 21, 2014, 8:11:48 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 2 2 LibrePaint 3 3 lib 4 backup
-
- Property svn:ignore
-
trunk/ColorFormats/UColorGray1.pas
r7 r9 17 17 function GetChannelBitPos(Channel: TGColorChannel): Integer; override; 18 18 function GetChannelBitWidth(Channel: TGColorChannel): Integer; override; 19 function ColorToTColor(Color: TGColor): TColor; override;20 procedure ColorFromTColor(GColor: TGColor; Color: TColor); override;21 function GetColorClass: TGColorClass; override;22 19 end; 23 20 … … 56 53 end; 57 54 58 function TGColorFormatGray1.ColorToTColor(Color: TGColor): TColor;59 begin60 Result := $ffffff * (PByte(Color.Data + GetChannelBitPos(ccGray))^ and 1);61 end;62 63 procedure TGColorFormatGray1.ColorFromTColor(GColor: TGColor; Color: TColor);64 begin65 PByte(GColor.Data + GetChannelBitPos(ccGray))^ := (((Color and $ff) +66 ((Color shr 8) and $ff) +67 ((Color shr 16) and $ff)) div 3) shr 7;68 end;69 70 function TGColorFormatGray1.GetColorClass: TGColorClass;71 begin72 Result := TGColor;73 end;74 75 55 76 56 end.
Note:
See TracChangeset
for help on using the changeset viewer.