Ignore:
Timestamp:
Sep 19, 2014, 9:25:56 AM (10 years ago)
Author:
chronos
Message:
  • Added: Mono image color format. Pixels/channels with lower size then byte are not supported yet.
  • Added: Slow image flip and mirror operation.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ColorFormats/UColorGray8.pas

    r5 r7  
    1515    function GetBitDepth: Integer; override;
    1616    function GetName: string; override;
    17     function GetChannelBytePos(Channel: TGColorChannel): Integer; override;
     17    function GetChannelBitPos(Channel: TGColorChannel): Integer; override;
    1818    function GetChannelBitWidth(Channel: TGColorChannel): Integer; override;
    1919    function ColorToTColor(Color: TGColor): TColor; override;
     
    4141end;
    4242
    43 function TGColorFormatGray8.GetChannelBytePos(Channel: TGColorChannel): Integer;
     43function TGColorFormatGray8.GetChannelBitPos(Channel: TGColorChannel): Integer;
    4444begin
    4545  case Channel of
     
    5858function TGColorFormatGray8.ColorToTColor(Color: TGColor): TColor;
    5959begin
    60   Result := $010101 * PByte(Color.Data + GetChannelBytePos(ccGray))^;
     60  Result := $010101 * PByte(Color.Data + (GetChannelBitPos(ccGray) shr 3))^;
    6161end;
    6262
    6363procedure TGColorFormatGray8.ColorFromTColor(GColor: TGColor; Color: TColor);
    6464begin
    65   PByte(GColor.Data + GetChannelBytePos(ccGray))^ := ((Color and $ff) +
     65  PByte(GColor.Data + (GetChannelBitPos(ccGray) shr 3))^ := ((Color and $ff) +
    6666  ((Color shr 8) and $ff) +
    6767  ((Color shr 16) and $ff)) div 3;
Note: See TracChangeset for help on using the changeset viewer.