فهرست منبع

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;
   ratioX := BitmapWidth / FSVG.WidthAsPixel;
   ratioY := BitmapHeight / FSVG.HeightAsPixel;
   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,
   result := RectWithSizeF(0, 0, FSVG.WidthAsPixel * ratio,
               FSVG.HeightAsPixel * ratio);
               FSVG.HeightAsPixel * ratio);
   result.Offset((BitmapWidth - result.Width) / 2,
   result.Offset((BitmapWidth - result.Width) / 2,