瀏覽代碼

scaling option for SVG align mode

Johann ELSASS 5 年之前
父節點
當前提交
a6676533b0
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      bcsvgviewer.pas

+ 6 - 1
bcsvgviewer.pas

@@ -337,7 +337,12 @@ begin
 
   ratioX := BitmapWidth / FSVG.WidthAsPixel;
   ratioY := BitmapHeight / FSVG.HeightAsPixel;
-  ratio := min(ratioX, ratioY);
+  if StretchMode = smStretch then
+    ratio := min(ratioX, ratioY)
+  else if StretchMode = smShrink then
+    ratio := min(1, min(ratioX, ratioY))
+  else
+    ratio := 1;
   result := RectWithSizeF(0, 0, FSVG.WidthAsPixel * ratio,
               FSVG.HeightAsPixel * ratio);
   result.Offset((BitmapWidth - result.Width) / 2,