{Copy ímages with palette using bit depths 1, 4 or 8}
procedure TChunkIDAT.CopyInterlacedPalette148(const Pass: Byte;
Src, Dest, Trans{$IFDEF Store16bits}, Extra{$ENDIF}: pChar);
const
BitTable: Array[1..8] of Integer = ($1, $3, 0, $F, 0, 0, 0, $FF);
StartBit: Array[1..8] of Integer = (7 , 0 , 0, 4, 0, 0, 0, 0);
var
CurBit, Col: Integer;
Dest2: PChar;
begin
{Get first column and enter in loop}
Col := ColumnStart[Pass];
repeat
{Copy data}
CurBit := StartBit[Header.BitDepth];
repeat
{Adjust pointer to pixel byte bounds}
Dest2 := pChar(Longint(Dest) + (Header.BitDepth * Col) div 8);
{Copy data}
{$IFDEF VER210}
Dest2^ := Dest2^ or
( ((Byte(Src^) shr CurBit) and BitTable[Header.BitDepth])
shl (StartBit[Header.BitDepth] - (Col * Header.BitDepth mod 8))); /// <- bug using Delphi 2010 ....
{$else}
Byte(Dest2^) := Byte(Dest2^) or
( ((Byte(Src^) shr CurBit) and BitTable[Header.BitDepth])
shl (StartBit[Header.BitDepth] - (Col * Header.BitDepth mod 8)));
{$endif}
{Move to next column}
inc(Col, ColumnIncrement[Pass]);
{Will read next bits}
dec(CurBit, Header.BitDepth);
until CurBit < 0;
{Move to next byte in source}
inc(Src);
until Col >= ImageWidth;
end;
pngimage.pas
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE