# ImageProjector
# Constructor
Instantiates an ImageProjector.
- Arguments
image
required- Type:
HTMLImageElement
- Type:
# Instance Accessors
# image
get
- Type:
HTMLImageElement
- Type:
# Instance Methods
# project
Projects an image onto a pattern.
- Arguments
pattern
required- Type:
AcPattern
- Type:
imageOffsetX
- Type:
number
- Default:
0
- Type:
imageOffsetY
- Type:
number
- Default:
0
- Type:
imageOffsetWidth
- Type:
number
- Default:
this.image.width
- Type:
imageOffsetHeight
- Type:
number
- Default:
this.image.height
- Type:
section
- Type:
PixelsSource
- Default:
pattern.sections.texture
- Type:
sectionOffsetX
- Type:
number
- Default:
0
- Type:
sectionOffsetY
- Type:
number
- Default:
0
- Type:
sectionOffsetWidth
- Type:
number
- Default:
section.width
- Type:
sectionOffsetHeight
- Type:
number
- Default:
section.height
- Type:
paletteOffset
- Type:
number
- Default:
0
- Type:
paletteSize
- Type:
number
- Default:
pattern.palette.length
- Type:
opacityThreshold
- Type:
number
- Default:
1
- Type:
imageSmoothingQuality
- Type:
ImageProjector.ImageSmoothingQualities
- Default:
ImageProjector.ImageSmoothingQualities.None
- Type:
colorMatchingMethod
- Type:
ImageProjector.ColorMatchingMethods
- Default:
ImageProjector.ColorMatchingMethods.RGB
- Type:
- Returns
- Type:
Promise<void>
- Type:
(async () => {
/* make the pattern and image */
const pattern = new acpaterns.formats.Acnl();
const image = document.createElement("img");
image.src = "your-image-link or data-url";
// don't need to wait for the image to load, the imageProjector will wait
/* options */
const imageSmoothingQuality = acpatterns.ImageSmotothingQualities.High;
const colorMatchingMethod = acpatterns.ImageProjector.ColorMatchingMethods.LAB;
/* project image onto pattern */
const imageProjector = new acpatterns.ImageProjector(image);
await imageProjector.project(
pattern,
);
})();
# Static Properties
# ImageSmoothingQualities
- Type:
enum
- Properties:
None
Low
Medium
High
# ColorMatchingMethods
- Type:
enum
- Properties:
RGB
LAB
CMYK
GL