EditableImage
Instance which allows for the runtime creation and manipulation of images.
Memory category | Instances |
---|
Member index 16
Description
EditableImage allows for the runtime creation and manipulation of images. It can be created from an existing image using AssetService:CreateEditableImageAsync(), or a blank EditableImage can be created with Instance.new(). EditableImage overrides the image/texture displayed when parented to certain objects as follows:
Object | Overridden |
---|---|
MeshPart | MeshPart.TextureID |
ImageLabel | ImageLabel.Image |
ImageButton | ImageButton.Image |
Decal | Decal.Texture |
Texture | Texture.Texture |
SurfaceAppearance | SurfaceAppearance.ColorMap |
The EditableImage coordinate system is relative to the top left of the image:
- Top-left:
(0, 0)
- Bottom-right:
(Size.X - 1, Size.Y - 1)
When publishing an object via AssetService:PromptCreateAssetAsync() that has a property overridden by a child EditableImage, the editable image will be published as an image and the overridden property will be set to the new asset ID.
History 24
- 640 Add WritePixelsBuffer
- 640 Add ReadPixelsBuffer
- 636 Add
- 632 Change Parameters of DrawRectangle from (position: Vector2, size: Vector2, color: Color3, transparency: float) to (position: Vector2, size: Vector2, color: Color3, transparency: float, combineType: ImageCombineType)
- 632 Change Parameters of DrawLine from (p1: Vector2, p2: Vector2, color: Color3, transparency: float) to (p1: Vector2, p2: Vector2, color: Color3, transparency: float, combineType: ImageCombineType)
- 632 Change Parameters of DrawCircle from (center: Vector2, radius: int, color: Color3, transparency: float) to (center: Vector2, radius: int, color: Color3, transparency: float, combineType: ImageCombineType)
- 623 Change Tags of EditableImage from [NotReplicated] to []
- 616 Add DrawProjectionImage
- 604 Change Tags of EditableImage from [] to [NotReplicated]
- 603 Change Tags of EditableImage from [NotReplicated] to []
- 604 Change Tags of EditableImage from [] to [NotReplicated]
- 601 Add WritePixels
- 601 Add Rotate
- 601 Add Resize
- 601 Add ReadPixels
- 601 Add DrawRectangle
- 601 Add DrawLine
- 601 Add DrawImage
- 601 Add DrawCircle
- 601 Add Crop
- 601 Add Copy
- 601 Add Size
- 601 Add
- 601 Add EditableImage
Members 16
Copy
Parameters (2) | ||
---|---|---|
min | Vector2 | |
max | Vector2 | |
Returns (1) | ||
EditableImage |
Copies a subregion of the EditableImage to a new EditableImage.
Thread safety | Unsafe |
---|
Crop
Parameters (2) | ||
---|---|---|
min | Vector2 | |
max | Vector2 | |
Returns (1) | ||
null |
Crops the EditableImage to the specified subregion.
Thread safety | Unsafe |
---|
DrawCircle
Parameters (5) | ||
---|---|---|
center | Vector2 | |
radius | int | |
color | Color3 | |
transparency | float | |
combineType | ImageCombineType | |
Returns (1) | ||
null |
Draws a circle at the specified point on the EditableImage. If the circle is semi-transparent, it will be blended with the pixels behind it using source over blending.
Thread safety | Unsafe |
---|
History 2
- 632 Change Parameters of DrawCircle from (center: Vector2, radius: int, color: Color3, transparency: float) to (center: Vector2, radius: int, color: Color3, transparency: float, combineType: ImageCombineType)
- 601 Add DrawCircle
DrawImage
Parameters (3) | ||
---|---|---|
position | Vector2 | |
image | EditableImage | |
combineType | ImageCombineType | |
Returns (1) | ||
null |
Draws another EditableImage into this EditableImage at the given position. Positions outside the canvas bounds are allowed such that only part of the new image is drawn.
Thread safety | Unsafe |
---|
DrawLine
Parameters (5) | ||
---|---|---|
p1 | Vector2 | |
p2 | Vector2 | |
color | Color3 | |
transparency | float | |
combineType | ImageCombineType | |
Returns (1) | ||
null |
Draws an anti-aliased line on the EditableImage one pixel thick between the two provided points.
Thread safety | Unsafe |
---|
DrawProjectionImage
Parameters (3) | ||
---|---|---|
mesh | EditableMesh | |
projection | Dictionary | |
brushConfig | Dictionary | |
Returns (1) | ||
null |
Thread safety | Unsafe |
---|
History 1
DrawRectangle
Parameters (5) | ||
---|---|---|
position | Vector2 | |
size | Vector2 | |
color | Color3 | |
transparency | float | |
combineType | ImageCombineType | |
Returns (1) | ||
null |
Draws a rectangle on the EditableImage of the given size at the given top-left position.
Thread safety | Unsafe |
---|
History 2
- 632 Change Parameters of DrawRectangle from (position: Vector2, size: Vector2, color: Color3, transparency: float) to (position: Vector2, size: Vector2, color: Color3, transparency: float, combineType: ImageCombineType)
- 601 Add DrawRectangle
ReadPixels
Parameters (2) | ||
---|---|---|
position | Vector2 | |
size | Vector2 | |
Returns (1) | ||
Array |
Reads a rectangular region of pixels. The pixels will be returned as a flat array where each pixel is represented by four numbers between 0 and 1 (red, green, blue, and alpha respectively). Note that this method uses alpha instead of transparency, unlike the EditableImage drawing methods.
Thread safety | Safe |
---|
History 1
- 601 Add ReadPixels
ReadPixelsBuffer
Parameters (2) | ||
---|---|---|
position | Vector2 | |
size | Vector2 | |
Returns (1) | ||
buffer |
Thread safety | Safe |
---|
History 1
- 640 Add ReadPixelsBuffer
Resize
Parameters (1) | ||
---|---|---|
size | Vector2 | |
Returns (1) | ||
null |
Resizes the contents and canvas of the EditableImage using bilinear interpolation. Max allowed size is 1024×1024.
Thread safety | Unsafe |
---|
Rotate
Parameters (2) | ||
---|---|---|
degrees | float | |
changeSize | bool | |
Returns (1) | ||
null |
Rotates the EditableImage around its center using bilinear interpolation.
Thread safety | Unsafe |
---|
Size
Type | Default | |
---|---|---|
Vector2 | 512, 512 |
Size of the EditableImage in pixels. The maximum size is 1024×1024 and attempting to set this property to a larger size will cause it to be clamped at 1024.
Setting this property changes the canvas size of the editable image
but does not resize the contents. If changing to a larger size, new pixels
will be set to an RGBA value of [0, 0, 0, 0]
. If changing to a smaller
size, existing pixels will be cropped. Consider using
Resize() to update the contents while
changing the size.
Thread safety | ReadSafe |
---|---|
Category | Data |
Loaded/Saved | true |
WritePixels
Parameters (3) | ||
---|---|---|
position | Vector2 | |
size | Vector2 | |
pixels | Array | |
Returns (1) | ||
null |
Writes a rectangular region of pixels into the EditableImage. The pixels are provided as a flat array where each pixel is represented by four numbers between 0 and 1 (red, green, blue, and alpha respectively). Note that this method uses alpha instead of transparency, unlike other EditableImage drawing methods.
Thread safety | Unsafe |
---|
History 1
- 601 Add WritePixels
WritePixelsBuffer
Parameters (3) | ||
---|---|---|
position | Vector2 | |
size | Vector2 | |
buffer | buffer | |
Returns (1) | ||
null |
Thread safety | Unsafe |
---|
History 1
- 640 Add WritePixelsBuffer