editor › Globals › EngravingTextureDrawer
Class: EngravingTextureDrawer
A TextureDrawer that draws engravings onto a texture
Hierarchy
↳ EngravingTextureDrawer
Index
Constructors
Properties
- canvas
- context
- mirrorX
- ornaments
- outline
- plate
- plateCoordinatesToTexturize
- polygon
- promises
- texture
- textureEnlargementVector
Methods
- _clearCanvas
- _drawCutLines
- _drawCuttingOrnaments
- _drawDrawableOrnaments
- getTexture
- _cleanUpAsyncDrawCall
- _drawCoordinateSystem
- _getCanvas
- _getCanvasParams
- _saveAsyncDrawCall
- cancelAsyncDrawCalls
Constructors
constructor
+ new EngravingTextureDrawer(plate: Plate, ornaments: Ornament[], polygon: MultiPolygon, plateCoordinatesToTexturize: AABB, canvas: HTMLCanvasElement, mirrorX: boolean): EngravingTextureDrawer
Inherited from TextureDrawer.constructor
Defined in src/model/visualization/textures/TextureDrawer.ts:172
Creates a texture drawer
Parameters:
| Name | Type | Default | Description |
|---|---|---|---|
plate |
Plate | - | the Plate object |
ornaments |
Ornament[] | - | the ornaments that should be drawn |
polygon |
MultiPolygon | - | the plate polygon |
plateCoordinatesToTexturize |
AABB | - | the plate coordinate area that needs to be texturized |
canvas |
HTMLCanvasElement | null | (optional) the canvas to re-use |
mirrorX |
boolean | false | (optional) renders the image mirrored in x direction (left <-> right), default is false |
Returns: EngravingTextureDrawer
Properties
Protected canvas
• canvas: HTMLCanvasElement
Inherited from TextureDrawer.canvas
Defined in src/model/visualization/textures/TextureDrawer.ts:167
Protected context
• context: CanvasRenderingContext2D
Inherited from TextureDrawer.context
Defined in src/model/visualization/textures/TextureDrawer.ts:170
Protected mirrorX
• mirrorX: boolean
Inherited from TextureDrawer.mirrorX
Defined in src/model/visualization/textures/TextureDrawer.ts:168
Protected ornaments
• ornaments: Ornament[]
Inherited from TextureDrawer.ornaments
Defined in src/model/visualization/textures/TextureDrawer.ts:163
Protected outline
• outline: Outline
Inherited from TextureDrawer.outline
Defined in src/model/visualization/textures/TextureDrawer.ts:171
Protected plate
• plate: Plate
Inherited from TextureDrawer.plate
Defined in src/model/visualization/textures/TextureDrawer.ts:165
Protected plateCoordinatesToTexturize
• plateCoordinatesToTexturize: AABB
Inherited from TextureDrawer.plateCoordinatesToTexturize
Defined in src/model/visualization/textures/TextureDrawer.ts:164
Protected polygon
• polygon: MultiPolygon
Inherited from TextureDrawer.polygon
Defined in src/model/visualization/textures/TextureDrawer.ts:166
Private promises
• promises: Array‹Promise‹any›› = []
Defined in src/model/visualization/textures/EngravingTextureDrawer.ts:11
Protected texture
• texture: Texture
Inherited from TextureDrawer.texture
Defined in src/model/visualization/textures/TextureDrawer.ts:172
Protected textureEnlargementVector
• textureEnlargementVector: Vector3
Inherited from TextureDrawer.textureEnlargementVector
Defined in src/model/visualization/textures/TextureDrawer.ts:169
Methods
Protected _clearCanvas
▸ _clearCanvas(): void
Inherited from TextureDrawer._clearCanvas
Defined in src/model/visualization/textures/TextureDrawer.ts:246
Prepare the canvas for drawing a new texture on it. Override in sub class if you need other initialization
Returns: void
Private _drawCutLines
▸ _drawCutLines(context: CanvasRenderingContext2D, cutLines: any): void
Defined in src/model/visualization/textures/EngravingTextureDrawer.ts:61
Parameters:
| Name | Type |
|---|---|
context |
CanvasRenderingContext2D |
cutLines |
any |
Returns: void
Protected _drawCuttingOrnaments
▸ _drawCuttingOrnaments(): void
Overrides TextureDrawer._drawCuttingOrnaments
Defined in src/model/visualization/textures/EngravingTextureDrawer.ts:57
Returns: void
Protected _drawDrawableOrnaments
▸ _drawDrawableOrnaments(plateCoordinatesToTexturize: AABB): void
Overrides TextureDrawer._drawDrawableOrnaments
Defined in src/model/visualization/textures/EngravingTextureDrawer.ts:13
Parameters:
| Name | Type |
|---|---|
plateCoordinatesToTexturize |
AABB |
Returns: void
getTexture
▸ getTexture(): Texture
Inherited from TextureDrawer.getTexture
Defined in src/model/visualization/textures/TextureDrawer.ts:207
Draws the instance's ornaments onto a newly created THREE.Texture
Returns: Texture
Static Protected _cleanUpAsyncDrawCall
▸ _cleanUpAsyncDrawCall(canvas: any, cancelFn: any): void
Inherited from TextureDrawer._cleanUpAsyncDrawCall
Defined in src/model/visualization/textures/TextureDrawer.ts:153
Parameters:
| Name | Type |
|---|---|
canvas |
any |
cancelFn |
any |
Returns: void
Static _drawCoordinateSystem
▸ _drawCoordinateSystem(context: any): void
Inherited from TextureDrawer._drawCoordinateSystem
Defined in src/model/visualization/textures/TextureDrawer.ts:29
Parameters:
| Name | Type |
|---|---|
context |
any |
Returns: void
Static _getCanvas
▸ _getCanvas(width: number, height: number, canvas: HTMLCanvasElement): HTMLCanvasElement
Inherited from TextureDrawer._getCanvas
Defined in src/model/visualization/textures/TextureDrawer.ts:96
Gets a canvas with the supplied width and height. It may be created or reuse the existing one.
Parameters:
| Name | Type | Description |
|---|---|---|
width |
number | the desired width of the canvas |
height |
number | the desired height of the canvas |
canvas |
HTMLCanvasElement | (optional) a canvas to reuse |
Returns: HTMLCanvasElement
a canvas with the supplied width and height
Static _getCanvasParams
▸ _getCanvasParams(uvMin: any, uvMax: any, resolution: any, maxTextureSize: number): object
Inherited from TextureDrawer._getCanvasParams
Defined in src/model/visualization/textures/TextureDrawer.ts:67
Parameters:
| Name | Type | Default |
|---|---|---|
uvMin |
any | - |
uvMax |
any | - |
resolution |
any | - |
maxTextureSize |
number | 4096 |
Returns: object
-
height: any = sizeY
-
scaleX: number
-
scaleY: number
-
width: number = sizeX
Static Protected _saveAsyncDrawCall
▸ _saveAsyncDrawCall(canvas: any, cancelFn: any): void
Inherited from TextureDrawer._saveAsyncDrawCall
Defined in src/model/visualization/textures/TextureDrawer.ts:140
Parameters:
| Name | Type |
|---|---|
canvas |
any |
cancelFn |
any |
Returns: void
Static cancelAsyncDrawCalls
▸ cancelAsyncDrawCalls(canvas: any): void
Inherited from TextureDrawer.cancelAsyncDrawCalls
Defined in src/model/visualization/textures/TextureDrawer.ts:124
Parameters:
| Name | Type |
|---|---|
canvas |
any |
Returns: void