Layer.stretchCopy

Function/Meaning

Enlargement / reduction copy

Type
Layerclassmethod of
Syntax
stretchCopy(dleft, dtop, dwidth, dheight, src, sleft, stop, swidth, sheight, type=stNearest, option=1)
Arguments
dleft

Specifies the left edge position of the destination rectangle in pixels (at the image position of the destination layer).

dtop

Specifies the top position of the destination rectangle in pixels (at the image position of the destination layer).

dwidth

Specifies the width of the destination rectangle in pixels (at the image position of the destination layer).

dheight

Specifies the height of the destination rectangle in pixels (at the image position of the destination layer).

src

Specifies the layer object to copy from.
You can also specify an object of the Bitmap class.

sleft

Specifies the left edge position of the rectangle to copy, in pixels (at the image position of the source layer).

stop

Specifies the top position of the rectangle to copy, in pixels (at the image position of the source layer).

swidth

Specifies the width of the rectangle to copy, in pixels (at the image position of the source layer).

sheight

Specifies the height of the rectangle to copy, in pixels (at the image position of the source layer).

type

Specifies the scale type.

  • stNearest : Nearest point method is used
  • stFastLinear : Low precision linear interpolation is used (partially implemented)
  • stSemiFastLinear : Fixed decimal linear interpolation is used
  • stLinear : Linear interpolation is used
  • stFastCubic : Fixed decimal 3D interpolation is used
  • stCubic : 3D interpolation is used
  • stFastLanczos2 : Fixed decimal Lanczos interpolation range 4x4 is used
  • stLanczos2 : Lanczos interpolation range 4x4 is used
  • stFastLanczos3 : Fixed decimal Lanczos interpolation range 6x6 is used
  • stLanczos3 : Lanczos interpolation range 6x6 is used
  • stFastSpline16 : Fixed decimal spline interpolation 4x4 is used
  • stSpline16 : Spline interpolation 4x4 is used
  • stFastSpline36 : Fixed decimal spline interpolation 6x6 is used
  • stSpline36 : Spline interpolation 6x6 is used
  • stFastAreaAvg : Fixed decimal area mean reduction is used. Cannot be expanded
  • stAreaAvg : Area average reduction is used. Cannot be expanded
  • stFastGaussian : Fixed decimal Gaussian interpolation 4x4 is used
  • stGaussian : Gaussian interpolation 4x4 is used
  • stFastBlackmanSinc : Fixed decimal Blackman-Sinc interpolation 8x8 is used
  • stBlackmanSinc : Blackman-Sinc interpolation 8x8 is used

The speed is faster in the order of stNearest> stFastLinear> stLinear> stCubic, but the faster the speed, the lower the image quality.
The interpolation method after stCubic has sufficiently high image quality and can be said to be a difference in taste.
However, the image quality will be blurry for Gaussian interpolation.
The difference between stFastLinear and other linear interpolations (stSemiFastLinear and stLinear) is large when shrinking.
While stFastLinear always refers to the surrounding 4 pixels, stSemiFastLinear and stLinear refer to and interpolate a range in which the influence range at 1x magnification is 4 pixels at the time of reduction, that is, a wider range of pixels. Higher image quality (algorithm is the original linear interpolation).
For stFastLinear, stRefNoClip can be additionally specified by bitwise OR, in which case it is allowed to refer to the outside of the area of the bitmap to be copied and synthesize the color.
If this is not specified, the out-of-range color will not refer to the closest pixel in the range, even if there is room around the source bitmap. It is considered a color).

option

Sharpness during 3D interpolation.
It currently has no meaning with other interpolation methods.
Increasing the sharpness value in the positive direction will make it blurry, and increasing it in the negative direction will make it sharper.

Return value
None (void)
Explanation

Copies the rectangle of the specified source layer to the rectangle of the destination (layer that executes the method).
If the copy source rectangle and the copy destination rectangle are different in size, they will be enlarged or reduced.
In the current version, linear interpolation is effective when stFastLinear is specified when the Layer.face property of the layer to be overlaid (which executes the method) is dfAlpha (or dfBoth) or dfAddAlpha.
Linear interpolation is also possible when the Layer.face property is dfOpaque and the Layer.holdAlpha property is false.
Also, in the current version, the specification of stLinear or stCubic is valid only when the destination rectangle does not extend beyond the layer without horizontal / vertical inversion.
If the Layer.face property of the layer to which you want to overlay (execute the method) is dfAlpha (or dfBoth) or dfAddAlpha, both the main image and the mask image are copied.
For dfOpaque (or dfMain), only the main image is copied when the Layer.holdAlpha property is true, and both the main image and the mask image are copied when false.