Pārlūkot izejas kodu

Fix StretchDraw usage and add transparent color handling

Bernardo Magri 4 mēneši atpakaļ
vecāks
revīzija
5525a33847
2 mainītis faili ar 5 papildinājumiem un 5 dzēšanām
  1. 3 3
      src/book.pas
  2. 2 2
      src/unitCoverWorker.pas

+ 3 - 3
src/book.pas

@@ -6,7 +6,7 @@ interface
 
 uses
   Classes, SysUtils, Graphics, ExtCtrls, Controls, LCLIntf, LResources, Process,
-  Math, IntfGraphics, FPImage, LazCanvas, FileUtil, LazJPG;
+  Math, IntfGraphics, FPImage, GraphType, LazCanvas, FileUtil, LazJPG;
 
 
 type
@@ -124,7 +124,7 @@ begin
           dstH := Round(Pic.Height * scale);
           offX := (W - dstW) div 2;
           offY := (H - dstH) div 2;
-          Canvas.StretchDraw(Rect(offX, offY, offX + dstW, offY + dstH), Pic.Graphic);
+          Canvas.StretchDraw(offX, offY, dstW, dstH, Pic.Graphic);
         end;
         Png.Assign(Img);
         Png.SaveToFile(Result);
@@ -211,7 +211,7 @@ begin
           dstH := Round(Pic.Height * scale);
           offX := (W - dstW) div 2;
           offY := (H - dstH) div 2;
-          Canvas.StretchDraw(Rect(offX, offY, offX + dstW, offY + dstH), Pic.Graphic);
+          Canvas.StretchDraw(offX, offY, dstW, dstH, Pic.Graphic);
         end;
 
         // No runtime scaling anymore; we drew at target size

+ 2 - 2
src/unitCoverWorker.pas

@@ -6,7 +6,7 @@ interface
 
 uses
   Classes, SysUtils, Process, LCLIntf, Graphics, Math, LazJpeg,
-  IntfGraphics, FPImage, LazCanvas,
+  IntfGraphics, FPImage, GraphType, LazCanvas,
   Book, BookCollection, FileUtil;
 
 { Call this once after loading your data: it scans the list and enqueues
@@ -116,7 +116,7 @@ begin
           dstH := Round(Pic.Height * scale);
           offX := (W - dstW) div 2;
           offY := (H - dstH) div 2;
-          Canvas.StretchDraw(Rect(offX, offY, offX + dstW, offY + dstH), Pic.Graphic);
+          Canvas.StretchDraw(offX, offY, dstW, dstH, Pic.Graphic);
         end;
         Png.Assign(Img);
         Png.SaveToFile(Result);