Layer.stretchCopy

Function/Meaning
Scaled Copy
Type
Method of Layer class
Syntax
stretchCopy(dleft, dtop, dwidth, dheight, src, sleft, stop, swidth, sheight, type=stNearest, option=-1.0)
Arguments
dleft Specifies the left position of the destination rectangle (in the image coordinates of the destination layer) in pixels.
dtop Specifies the top position of the destination rectangle (in the image coordinates of the destination layer) in pixels.
dwidth Specifies the width of the destination rectangle (in the image coordinates of the destination layer) in pixels.
dheight Specifies the height of the destination rectangle (in the image coordinates of the destination layer) in pixels.
src Specifies the source layer object.
Bitmap class objects can also be specified. (Since 1.1.0)
sleft Specifies the left position of the source rectangle (in the image coordinates of the source layer) in pixels.
stop Specifies the top position of the source rectangle (in the image coordinates of the source layer) in pixels.
swidth Specifies the width of the source rectangle (in the image coordinates of the source layer) in pixels.
sheight Specifies the height of the source rectangle (in the image coordinates of the source layer) in pixels.
type Specifies the scaling type.
stNearest : Nearest neighbor method is used.
stFastLinear : Low-precision linear interpolation is used (partially implemented).
stSemiFastLinear : Fixed-point linear interpolation is used (Since 1.3).
stLinear : Linear interpolation is used (Implementation changed since 1.3).
stFastCubic : Fixed-point cubic interpolation is used (Since 1.3).
stCubic : Cubic interpolation is used (Implementation changed since 1.3).
stFastLanczos2 : Fixed-point Lanczos interpolation (4x4 range) is used (Since 1.3).
stLanczos2 : Lanczos interpolation (4x4 range) is used (Since 1.3).
stFastLanczos3 : Fixed-point Lanczos interpolation (6x6 range) is used (Since 1.3).
stLanczos3 : Lanczos interpolation (6x6 range) is used (Since 1.3).
stFastSpline16 : Fixed-point spline interpolation (4x4) is used (Since 1.3).
stSpline16 : Spline interpolation (4x4) is used (Since 1.3).
stFastSpline36 : Fixed-point spline interpolation (6x6) is used (Since 1.3).
stSpline36 : Spline interpolation (6x6) is used (Since 1.3).
stFastAreaAvg : Fixed-point area average reduction is used. Scaling up is not possible (Since 1.3).
stAreaAvg : Area average reduction is used. Scaling up is not possible (Since 1.3).
stFastGaussian : Fixed-point Gaussian interpolation (4x4) is used (Since 1.3).
stGaussian : Gaussian interpolation (4x4) is used (Since 1.3).
stFastBlackmanSinc : Fixed-point Blackman-Sinc interpolation (8x8) is used (Since 1.3).
stBlackmanSinc : Blackman-Sinc interpolation (8x8) is used (Since 1.3).
Speed is faster in the order of stNearest > stFastLinear > stLinear > stCubic, but the faster the type, the lower the image quality.
Interpolation methods from stCubic onwards are high enough quality that the choice is a matter of preference.
However, Gaussian interpolation results in a blurred image quality.
The difference between stFastLinear and other linear interpolations (stSemiFastLinear and stLinear) is significant when scaling down.
While stFastLinear always references the surrounding 4 pixels, stSemiFastLinear and stLinear reference a wider range of pixels during reduction so that the influence range is 4 pixels at 1:1 scale, resulting in higher quality (this is the true linear interpolation algorithm).
For stFastLinear, stRefNoClip can be added using a bitwise OR. In this case, it allows referencing areas outside the source bitmap to synthesize colors. If this is not specified, it will not reference outside the source bitmap even if there is margin around it (colors outside the range are treated as the color of the nearest pixel within the range).
option Added in 1.3 or later.
Sharpness for cubic interpolation. It currently has no meaning for other interpolation methods.
Increasing the sharpness value in the positive direction makes it blurrier, and increasing it in the negative direction makes it sharper.
Return Value
None (void)
Description
Copies the specified rectangle from the source layer to the rectangle of the destination (the layer executing the method). If the source and destination rectangle sizes differ, scaling is performed.
In the current version, linear interpolation with stFastLinear is effective when the Layer.face property of the destination layer (the one executing 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, stLinear or stCubic specifications are only valid when there is no horizontal/vertical flipping and the destination rectangle does not exceed the layer boundaries.
If the Layer.face property of the destination layer (the one executing the method) is dfAlpha (or dfBoth) or dfAddAlpha, both the main image and the mask image are copied.
In the case of dfOpaque (or dfMain), only the main image is copied if the Layer.holdAlpha property is true, and both the main image and the mask image are copied if it is false.