ImageFunction¶
The ImageFunction class manipulates images.
You cannot create objects of this class. All methods are class methods (static) and are called directly, as in
ImageFunction.operateRect(...).
Only Bitmap objects can be operated on; Layer objects cannot be specified.
Think of these as the drawing methods of the same name on Layer with the Layer-specific aspects (properties such as face / holdAlpha / the clip rectangle,
and the redraw notification after drawing) removed and everything turned into explicit arguments.
If omAuto is specified as the operation mode, it is always treated as omAlpha, because a Bitmap has no information
corresponding to Layer.type.
For how Layer and Bitmap relate and when to use each, see Layer, Bitmap, and ImageFunction.
Members¶
Methods¶
- operateAffine
- operateRect
- operateStretch
- flipLR
- flipUD
- adjustGamma
- doBoxBlur
- doGrayScale
- colorRect
- drawText
- drawGlyph
- fillRect
- copy9Patch
operateAffine¶
Method
Arguments
| Arguments | Default | Description |
|---|---|---|
dst |
|
The destination Bitmap object. |
src |
|
The source Bitmap object. |
A |
|
Parameter A. Its interpretation depends on the affine argument. |
B |
|
Parameter B. Its interpretation depends on the affine argument. |
C |
|
Parameter C. Its interpretation depends on the affine argument. |
D |
|
Parameter D. Its interpretation depends on the affine argument. |
E |
|
Parameter E. Its interpretation depends on the affine argument. |
F |
|
Parameter F. Its interpretation depends on the affine argument. |
srcrect |
null |
The rectangle to composite, as a Rect object in pixels (in image coordinates of the source Bitmap). If omitted, the whole image is used. |
cliprect |
null |
The clipping rectangle, as a Rect object (in image coordinates of the destination Bitmap). If omitted, no clipping is performed. |
affine |
|
How the following six arguments (parameters A to F) are interpreted. If true, the six parameters are interpreted as follows. A : a of the 2D affine transform matrixB : b of the 2D affine transform matrixC : c of the 2D affine transform matrixD : d of the 2D affine transform matrixE : tx of the 2D affine transform matrixF : ty of the 2D affine transform matrixWith the affine transform, a source image position (x, y) (where the top-left corner of the source rectangle is (0, 0)) is transformed into the destination image position (x', y') by the following formulas. x' = ax + cy + tx y' = bx + dy + ty If false, the six parameters are interpreted as follows. A : X coordinate in the destination image of the top-left corner of the source rectangle (x0)B : Y coordinate in the destination image of the top-left corner of the source rectangle (y0)C : X coordinate in the destination image of the top-right corner of the source rectangle (x1)D : Y coordinate in the destination image of the top-right corner of the source rectangle (y1)E : X coordinate in the destination image of the bottom-left corner of the source rectangle (x2)F : Y coordinate in the destination image of the bottom-left corner of the source rectangle (y2)If false, the destination position (x3, y3) corresponding to the bottom-right corner of the source is calculated automatically by the following formulas. x3 = x1 - x0 + x2 y3 = y1 - y0 + y2 |
mode |
omAlpha |
The operation mode.**omPsNormal**: Photoshop-compatible alpha blending is performed (not implemented in the current version).**omPsAdditive**: Photoshop-compatible Linear Dodge blending is performed (not implemented in the current version).**omPsSubtractive**: Photoshop-compatible Linear Burn blending is performed (not implemented in the current version).**omPsMultiplicative**: Photoshop-compatible Multiply blending is performed (not implemented in the current version).**omPsScreen**: Photoshop-compatible Screen blending is performed (not implemented in the current version).**omPsOverlay**: Photoshop-compatible Overlay blending is performed (not implemented in the current version).**omPsHardLight**: Photoshop-compatible Hard Light blending is performed (not implemented in the current version).**omPsSoftLight**: Photoshop-compatible Soft Light blending is performed (not implemented in the current version).**omPsColorDodge**: Photoshop-compatible Color Dodge blending is performed (not implemented in the current version).**omPsColorDodge5**: Color Dodge blending compatible with Photoshop 5.x and earlier is performed (not implemented in the current version).**omPsColorBurn**: Photoshop-compatible Color Burn blending is performed (not implemented in the current version).**omPsLighten**: Photoshop-compatible Lighten blending is performed (not implemented in the current version).**omPsDarken**: Photoshop-compatible Darken blending is performed (not implemented in the current version).**omPsDifference**: Photoshop-compatible Difference blending is performed (not implemented in the current version).**omPsDifference5**: Difference blending compatible with Photoshop 5.x and earlier is performed (not implemented in the current version).**omPsExclusion**: Photoshop-compatible Exclusion blending is performed (not implemented in the current version).**omAdditive**: additive blending is performed (not implemented in the current version).**omSubtractive**: subtractive blending is performed (not implemented in the current version).**omMultiplicative**: multiplicative blending is performed (not implemented in the current version).**omDodge**: dodge blending is performed (not implemented in the current version).**omDarken**: darken (comparison) blending is performed (not implemented in the current version).**omLighten**: lighten (comparison) blending is performed (not implemented in the current version).**omScreen**: screen blending is performed (not implemented in the current version).**omAlpha**: alpha blending is performed.**omAddAlpha**: additive alpha blending is performed. In this case, when face is dfOpaque and hda is false, linear interpolation is possible by specifying stFastLinear as the type argument.**omOpaque**: the alpha information of src is ignored and src is always treated as fully opaque. In this case, when face is dfOpaque and hda is false, linear interpolation is possible by specifying stFastLinear as the type argument. |
face |
dfAlpha |
The drawing method.**dfAlpha**: the image is treated as an image with an alpha channel when drawn.**dfAddAlpha**: the image is treated as an image with an additive alpha channel when drawn.**dfOpaque**: the image is treated as fully opaque when drawn. |
opa |
255 |
The opacity of the composite (0 to 255). |
type |
stNearest |
The type of affine transform.**stNearest** : nearest neighbor is used**stFastLinear** : low-precision linear interpolation is used (partially implemented)**stLinear** : linear interpolation is used (not implemented)**stCubic** : bicubic interpolation is used (not implemented)Speed is fastest in the order stNearest > stFastLinear > stLinear > stCubic, but the faster the mode, the lower the image quality. For stFastLinear, stLinear, and stCubic, you can add stRefNoClip with a bitwise OR; this allows colors outside the area of the bitmap being copied to be referenced when compositing. Without it, pixels outside the source bitmap's range are never referenced, even if the source bitmap has room around it (colors outside the range are treated as the color of the nearest pixel within the range). |
hda |
false |
Whether to protect the alpha channel. |
Description
Composites with an affine transform
Composites the specified rectangle of the source Bitmap onto the destination while applying an affine transform.
operateRect¶
Method
Arguments
| Arguments | Default | Description |
|---|---|---|
dst |
|
The destination Bitmap object. |
dleft |
|
Left edge of the destination rectangle, in pixels (in image coordinates of the destination Bitmap). |
dtop |
|
Top edge of the destination rectangle, in pixels (in image coordinates of the destination Bitmap). |
src |
|
The source Bitmap object. If omitted, the whole image is used. |
srcrect |
null |
The rectangle to operate on, as a Rect object in pixels (in image coordinates of the source Bitmap). If omitted, the whole image is used. |
cliprect |
null |
The clipping rectangle, as a Rect object (in image coordinates of the destination Bitmap). If omitted, no clipping is performed. |
mode |
omAuto |
The operation mode.**omPsNormal**: Photoshop-compatible alpha blending is performed.**omPsAdditive**: Photoshop-compatible Linear Dodge blending is performed.**omPsSubtractive**: Photoshop-compatible Linear Burn blending is performed.**omPsMultiplicative**: Photoshop-compatible Multiply blending is performed.**omPsScreen**: Photoshop-compatible Screen blending is performed.**omPsOverlay**: Photoshop-compatible Overlay blending is performed.**omPsHardLight**: Photoshop-compatible Hard Light blending is performed.**omPsSoftLight**: Photoshop-compatible Soft Light blending is performed.**omPsColorDodge**: Photoshop-compatible Color Dodge blending is performed.**omPsColorDodge5**: Color Dodge blending compatible with Photoshop 5.x and earlier is performed.**omPsColorBurn**: Photoshop-compatible Color Burn blending is performed.**omPsLighten**: Photoshop-compatible Lighten blending is performed.**omPsDarken**: Photoshop-compatible Darken blending is performed.**omPsDifference**: Photoshop-compatible Difference blending is performed.**omPsDifference5**: Difference blending compatible with Photoshop 5.x and earlier is performed.**omPsExclusion**: Photoshop-compatible Exclusion blending is performed.**omAdditive**: additive blending is performed.**omSubtractive**: subtractive blending is performed.**omMultiplicative**: multiplicative blending is performed.**omDodge**: dodge blending is performed.**omDarken**: darken (comparison) blending is performed.**omLighten**: lighten (comparison) blending is performed.**omScreen**: screen blending is performed.**omAlpha**: alpha blending is performed.**omAddAlpha**: additive alpha blending is performed.**omOpaque**: the alpha information of src is ignored and src is always treated as fully opaque. |
face |
dfAlpha |
The drawing method.**dfAlpha**: the image is treated as an image with an alpha channel when drawn.**dfAddAlpha**: the image is treated as an image with an additive alpha channel when drawn.**dfOpaque**: the image is treated as fully opaque when drawn. |
opa |
255 |
The strength of the operation (0 to 255). |
hda |
false |
Whether to protect the alpha channel. |
Description
Composites a rectangle
Composites the rectangle of the specified source Bitmap at the specified position of the destination Bitmap using the specified mode.
operateStretch¶
Method
Arguments
| Arguments | Default | Description |
|---|---|---|
dst |
|
The destination Bitmap object. |
src |
|
The source Bitmap object. |
dstrect |
null |
The destination rectangle, as a Rect object in pixels (in image coordinates of the destination Bitmap). If omitted, the whole image is used. |
srcrect |
null |
The rectangle to composite, as a Rect object in pixels (in image coordinates of the source Bitmap). If omitted, the whole image is used. |
cliprect |
null |
The clipping rectangle, as a Rect object (in image coordinates of the destination Bitmap). If omitted, no clipping is performed. |
mode |
omAuto |
The operation mode.**omPsNormal**: Photoshop-compatible alpha blending is performed (since 1.3, implemented for types other than stNearest and stFastLinear).**omPsAdditive**: Photoshop-compatible Linear Dodge blending is performed (since 1.3, implemented for types other than stNearest and stFastLinear).**omPsSubtractive**: Photoshop-compatible Linear Burn blending is performed (since 1.3, implemented for types other than stNearest and stFastLinear).**omPsMultiplicative**: Photoshop-compatible Multiply blending is performed (since 1.3, implemented for types other than stNearest and stFastLinear).**omPsScreen**: Photoshop-compatible Screen blending is performed (since 1.3, implemented for types other than stNearest and stFastLinear).**omPsOverlay**: Photoshop-compatible Overlay blending is performed (since 1.3, implemented for types other than stNearest and stFastLinear).**omPsHardLight**: Photoshop-compatible Hard Light blending is performed (since 1.3, implemented for types other than stNearest and stFastLinear).**omPsSoftLight**: Photoshop-compatible Soft Light blending is performed (since 1.3, implemented for types other than stNearest and stFastLinear).**omPsColorDodge**: Photoshop-compatible Color Dodge blending is performed (since 1.3, implemented for types other than stNearest and stFastLinear).**omPsColorDodge5**: Color Dodge blending compatible with Photoshop 5.x and earlier is performed (since 1.3, implemented for types other than stNearest and stFastLinear).**omPsColorBurn**: Photoshop-compatible Color Burn blending is performed (since 1.3, implemented for types other than stNearest and stFastLinear).**omPsLighten**: Photoshop-compatible Lighten blending is performed (since 1.3, implemented for types other than stNearest and stFastLinear).**omPsDarken**: Photoshop-compatible Darken blending is performed (since 1.3, implemented for types other than stNearest and stFastLinear).**omPsDifference**: Photoshop-compatible Difference blending is performed (since 1.3, implemented for types other than stNearest and stFastLinear).**omPsDifference5**: Difference blending compatible with Photoshop 5.x and earlier is performed (since 1.3, implemented for types other than stNearest and stFastLinear).**omPsExclusion**: Photoshop-compatible Exclusion blending is performed (since 1.3, implemented for types other than stNearest and stFastLinear).**omAdditive**: additive blending is performed (since 1.3, implemented for types other than stNearest and stFastLinear).**omSubtractive**: subtractive blending is performed (since 1.3, implemented for types other than stNearest and stFastLinear).**omMultiplicative**: multiplicative blending is performed (since 1.3, implemented for types other than stNearest and stFastLinear).**omDodge**: dodge blending is performed (since 1.3, implemented for types other than stNearest and stFastLinear).**omDarken**: darken (comparison) blending is performed (since 1.3, implemented for types other than stNearest and stFastLinear).**omLighten**: lighten (comparison) blending is performed (since 1.3, implemented for types other than stNearest and stFastLinear).**omScreen**: screen blending is performed (since 1.3, implemented for types other than stNearest and stFastLinear).**omAlpha**: alpha blending is performed.**omAddAlpha**: additive alpha blending is performed. In this case, when face is dfOpaque and hda is false, linear interpolation is possible by specifying stFastLinear as the type argument.**omOpaque**: the alpha information of src is ignored and src is always treated as fully opaque. In this case, when face is dfOpaque and hda is false, linear interpolation is possible by specifying stFastLinear as the type argument. |
face |
dfAlpha |
The drawing method.**dfAlpha**: the image is treated as an image with an alpha channel when drawn.**dfAddAlpha**: the image is treated as an image with an additive alpha channel when drawn.**dfOpaque**: the image is treated as fully opaque when drawn. |
opa |
255 |
The strength of the operation (0 to 255). |
type |
stNearest |
The type of scaling.**stNearest** : nearest neighbor 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 in 1.3)**stFastCubic** : fixed-point bicubic interpolation is used (since 1.3)**stCubic** : bicubic interpolation is used (implementation changed in 1.3)**stFastLanczos2** : fixed-point Lanczos interpolation over a 4x4 range is used (since 1.3)**stLanczos2** : Lanczos interpolation over a 4x4 range is used (since 1.3)**stFastLanczos3** : fixed-point Lanczos interpolation over a 6x6 range is used (since 1.3)**stLanczos3** : Lanczos interpolation over a 6x6 range is used (since 1.3)**stFastSpline16** : fixed-point 4x4 spline interpolation is used (since 1.3)**stSpline16** : 4x4 spline interpolation is used (since 1.3)**stFastSpline36** : fixed-point 6x6 spline interpolation is used (since 1.3)**stSpline36** : 6x6 spline interpolation is used (since 1.3)**stFastAreaAvg** : fixed-point area-averaging reduction is used; cannot enlarge (since 1.3)**stAreaAvg** : area-averaging reduction is used; cannot enlarge (since 1.3)**stFastGaussian** : fixed-point 4x4 Gaussian interpolation is used (since 1.3)**stGaussian** : 4x4 Gaussian interpolation is used (since 1.3)**stFastBlackmanSinc** : fixed-point 8x8 Blackman-Sinc interpolation is used (since 1.3)**stBlackmanSinc** : 8x8 Blackman-Sinc interpolation is used (since 1.3)Speed is fastest in the order stNearest > stFastLinear > stLinear > stCubic, but the faster the type, the lower the image quality. The interpolation methods from stCubic onward all give sufficiently high quality; choosing among them is largely a matter of taste. Gaussian interpolation, however, produces a somewhat blurry result. The difference between stFastLinear and the other linear interpolations (stSemiFastLinear and stLinear) is most visible when reducing. stFastLinear always references the 4 surrounding pixels, whereas stSemiFastLinear and stLinear, when reducing, reference a range scaled so that it corresponds to 4 pixels at 1x, that is, a wider range of pixels, which gives higher quality (algorithmically, this is true linear interpolation). For stFastLinear, you can add stRefNoClip with a bitwise OR; this allows colors outside the area of the bitmap being copied to be referenced when compositing. Without it, pixels outside the source bitmap's range are never referenced, even if the source bitmap has room around it (colors outside the range are treated as the color of the nearest pixel within the range). |
hda |
false |
Whether to protect the alpha channel. |
option |
-1.0 |
Added in 1.3. Sharpness for bicubic interpolation. Currently has no meaning for other interpolation methods. Increasing the sharpness value in the positive direction makes the result blurrier; increasing it in the negative direction makes it sharper. |
Description
Composites with scaling
Composites the specified rectangle of the source Bitmap into a rectangle of the destination Bitmap.
If the source and destination rectangles differ in size, the image is enlarged or reduced.
flipLR¶
Method
Arguments
| Arguments | Default | Description |
|---|---|---|
bmp |
|
The Bitmap object to flip. |
rect |
null |
The area to flip, as a Rect object (in image coordinates of the Bitmap). If omitted, the whole image is used. |
Description
Flips horizontally
Flips the image horizontally.
flipUD¶
Method
Arguments
| Arguments | Default | Description |
|---|---|---|
bmp |
|
The Bitmap object to flip. |
rect |
null |
The area to flip, as a Rect object (in image coordinates of the Bitmap). If omitted, the whole image is used. |
Description
Flips vertically
Flips the image vertically.
adjustGamma¶
Method
Arguments
| Arguments | Default | Description |
|---|---|---|
bmp |
|
The Bitmap object to gamma-correct. |
rgamma |
1.0 |
Gamma value of the red component (0.0 through 1.0 to 9.0). |
rfloor |
0 |
Minimum output value of the red component (0 to 255). |
rceil |
255 |
Maximum output value of the red component (0 to 255). |
ggamma |
1.0 |
Gamma value of the green component (0.0 through 1.0 to 9.0). |
gfloor |
0 |
Minimum output value of the green component (0 to 255). |
gceil |
255 |
Maximum output value of the green component (0 to 255). |
bgamma |
1.0 |
Gamma value of the blue component (0.0 through 1.0 to 9.0). |
bfloor |
0 |
Minimum output value of the blue component (0 to 255). |
bceil |
255 |
Maximum output value of the blue component (0 to 255). |
cliprect |
null |
The clipping area, as a Rect object (in image coordinates of the Bitmap). If omitted, the whole image is used. |
isaddalpha |
false |
Whether the image is in additive alpha format. |
Description
Gamma correction
Applies gamma correction to the image.
A gamma value of 1.0 makes the gamma curve a straight line.
The minimum and maximum output values specify the lowest and highest luminance of each component.
Setting the maximum lower than the minimum inverts the image.
If isaddalpha is true, this method uses a special gamma correction routine for additive alpha blending.
This routine applies gamma correction to the part of additive alpha blending that corresponds to alpha blending, but not to the part that corresponds to additive blending.
doBoxBlur¶
Method
Arguments
| Arguments | Default | Description |
|---|---|---|
bmp |
|
The Bitmap object to blur. |
xblur |
1 |
The horizontal blur range. |
yblur |
1 |
The vertical blur range. |
cliprect |
null |
The clipping area, as a Rect object (in image coordinates of the Bitmap). If omitted, the whole image is used. |
isalpha |
true |
Whether the image has an alpha channel. |
Description
Applies a box blur
Applies a blur. The algorithm is a box blur.
A box blur takes the average luminance of the pixels within the range given by the two parameters xblur and yblur. For example, with xblur=10 and yblur=2, the average luminance of the pixels in the rectangle from -10 to 10 horizontally and -2 to 2 vertically, centered on the target pixel, becomes that pixel's final luminance.
The area of the range is (xblur x 2 + 1) x (yblur x 2 + 1). In the current version, if this area is less than 256, a faster algorithm is used than when it is 256 or more.
If isalpha is true, a special algorithm for alpha blending is used, which is somewhat slower.
If false, a faster algorithm is used.
doGrayScale¶
Method
Arguments
| Arguments | Default | Description |
|---|---|---|
bmp |
|
The Bitmap object to convert to grayscale. |
cliprect |
null |
The clipping area, as a Rect object (in image coordinates of the Bitmap). If omitted, the whole image is used. |
rweight |
|
Weight of the red component. Omit all three or specify all three. |
gweight |
|
Weight of the green component. |
bweight |
|
Weight of the blue component. |
Description
Converts to grayscale
Converts the image to grayscale.
If rweight / gweight / bweight are omitted, BT.709-equivalent weights (0.2126 / 0.7152 / 0.0722) are used (the previous behavior). The weights are handled the same way as in Layer.doGrayScale.
colorRect¶
Method
Arguments
| Arguments | Default | Description |
|---|---|---|
bmp |
|
The Bitmap object to fill. |
value |
|
The color or value to fill with. Its meaning depends on the face argument. **dfAlpha** : specify a color in 0xRRGGBB format**dfAddAlpha** : specify a color in 0xRRGGBB format**dfOpaque** : specify a color in 0xRRGGBB format**dfMask** : specify a mask (opacity) value (0 to 255)With dfOpaque, the mask information is ignored. With dfMask, the color information is left unchanged. With dfAlpha and a negative opa, this argument is ignored. |
opa |
255 |
The fill opacity (-255 through 0 to 255). This argument is ignored when face is dfMask or dfProvince (always fully opaque). Negative values are valid only when face is dfAlpha; in that case the value argument is ignored and opacity is removed from the image (specifying -255 makes the rectangle fully transparent). |
rect |
null |
The rectangle to fill, as a Rect object in pixels (in image coordinates). If omitted, the whole image is used. |
face |
dfAlpha |
The drawing method.**dfAlpha**: the image is treated as an image with an alpha channel when drawn.**dfAddAlpha**: the image is treated as an image with an additive alpha channel when drawn.**dfOpaque**: the image is treated as fully opaque when drawn. |
cliprect |
null |
The clipping area, as a Rect object (in image coordinates of the Bitmap). If omitted, the whole image is used. |
Description
Fills a rectangle semi-transparently
Fills a rectangle of the specified Bitmap image using the specified method.
Unlike ImageFunction.fillRect, you can specify an opacity and fill semi-transparently.
drawText¶
Method
Arguments
| Arguments | Default | Description |
|---|---|---|
bmp |
|
The Bitmap object to draw text on. |
font |
|
The font to draw with, as a Font object. |
x |
|
The x coordinate, in pixels, of the origin where text drawing starts (in image coordinates). |
y |
|
The y coordinate, in pixels, of the origin where text drawing starts (in image coordinates). |
text |
|
The text to draw. |
color |
|
The text color, in 0xRRGGBB format. |
opa |
255 |
The opacity of the text (-255 through 0 to 255). Negative values are valid only when face is dfAlpha; in that case opacity is removed in the shape of the text (the smaller the value, the stronger the effect). |
aa |
true |
Whether to anti-alias. True enables anti-aliasing; false disables it. |
face |
dfAlpha |
The drawing method.**dfAlpha**: the image is treated as an image with an alpha channel when drawn.**dfAddAlpha**: the image is treated as an image with an additive alpha channel when drawn.**dfOpaque**: the image is treated as fully opaque when drawn. |
shadowlevel |
0 |
The opacity of the shadow. The appropriate value depends on the shadowwidth argument. Specifying 0 draws no shadow. |
shadowcolor |
0x000000 |
The shadow color, in 0xRRGGBB format. |
shadowwidth |
0 |
The width (blur) of the shadow. 0 is the sharpest (no blur); larger values blur the shadow more. |
shadowofsx |
0 |
The x offset of the shadow, in pixels. Specifying 0 draws the shadow directly below. |
shadowofsy |
0 |
The y offset of the shadow, in pixels. Specifying 0 draws the shadow directly below. |
hda |
false |
Whether to protect the alpha channel. |
cliprect |
null |
The clipping area, as a Rect object (in image coordinates of the Bitmap). If omitted, the whole image is used. |
Return value
The drawn area (a Rect object).
Description
Draws text
Draws text on a Bitmap.
When face is dfOpaque, whether the destination mask is destroyed or protected depends on hda.
drawGlyph¶
Method
Arguments
| Arguments | Default | Description |
|---|---|---|
bmp |
|
The Bitmap object to draw text on. |
x |
|
The x coordinate, in pixels, of the origin where text drawing starts (in image coordinates). |
y |
|
The y coordinate, in pixels, of the origin where text drawing starts (in image coordinates). |
glyph |
|
The glyph to draw. |
color |
|
The text color, in 0xRRGGBB format. |
opa |
255 |
The opacity of the text (-255 through 0 to 255). Negative values are valid only when face is dfAlpha; in that case opacity is removed in the shape of the text (the smaller the value, the stronger the effect). |
aa |
true |
Whether to anti-alias. True enables anti-aliasing; false disables it. |
face |
dfAlpha |
The drawing method.**dfAlpha**: the image is treated as an image with an alpha channel when drawn.**dfAddAlpha**: the image is treated as an image with an additive alpha channel when drawn.**dfOpaque**: the image is treated as fully opaque when drawn. |
shadowlevel |
0 |
The opacity of the shadow. The appropriate value depends on the shadowwidth argument. Specifying 0 draws no shadow. |
shadowcolor |
0x000000 |
The shadow color, in 0xRRGGBB format. |
shadowwidth |
0 |
The width (blur) of the shadow. 0 is the sharpest (no blur); larger values blur the shadow more. |
shadowofsx |
0 |
The x offset of the shadow, in pixels. Specifying 0 draws the shadow directly below. |
shadowofsy |
0 |
The y offset of the shadow, in pixels. Specifying 0 draws the shadow directly below. |
hda |
false |
Whether to protect the alpha channel. |
cliprect |
null |
The clipping area, as a Rect object (in image coordinates of the Bitmap). If omitted, the whole image is used. |
Return value
The drawn area (a Rect object).
Description
Draws text
Draws a glyph on a Bitmap.
When face is dfOpaque, whether the destination mask is destroyed or protected depends on hda.
The glyph is specified as an array of the form glyph : Array[9] = [ width, height, originx, originy, incx, incy, inc, bitmap(Octet), colors ].
If colors is omitted from the glyph, 256 levels are assumed.
fillRect¶
Method
Arguments
| Arguments | Default | Description |
|---|---|---|
bmp |
|
The Bitmap object to fill. |
value |
|
The color or value to fill with. Its meaning depends on isalpha. **true** : specify opacity and color in 0xAARRGGBB format. Both the main image and the mask are filled.**false** : specify a color in 0xRRGGBB format. |
rect |
null |
The rectangle to fill, as a Rect object in pixels (in image coordinates). If omitted, the whole image is used. |
isalpha |
true |
Whether the image has an alpha channel. |
cliprect |
null |
The clipping area, as a Rect object (in image coordinates of the Bitmap). If omitted, the whole image is used. |
Description
Fills a rectangle
Fills a rectangle of the specified Bitmap image using the specified method.
copy9Patch¶
Method
Arguments
| Arguments | Type | Default | Description |
|---|---|---|---|
dst |
Bitmap |
|
Destination Bitmap. |
src |
Bitmap |
|
Source Bitmap. |
Return value
The margin information.
Description
Copies an image using 9-patch (multi-platform version and later)
Copies an image using 9-patch (slicing). The returned margin information is a Rect object. Draw text and the like within these margins.