Changeset 494 for GraphicTest/Packages/bgrabitmap/bgrawritelzp.pas
- Timestamp:
- Dec 22, 2016, 8:49:19 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GraphicTest/Packages/bgrabitmap/bgrawritelzp.pas
r472 r494 33 33 implementation 34 34 35 uses BGRACompressableBitmap , FPWritePNG;35 uses BGRACompressableBitmap; 36 36 37 37 { TBGRAWriterLazPaint } … … 42 42 OldResampleFilter: TResampleFilter; 43 43 thumbnail: TBGRACustomBitmap; 44 p: PBGRAPixel;45 n: integer;46 44 begin 47 45 result := false; … … 68 66 thumbnail := TBGRACustomBitmap(Img).Resample(w,h,rmFineResample); 69 67 TBGRACustomBitmap(Img).ResampleFilter := OldResampleFilter; 70 71 p := thumbnail.data; //avoid PNG bug with black color transformed into transparent72 for n := thumbnail.NbPixels-1 downto 0 do73 begin74 if (p^.alpha <> 0) and (p^.red = 0) and (p^.green = 0) and (p^.blue = 0) then75 p^.blue := 1;76 inc(p);77 end;78 68 79 69 try … … 89 79 finally 90 80 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; 91 92 end; 92 93 end;
Note:
See TracChangeset
for help on using the changeset viewer.