FlexElementpublic class PixelMapElement extends Element
Element object that wraps a PixelMap object.
You can create a PixelMapElement object based on a PixelMap object.
Element.ConstantState, Element.OnBoundsChangeListener, Element.OnChangeListener, Element.OnLayoutDirectionChangeListener, Element.OnRankChangeListener| 限定符和类型 | 字段 | 说明 |
|---|---|---|
protected PixelMap |
mUserPixelMap |
A
PixelMap object. |
ALPHA_DEFAULT, ALPHA_MAX, ALPHA_MIN, DEFAULT_BOUNDS_RECT, MAX_RANK, MIN_RANK| 构造器 | 说明 |
|---|---|
PixelMapElement() |
Default constructor.
|
PixelMapElement(Resource resource) |
A constructor used to create a
PixelMapElement instance based on a given image resource and immediately
decode the resource. |
PixelMapElement(Resource resource,
boolean startDecode) |
A constructor used to create a
PixelMapElement based on a given image resource and may decode the
resource immediately, depending on the startDecode parameter. |
PixelMapElement(PixelMap pixelMap) |
A constructor used to create an
Element instance based on a PixelMap source. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
int |
getAlignment() |
Obtains an
alignment value. |
boolean |
getFilterPixelMap() |
Checks whether the bilinear filter is enabled for the pixel map.
|
Optional<Shader.TileMode> |
getHorizontalTileMode() |
Obtains the horizontal TileMode of this
PixelMapElement. |
PixelMap |
getPixelMap() |
Obtains a
PixelMap object from SharedProps. |
Optional<Shader.TileMode> |
getVerticalTileMode() |
Obtains the vertical TileMode of this
PixelMapElement. |
boolean |
isAntiAlias() |
Checks whether anti-aliasing is enabled for this
PixelMapElement. |
void |
setAlignment(int alignment) |
Sets the alignment mode for this
PixelMapElement. |
void |
setAntiAlias(boolean isAntiAlias) |
Enables or disables anti-aliasing for this
PixelMapElement. |
void |
setFilterPixelMap(boolean filter) |
Sets whether to enable bilinear filtering on this
PixelMapElement object to achieve better display effect
during rotation. |
void |
setHorizontalTileMode(Shader.TileMode horizontalMode) |
Sets the horizontal repeat behavior for this
PixelMapElement. |
void |
setRenderDensity(int density) |
Sets the render density for this
PixelMapElement. |
void |
setTileMode(Shader.TileMode horizontalMode,
Shader.TileMode verticalMode) |
Sets the horizontal and vertical repeat behavior for this
PixelMapElement. |
void |
setVerticalTileMode(Shader.TileMode verticalMode) |
Sets the vertical repeat behavior for this
PixelMapElement. |
clearColorMatrix, drawToCanvas, getAlpha, getBounds, getCallback, getColorMatrix, getCurrentElement, getHeight, getLayoutDirection, getMinHeight, getMinWidth, getPadding, getRank, getStateColorMode, getVisible, getWidth, isInheritDirection, isStateful, isVisible, release, setAlpha, setBounds, setBounds, setCallback, setColorMatrix, setInheritDirection, setLayoutDirection, setOnBoundsChangeListener, setOnLayoutDirectionChangeListener, setOnRankChangeListener, setRank, setStateColor, setStateColorList, setStateColorMode, setVisible, skipAnimationprotected PixelMap mUserPixelMap
PixelMap object.public PixelMapElement()
public PixelMapElement(PixelMap pixelMap)
Element instance based on a PixelMap source.pixelMap - Indicates the image to be drawn on the Element object.public PixelMapElement(Resource resource)
PixelMapElement instance based on a given image resource and immediately
decode the resource.resource - Indicates the image resource to draw on the PixelMapElement object.public PixelMapElement(Resource resource, boolean startDecode)
PixelMapElement based on a given image resource and may decode the
resource immediately, depending on the startDecode parameter.resource - Indicates the image resource to draw on the PixelMapElement object.startDecode - Specifies whether to decode the resource immediately. Value true means to
start decoding upon the creation, and false means the opposite.public PixelMap getPixelMap()
PixelMap object from SharedProps.PixelMap object from SharedProps.public void setFilterPixelMap(boolean filter)
PixelMapElement object to achieve better display effect
during rotation.filter - Specifies whether to enable bilinear filtering. Value true means to enable the
filter, and false means the opposite.public boolean getFilterPixelMap()
true if the filter is enabled; returns false otherwise.public void setAntiAlias(boolean isAntiAlias)
PixelMapElement.isAntiAlias - Specifies whether to enable anti-aliasing.Value true means to enable anti-aliasing;
false means the opposite.public boolean isAntiAlias()
PixelMapElement.true if anti-aliasing is enabled; returns false otherwise.public void setTileMode(Shader.TileMode horizontalMode, Shader.TileMode verticalMode)
PixelMapElement.
To check the result of TileMode, make sure the size of the PixelMap is smaller than that of
the PixelMapElement. The value can be any of the following:
Shader.TileMode.CLAMP_TILEMODE: copies the edge color.
Shader.TileMode.REPEAT_TILEMODE: repeats the image horizontally and vertically.
Shader.TileMode.MIRROR_TILEMODE: repeats the image horizontally and vertically,
alternating mirror images.
horizontalMode - Indicates the horizontal repeat mode for this PixelMapElement.verticalMode - Indicates the vertical repeat mode for this PixelMapElement.setHorizontalTileMode(ohos.agp.render.Shader.TileMode),
setVerticalTileMode(ohos.agp.render.Shader.TileMode)public void setHorizontalTileMode(Shader.TileMode horizontalMode)
PixelMapElement.
To check the result of TileMode, make sure the size of the PixelMap is smaller than that of
the PixelMapElement. The value can be any of the following:
Shader.TileMode.CLAMP_TILEMODE: copies the edge color.
Shader.TileMode.REPEAT_TILEMODE: repeats the image horizontally.
Shader.TileMode.MIRROR_TILEMODE: repeats the image horizontally,
alternating mirror images.
horizontalMode - Indicates the horizontal repeat mode for this PixelMapElement.setVerticalTileMode(ohos.agp.render.Shader.TileMode),
setTileMode(ohos.agp.render.Shader.TileMode, ohos.agp.render.Shader.TileMode)public void setVerticalTileMode(Shader.TileMode verticalMode)
PixelMapElement.
To check the result of TileMode, make sure the size of the PixelMap is smaller than that of
the PixelMapElement. The value can be any of the following:
Shader.TileMode.CLAMP_TILEMODE: copies the edge color.
Shader.TileMode.REPEAT_TILEMODE: repeats the image vertically.
Shader.TileMode.MIRROR_TILEMODE: repeats the image vertically,
alternating mirror images.
verticalMode - Indicates the vertical repeat mode for this PixelMapElement.setHorizontalTileMode(ohos.agp.render.Shader.TileMode),
setTileMode(ohos.agp.render.Shader.TileMode, ohos.agp.render.Shader.TileMode)public Optional<Shader.TileMode> getHorizontalTileMode()
PixelMapElement.Shader.TileMode.CLAMP_TILEMODE,
Shader.TileMode.REPEAT_TILEMODE, or
Shader.TileMode.MIRROR_TILEMODE.public Optional<Shader.TileMode> getVerticalTileMode()
PixelMapElement.Shader.TileMode.CLAMP_TILEMODE,
Shader.TileMode.REPEAT_TILEMODE, or
Shader.TileMode.MIRROR_TILEMODE.public void setRenderDensity(int density)
PixelMapElement.
This PixelMapElement will be scaled and rendered by the specified density value.
density - Indicates the density scale for this PixelMapElement.public void setAlignment(int alignment)
PixelMapElement.alignment - Indicates the alignment mode.getAlignment(),
LayoutAlignmentpublic int getAlignment()
alignment value.alignment value.setAlignment(int)