makeup|SDK makeup|SDK is a library based on visage|SDK face tracking used to configure and render virtual makeup.

Loading...
Searching...
No Matches
Instance Methods | Class Methods | Properties | List of all members
Element Class Reference

`#import <FeatureTemplate.h>`

Inherits NSObject.

## Instance Methods
(NSString *) | - GetName
(NSString *) | - GetArea
(void) | - SetArea:
(Color *) | - GetColor
(void) | - SetColor:
(NSString *) | - GetTexture
(void) | - SetTexture:
(NSMutableDictionary *) | - ToJSON

## Class Methods
(Element *) | + FromJSON:

## Properties
NSString * | name
NSString * | area
NSString * | texture
Color * | color
Boolean | useColor
Boolean | useTexture

## Detailed Description

Stores updatable rendering parameters of elements contained in a created makeup effect. Element instances are created from ElementTemplate instances attached to FeatureTemplate and or FinishTemplate used for creating the effect. Each ElementTemplate attached to both FeatureTemplate and FinishTemplate used to create the effect is mapped to a single Element.

Element is defined by the following:

- name : read-only member used for identification between different elements
- color : color of the rendered feature
- area : area where the rendering will be performed.

Color is stored in Color class which contains a 4 dimensional vector specifying red, green, blue and alpha channels.

Area is specified as a name of the image file that contains a greyscale image specifying how much of the color of this Element should be used at each fragment of the mesh used for rendering of the effect containing this Element. For each pixel in the area image, if the pixel is white 100% of color from this element will be used. If the pixel is black 100% of the color from the previous element will be used. The pixel values in between are lineraly interpolated.

Once an effect is created from a FeatureTemplate each ElementTemplate in the feature is mapped to one Element. The previous element of the first element in an effect is the output of the previous effect. If there are no previous effects displayed, the previous element is raw input image without augmentation.

The location where area images are stored is <path to platform dependent assets folder> + "/Textures/Area/" + Effect.type + Element.area where Effect.type is type of the effect containing this Element and Element.area is the area parameter of this Element. The location for storing of the color map is <path to platform dependent assets folder> + "/Textures/" + Element.texture.

Since the area image is used as a texture on a mesh used for rendering the feature it will only work correctly if the uv mapping used on the mesh matches the area image. This means that area images can be reused between effects only if the effects have the same type. Therefore, when specifying a new custom area image, the image file needs to be placed in the subfolder specific to the type of the effect new area was created for.

The available meshes are stored in .obj format in the "Assets/Models" folder of the package. UV maps from these meshes should be used when creating new area images.

## Method Documentation

## ◆ FromJSON:

+ (Element *) FromJSON: |  | (NSDictionary *) | jsonDictionary |

Deserializes Element object from JSON representation

Parameters

  jsonDictionary | JSON dictionarx

Returns
  deserialized Element object

## ◆ GetArea

- (NSString *) GetArea |  |  |

Returns the image file name specifying the area of the element.

Returns
  area of the element

## ◆ GetColor

- (Color *) GetColor |  |  |

Returns the color of the element

Returns
  color of the element

## ◆ GetName

- (NSString *) GetName |  |  |

Returns the name of the element

Returns
  name of the element

## ◆ GetTexture

- (NSString *) GetTexture |  |  |

Returns the texture of the element

Returns
  texture of the element

## ◆ SetArea:

- (void) SetArea: |  | (NSString *) | area |

Sets the image file name specifying the area of the element.

Parameters

  area | path to texture file specifying area to be used

## ◆ SetColor:

- (void) SetColor: |  | (Color *) | color |

Sets the color of the element

Parameters

  color | Color object

## ◆ SetTexture:

- (void) SetTexture: |  | (NSString *) | texture |

Sets the texture of the element

Parameters

  texture | path to texture file

## ◆ ToJSON

- (NSMutableDictionary *) ToJSON |  |  |

Returns JSON representation out of Element object

Returns
  JSON representation of this Element returned as NSMutableDictionary

## Property Documentation

## ◆ area

- (NSString*) area
| read write nonatomic strong

Name of the image file specifying the area where rendering of this element will be performed.

## ◆ color

- (Color*) color
| read write nonatomic strong

Color of the rendered feature

## ◆ name

- (NSString*) name
| read write nonatomic strong

Name of the element

## ◆ texture

- (NSString*) texture
| read write nonatomic strong

Path used to store color map of the rendered feature.

## ◆ useColor

- (Boolean) useColor
| read write nonatomic assign

Some of the feature elements do not use coloring step in their pipelines. Set to true if element uses (RGB) of the color, otherwise it only uses the alpha channel to control intensity.

## ◆ useTexture

- (Boolean) useTexture
| read write nonatomic assign

Some of the feature elements do not use coloring step in their pipelines. Set to true If element should use the provided color map stored in texture member, otherwise it only uses the alpha channel provided in the color member to control intensity.