|
@@ -132,15 +132,21 @@ var
|
|
ratio: double;
|
|
ratio: double;
|
|
sx,sy: NativeInt;
|
|
sx,sy: NativeInt;
|
|
blur: TBGRACustomBitmap;
|
|
blur: TBGRACustomBitmap;
|
|
|
|
+ scaling: single;
|
|
|
|
+ scaledShadowOfsX, scaledShadowOfsY, scaledShadowBlur: integer;
|
|
begin
|
|
begin
|
|
- sx := vsPreview.Width- shadowOffsetX - shadowBlur;
|
|
|
|
- sy := vsPreview.Height- shadowOffsetY - shadowBlur;
|
|
|
|
|
|
+ scaling := DoScaleX(60, OriginalDPI)/60 * GetCanvasScaleFactor;
|
|
|
|
+ scaledShadowOfsX := round(shadowOffsetX*scaling);
|
|
|
|
+ scaledShadowOfsY := round(shadowOffsetY*scaling);
|
|
|
|
+ scaledShadowBlur := round(shadowBlur*scaling);
|
|
|
|
+ sx := Bitmap.Width- scaledShadowOfsX - scaledShadowBlur;
|
|
|
|
+ sy := Bitmap.Height- scaledShadowOfsY - scaledShadowBlur;
|
|
tx := SpinEdit_Width.Value;
|
|
tx := SpinEdit_Width.Value;
|
|
ty := SpinEdit_Height.Value;
|
|
ty := SpinEdit_Height.Value;
|
|
if (tx > 0) and (ty > 0) then
|
|
if (tx > 0) and (ty > 0) then
|
|
begin
|
|
begin
|
|
ratio := tx/ty;
|
|
ratio := tx/ty;
|
|
- if sx/ratio < vsPreview.Height then
|
|
|
|
|
|
+ if sx/ratio < Bitmap.Height then
|
|
begin
|
|
begin
|
|
px := sx;
|
|
px := sx;
|
|
py := round(sx/ratio);
|
|
py := round(sx/ratio);
|
|
@@ -153,15 +159,17 @@ begin
|
|
end;
|
|
end;
|
|
x := (sx-px) div 2;
|
|
x := (sx-px) div 2;
|
|
y := (sy-py) div 2;
|
|
y := (sy-py) div 2;
|
|
- Bitmap.FillRect(x+shadowOffsetX,y+shadowOffsetY,x+shadowOffsetX+px,y+shadowOffsetY+py,BGRA(0,0,0,192),dmDrawWithTransparency);
|
|
|
|
- blur := bitmap.FilterBlurRadial(shadowBlur,rbFast);
|
|
|
|
|
|
+ Bitmap.FillRect(x+scaledShadowOfsX, y+scaledShadowOfsY,
|
|
|
|
+ x+scaledShadowOfsX+px, y+scaledShadowOfsY+py,
|
|
|
|
+ BGRA(0,0,0,192), dmDrawWithTransparency);
|
|
|
|
+ blur := bitmap.FilterBlurRadial(scaledShadowBlur,rbFast);
|
|
Bitmap.PutImage(0,0, blur,dmSet);
|
|
Bitmap.PutImage(0,0, blur,dmSet);
|
|
blur.free;
|
|
blur.free;
|
|
if (px = 1) or (py = 1) then
|
|
if (px = 1) or (py = 1) then
|
|
Bitmap.FillRect(x,y,x+px,y+py,BGRABlack,dmSet)
|
|
Bitmap.FillRect(x,y,x+px,y+py,BGRABlack,dmSet)
|
|
else
|
|
else
|
|
begin
|
|
begin
|
|
- ugraph.DrawCheckers(Bitmap,rect(x,y,x+px,y+py));
|
|
|
|
|
|
+ ugraph.DrawCheckers(Bitmap,rect(x,y,x+px,y+py),scaling);
|
|
Bitmap.Rectangle(x,y,x+px,y+py,BGRABlack,FBackColor,dmDrawWithTransparency);
|
|
Bitmap.Rectangle(x,y,x+px,y+py,BGRABlack,FBackColor,dmDrawWithTransparency);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -258,6 +266,7 @@ end;
|
|
procedure TFNewImage.FormCreate(Sender: TObject);
|
|
procedure TFNewImage.FormCreate(Sender: TObject);
|
|
begin
|
|
begin
|
|
ScaleControl(Self,OriginalDPI);
|
|
ScaleControl(Self,OriginalDPI);
|
|
|
|
+ vsPreview.BitmapAutoScale:= false;
|
|
|
|
|
|
FRecomputing := true;
|
|
FRecomputing := true;
|
|
SpinEdit_Width.MaxValue := MaxImageWidth;
|
|
SpinEdit_Width.MaxValue := MaxImageWidth;
|