Ignore:
Timestamp:
Dec 22, 2016, 8:49:19 PM (7 years ago)
Author:
chronos
Message:
  • Modified: Updated BGRABitmap package.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GraphicTest/Packages/bgrabitmap/bgrawritelzp.pas

    r472 r494  
    3333implementation
    3434
    35 uses BGRACompressableBitmap, FPWritePNG;
     35uses BGRACompressableBitmap;
    3636
    3737{ TBGRAWriterLazPaint }
     
    4242  OldResampleFilter: TResampleFilter;
    4343  thumbnail: TBGRACustomBitmap;
    44   p: PBGRAPixel;
    45   n: integer;
    4644begin
    4745  result := false;
     
    6866    thumbnail := TBGRACustomBitmap(Img).Resample(w,h,rmFineResample);
    6967    TBGRACustomBitmap(Img).ResampleFilter := OldResampleFilter;
    70 
    71     p := thumbnail.data; //avoid PNG bug with black color transformed into transparent
    72     for n := thumbnail.NbPixels-1 downto 0 do
    73     begin
    74       if (p^.alpha <> 0) and (p^.red = 0) and (p^.green = 0) and (p^.blue = 0) then
    75         p^.blue := 1;
    76       inc(p);
    77     end;
    7868
    7969    try
     
    8979    finally
    9080      thumbnail.Free;
     81    end;
     82  end else
     83  begin
     84    thumbStream := TMemoryStream.Create;
     85    try
     86      TBGRACustomBitmap(Img).SaveToStreamAsPng(thumbStream);
     87      thumbStream.Position:= 0;
     88      Str.CopyFrom(thumbStream, thumbStream.Size);
     89      result := true;
     90    finally
     91      thumbStream.Free;
    9192    end;
    9293  end;
Note: See TracChangeset for help on using the changeset viewer.