Ignore:
Timestamp:
Sep 21, 2014, 8:11:48 PM (10 years ago)
Author:
chronos
Message:
  • Modified: Not TGBitmap and TGColor data are stored as TBitMemory to support color formats with lower bit width size then 8.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        22LibrePaint
        33lib
         4backup
  • trunk/ColorFormats/UColorGray1.pas

    r7 r9  
    1717    function GetChannelBitPos(Channel: TGColorChannel): Integer; override;
    1818    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;
    2219  end;
    2320
     
    5653end;
    5754
    58 function TGColorFormatGray1.ColorToTColor(Color: TGColor): TColor;
    59 begin
    60   Result := $ffffff * (PByte(Color.Data + GetChannelBitPos(ccGray))^ and 1);
    61 end;
    62 
    63 procedure TGColorFormatGray1.ColorFromTColor(GColor: TGColor; Color: TColor);
    64 begin
    65   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 begin
    72   Result := TGColor;
    73 end;
    74 
    7555
    7656end.
Note: See TracChangeset for help on using the changeset viewer.