Ignore:
Timestamp:
May 8, 2020, 6:51:18 PM (5 years ago)
Author:
chronos
Message:
  • Fixed: Replaced drawing using Bitmap ScanLine by TPixelPointer to suppress portable symbol warning and to be unified with similar existing functions.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/CevoComponents/EOTButton.pas

    r188 r208  
    4747begin
    4848  RegisterComponents('C-evo', [TEOTButton]);
    49 end;
    50 
    51 procedure ImageOp_CBC(Dst, Src: TBitmap; xDst, yDst, xSrc, ySrc, w, h, Color0,
    52   Color2: integer);
    53 // Src is template
    54 // B channel = Color0 amp
    55 // G channel = background amp (old Dst content), 128=original brightness
    56 // R channel = Color2 amp
    57 type
    58   TPixel = array [0 .. 2] of Byte;
    59 var
    60   ix, iy, amp0, amp1, trans, Value: integer;
    61   SrcLine, DstLine: ^TPixel;
    62 begin
    63   Src.BeginUpdate;
    64   Dst.BeginUpdate;
    65   for iy := 0 to h - 1 do
    66   begin
    67     SrcLine := Src.ScanLine[ySrc + iy] + xSrc * (Src.RawImage.Description.BitsPerPixel shr 3);
    68     DstLine := Dst.ScanLine[yDst + iy] + xDst * (Dst.RawImage.Description.BitsPerPixel shr 3);
    69     for ix := 0 to w - 1 do
    70     begin
    71       trans := SrcLine[0] * 2; // green channel = transparency
    72       amp0 := SrcLine[1] * 2;
    73       amp1 := SrcLine[2] * 2;
    74       if trans <> $FF then
    75       begin
    76         Value := (DstLine[0] * trans + (Color2 shr 16 and $FF) * amp1
    77           + (Color0 shr 16 and $FF) * amp0) div $FF;
    78         if Value < 256 then
    79           DstLine[0] := Value
    80         else
    81           DstLine[0] := 255;
    82         Value := (DstLine[1] * trans + (Color2 shr 8 and $FF) * amp1
    83           + (Color0 shr 8 and $FF) * amp0) div $FF;
    84         if Value < 256 then
    85           DstLine[1] := Value
    86         else
    87           DstLine[1] := 255;
    88         Value := (DstLine[2] * trans + (Color2 and $FF) * amp1 +
    89           (Color0 and $FF) * amp0) div $FF;
    90         if Value < 256 then
    91           DstLine[2] := Value
    92         else
    93           DstLine[2] := 255;
    94       end;
    95       SrcLine := Pointer(SrcLine) + (Src.RawImage.Description.BitsPerPixel shr 3);
    96       DstLine := Pointer(DstLine) + (Dst.RawImage.Description.BitsPerPixel shr 3);
    97     end;
    98   end;
    99   Src.EndUpdate;
    100   Dst.EndUpdate;
    10149end;
    10250
Note: See TracChangeset for help on using the changeset viewer.