Layer.operateStretch

Function/Meaning
Scaled Operation Blending
Type
Method of Layer class
Syntax
operateStretch(dleft, dtop, dwidth, dheight, src, sleft, stop, swidth, sheight, mode=omAuto, opa=255, type=stNearest, option=-1.0)
Arguments
dleft Specifies the left edge position of the destination rectangle (in pixels relative to the destination layer's image position).
dtop Specifies the top edge position of the destination rectangle (in pixels relative to the destination layer's image position).
dwidth Specifies the width of the destination rectangle (in pixels relative to the destination layer's image position).
dheight Specifies the height of the destination rectangle (in pixels relative to the destination layer's image position).
src Specifies the source layer object.
A Bitmap class object can also be specified. (Since 1.1.0)
sleft Specifies the left edge position of the source rectangle (in pixels relative to the source layer's image position).
stop Specifies the top edge position of the source rectangle (in pixels relative to the source layer's image position).
swidth Specifies the width of the source rectangle (in pixels relative to the source layer's image position).
sheight Specifies the height of the source rectangle (in pixels relative to the source layer's image position).
mode Specifies the operation mode.
If omAuto is specified, the operation type is automatically determined according to the Layer.type property of the source layer.
If omPsNormal is specified, Photoshop-compatible alpha blending is performed (implemented for types other than stNearest and stFastLinear since 1.3).
If omPsAdditive is specified, Photoshop-compatible Linear Dodge blending is performed (implemented for types other than stNearest and stFastLinear since 1.3).
If omPsSubtractive is specified, Photoshop-compatible Linear Burn blending is performed (implemented for types other than stNearest and stFastLinear since 1.3).
If omPsMultiplicative is specified, Photoshop-compatible Multiply blending is performed (implemented for types other than stNearest and stFastLinear since 1.3).
If omPsScreen is specified, Photoshop-compatible Screen blending is performed (implemented for types other than stNearest and stFastLinear since 1.3).
If omPsOverlay is specified, Photoshop-compatible Overlay blending is performed (implemented for types other than stNearest and stFastLinear since 1.3).
If omPsHardLight is specified, Photoshop-compatible Hard Light blending is performed (implemented for types other than stNearest and stFastLinear since 1.3).
If omPsSoftLight is specified, Photoshop-compatible Soft Light blending is performed (implemented for types other than stNearest and stFastLinear since 1.3).
If omPsColorDodge is specified, Photoshop-compatible Color Dodge blending is performed (implemented for types other than stNearest and stFastLinear since 1.3).
If omPsColorDodge5 is specified, Photoshop version 5.x or lower compatible Color Dodge blending is performed (implemented for types other than stNearest and stFastLinear since 1.3).
If omPsColorBurn is specified, Photoshop-compatible Color Burn blending is performed (implemented for types other than stNearest and stFastLinear since 1.3).
If omPsLighten is specified, Photoshop-compatible Lighten blending is performed (implemented for types other than stNearest and stFastLinear since 1.3).
If omPsDarken is specified, Photoshop-compatible Darken blending is performed (implemented for types other than stNearest and stFastLinear since 1.3).
If omPsDifference is specified, Photoshop-compatible Difference blending is performed (implemented for types other than stNearest and stFastLinear since 1.3).
If omPsDifference5 is specified, Photoshop version 5.x or lower compatible Difference blending is performed (implemented for types other than stNearest and stFastLinear since 1.3).
If omPsExclusion is specified, Photoshop-compatible Exclusion blending is performed (implemented for types other than stNearest and stFastLinear since 1.3).
If omAdditive is specified, Additive blending is performed (implemented for types other than stNearest and stFastLinear since 1.3).
If omSubtractive is specified, Subtractive blending is performed (implemented for types other than stNearest and stFastLinear since 1.3).
If omMultiplicative is specified, Multiplicative blending is performed (implemented for types other than stNearest and stFastLinear since 1.3).
If omDodge is specified, Dodge blending is performed (implemented for types other than stNearest and stFastLinear since 1.3).
If omDarken is specified, Darken blending is performed (implemented for types other than stNearest and stFastLinear since 1.3).
If omLighten is specified, Lighten blending is performed (implemented for types other than stNearest and stFastLinear since 1.3).
If omScreen is specified, Screen blending is performed (implemented for types other than stNearest and stFastLinear since 1.3).
If omAlpha is specified, alpha blending is performed.
If omAddAlpha is specified, additive alpha blending is performed. In this case, if the destination Layer.face property is dfOpaque and the Layer.holdAlpha property is false, linear interpolation is possible by specifying stFastLinear for the type argument.
If omOpaque is specified, the alpha information of src is ignored, and src is always treated as completely opaque. In this case, if the destination Layer.face property is dfOpaque and the Layer.holdAlpha property is false, linear interpolation is possible by specifying stFastLinear for the type argument.
opa Specifies the intensity of the operation (0 to 255).
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 when scaling down so that the influence range at 1:1 scale is 4 pixels, resulting in higher quality (algorithmically, this is true linear interpolation).
For stFastLinear, stRefNoClip can be additionally specified using a bitwise OR. In this case, referencing outside the bitmap area being copied to blend colors is permitted. If this is not specified, even if there is extra space around the source bitmap, it will not reference outside the source bitmap range (colors outside the range are treated as the color of the nearest pixel within the range).
option Added in 1.3 or later.
This is the 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
Blends the specified source layer rectangle into the destination rectangle (the layer executing the method) using an operation. If the source rectangle and destination rectangle sizes differ, scaling up or down is performed.
If omAuto is specified for mode, the operation type is automatically determined according to the Layer.type property of the source layer.