Class Index | File Index

Classes


Namespace jamHelpers


Version 4.5.

Defined in: jamHelpers.jsxinc.

Namespace Summary
Constructor Attributes Constructor Name and Description
 
Global object (used to simulate a namespace in JavaScript) containing a set of helper functions for scripts written with the JSON Action Manager engine.
Method Summary
Method Attributes Method Name and Description
<static>  
jamHelpers.fromBlendRangeList(blendRangeList, explicit)
Get a simplified blend range JSON array from a blend range list in JSON AM Data Format.
<static>  
jamHelpers.fromColorObject(colorObject, explicit)
Get a simplified color JSON object or JSON array from a color object in JSON AM Data Format.
<static>  
jamHelpers.fromCurvePointList(curvePointList, explicit)
Get a simplified curve point JSON array from a curve point list in JSON AM Data Format.
<static>  
jamHelpers.fromGradientObject(gradientObject, explicit)
Get a simplified gradient JSON object or JSON array from a gradient object in JSON AM Data Format.
<static>  
jamHelpers.fromIntegerList(integerList)
Get a JSON array of integer values from an integer list in JSON AM Data Format.
<static>  
jamHelpers.fromPathComponentList(pathComponentList, explicit)
Get either a JSON object or a JSON array (made of two elements: simplified path component values and unit ID string for coordinates) from a path component list in JSON AM Data Format.
<static>  
jamHelpers.fromPointList(pointList)
Get a JSON array of data (list of points) and optional unit ID string from a point list in JSON AM Data Format.
<static>  
jamHelpers.hexFromColorObject(colorObject, noSign, lowercase)
Get a RGB color string in HTML/CSS hexadecimal notation from a color object in JSON AM Data Format.
<static>  
jamHelpers.hexToColorObject(hexColorString)
Get a color object in JSON AM Data Format from a RGB color string in HTML/CSS hexadecimal notation.
<static>  
jamHelpers.nameToColorObject(setName, colorName)
Get a color object in JSON AM Data Format from a color name belonging to a named colors set.
<static>  
jamHelpers.toBlendRangeList(blendRanges)
Get a blend range list in JSON AM Data Format from a JSON array of individual channel blend ranges.
<static>  
jamHelpers.toColorObject(color)
Get a color object in JSON AM Data Format from a simplified color JSON object or JSON array.
<static>  
jamHelpers.toCurvePointList(curvePoints)
Get a curve point list in JSON AM Data Format from a JSON array of curve points.
<static>  
jamHelpers.toCurvesAdjustmentList(curvesAdjustmentsArr)
Get a curves adjustment list in JSON AM Data Format from a JSON array of channel and individual channel curves values.
<static>  
jamHelpers.toCustomShapeObject(customShapeArr)
Get a custom shape object in JSON AM Data Format from a JSON array of data (name and bound values) and optional unit ID string.
<static>  
jamHelpers.toEllipseObject(ellipseArr)
Get an ellipse object in JSON AM Data Format from a JSON array of data (bound values) and optional unit ID string.
<static>  
jamHelpers.toGradientObject(gradient)
Get a gradient object in JSON AM Data Format from a simplified gradient JSON object or JSON array.
<static>  
jamHelpers.toHueSatAdjustmentV2List(hueSatAdjustmentsArr)
Get a hue/saturation adjustment list in JSON AM Data Format from a JSON array of master and local color ranges.
<static>  
jamHelpers.toIntegerList(integersArr)
Get an integer list in JSON AM Data Format from a JSON array of integer values.
<static>  
jamHelpers.toOffsetObject(offsetArr)
Get an offset object in JSON AM Data Format from a JSON array of data (offset values) and optional unit ID string.
<static>  
jamHelpers.toPathComponentList(pathComponents)
Get a path component list in JSON AM Data Format from either a JSON object or a JSON array (made of two elements: simplified path component values and unit ID string for coordinates).
<static>  
jamHelpers.toPointList(pointsArr)
Get a point list in JSON AM Data Format from a JSON array of data (list of points) and optional unit ID string.
<static>  
jamHelpers.toPointObject(pointArr)
Get a point object in JSON AM Data Format from a JSON array of data (coordinate values) and optional unit ID string.
<static>  
jamHelpers.toRationalPointList(rationalPointsArr)
Get a rational point list in JSON AM Data Format from a JSON array of a list of rational points and optional unit ID string.
<static>  
jamHelpers.toRectangleObject(rectangleArr)
Get a rectangle object in JSON AM Data Format from a JSON array of data (bound values and optional radius) and optional unit ID string.
Namespace Detail
jamHelpers
Global object (used to simulate a namespace in JavaScript) containing a set of helper functions for scripts written with the JSON Action Manager engine.
Author: Michel MARIANI.
Method Detail
<static> {Array} jamHelpers.fromBlendRangeList(blendRangeList, explicit)
Get a simplified blend range JSON array from a blend range list in JSON AM Data Format.
var blendRangeList =
{
    "<list>":
    [
        {
            "<object>":
            {
                "blendRange":
                {
                    "channel":
                    {
                        "<reference>": [ { "channel": { "<enumerated>": { "channel": "gray" } } } ]
                    },
                    "srcBlackMin": { "<integer>": 0 },
                    "srcBlackMax": { "<integer>": 80 },
                    "srcWhiteMin": { "<integer>": 255 },
                    "srcWhiteMax": { "<integer>": 255 },
                    "destBlackMin": { "<integer>": 0 },
                    "destBlackMax": { "<integer>": 0 },
                    "destWhiteMin": { "<integer>": 145 },
                    "destWhiteMax": { "<integer>": 255 }
                }
            }
        }
    ]
};
alert (jamJSON.stringify (jamHelpers.fromBlendRangeList (blendRangeList, true), '\t'));
// ->
// [
//     {
//         "channel": "gray",
//         "srcBlackMin": 0,
//         "srcBlackMax": 80,
//         "srcWhiteMin": 255,
//         "srcWhiteMax": 255,
//         "destBlackMin": 0,
//         "destBlackMax": 0,
//         "destWhiteMin": 145,
//         "destWhiteMax": 255
//     }
// ]
alert (jamJSON.stringify (jamHelpers.fromBlendRangeList (blendRangeList)));
// ->
// [ [ "gray", 0, 80, 255, 255, 0, 0, 145, 255 ] ]
Parameters:
{Object|Array} blendRangeList
Blend range list in JSON AM Data Format
{Boolean} explicit Optional
Explicit flag: if true, return a JSON array made of explicit JSON objects instead of minimal JSON arrays
Returns:
{Array} Simplified blend range JSON array (cf. Blend Range List Simplified Format)
See:
jamHelpers.toBlendRangeList

<static> {Object|Array} jamHelpers.fromColorObject(colorObject, explicit)
Get a simplified color JSON object or JSON array from a color object in JSON AM Data Format.
jamEngine.meaningfulIds = true;
var resultObj = jamEngine.jsonGet ([ { "application": { "<enumerated>": { "ordinal": "targetEnum" } } } ]);
var fgColorArr = jamHelpers.fromColorObject (resultObj["foregroundColor"], true);
alert (jamJSON.stringify (fgColorArr));
// -> { "hue": 260, "saturation": 48, "brightness": 92 } // Lavender
var bgColorArr = jamHelpers.fromColorObject (resultObj["backgroundColor"]);
alert (jamJSON.stringify (bgColorArr));
// -> [ "bookColor", [ "PANTONEĀ® solid coated", "PANTONE 2395 C", 3002, " 2395C" ] ] // Vivid Magenta
Parameters:
{Object|Array} colorObject
Color object in JSON AM Data Format
{Boolean} explicit Optional
Explicit flag: if true, return an explicit JSON object instead of a minimal JSON array
Returns:
{Object|Array} Simplified color JSON object or JSON array (cf. Color Object Simplified Format)
See:
jamHelpers.toColorObject

<static> {Array} jamHelpers.fromCurvePointList(curvePointList, explicit)
Get a simplified curve point JSON array from a curve point list in JSON AM Data Format.
var curvePointList =
{
    "<list>":
    [
        {
            "<object>":
            {
                "curvePoint":
                {
                    "horizontal": { "<double>": 0 },
                    "vertical": { "<double>": 0 }
                }
            }
        },
        {
            "<object>":
            {
                "curvePoint":
                {
                    "horizontal": { "<double>": 75 },
                    "vertical": { "<double>": 150 }
                }
            }
        },
        {
            "<object>":
            {
                "curvePoint":
                {
                    "horizontal": { "<double>": 175 },
                    "vertical": { "<double>": 25 },
                    "continuity": { "<boolean>": false }
                }
            }
        },
        {
            "<object>":
            {
                "curvePoint":
                {
                    "horizontal": { "<double>": 255 },
                    "vertical": { "<double>": 255 }
                }
            }
        }
    ]
};
alert (jamJSON.stringify (jamHelpers.fromCurvePointList (curvePointList, true), '\t'));
// ->
// [
//     {
//         "horizontal": 0,
//         "vertical": 0
//     },
//     {
//         "horizontal": 75,
//         "vertical": 150
//     },
//     {
//         "horizontal": 175,
//         "vertical": 25,
//         "continuity": false
//     },
//     {
//         "horizontal": 255,
//         "vertical": 255
//     }
// ]
alert (jamJSON.stringify (jamHelpers.fromCurvePointList (curvePointList)));
// ->
// [ [ 0, 0 ], [ 75, 150 ], [ 175, 25, false ], [ 255, 255 ] ]
Parameters:
{Object|Array} curvePointList
Curve point list in JSON AM Data Format
{Boolean} explicit Optional
Explicit flag: if true, return a JSON array made of explicit JSON objects instead of minimal JSON arrays
Returns:
{Array} Simplified curve point JSON array (cf. Curve Point List Simplified Format)
See:
jamHelpers.toCurvePointList

<static> {Object|Array} jamHelpers.fromGradientObject(gradientObject, explicit)
Get a simplified gradient JSON object or JSON array from a gradient object in JSON AM Data Format.
var gradientObject =
{
    "<object>":
    {
        "gradientClassEvent":
        {
            "name": { "<string>": "N-86" },
            "gradientForm": { "<enumerated>": { "gradientForm": "colorNoise" } },
            "showTransparency": { "<boolean>": false },
            "vectorColor": { "<boolean>": true },
            "colorSpace": { "<enumerated>": { "colorSpace": "labColor" } },
            "randomSeed": { "<integer>": 17 },
            "smoothness": { "<integer>": 3523 },   // 3523/4096 => 86 %
            "minimum":
            {
                "<list>":
                [
                    { "<integer>": 25 },
                    { "<integer>": 0 },
                    { "<integer>": 33 },
                    { "<integer>": 0 }
                ]
            },
            "maximum":
            {
                "<list>":
                [
                    { "<integer>": 75 },
                    { "<integer>": 67 },
                    { "<integer>": 100 },
                    { "<integer>": 100 }
                ]
            }
        }
    }
};
alert (jamJSON.stringify (jamHelpers.fromGradientObject (gradientObject, true), '\t'));
// ->
// {
//     "name": "N-86",
//     "gradientForm": "colorNoise",
//     "randomSeed": 17,
//     "showTransparency": false,
//     "vectorColor": true,
//     "smoothness": 3523,
//     "colorSpace": "labColor",
//     "minimum": [ 25, 0, 33, 0 ],
//     "maximum": [ 75, 67, 100, 100 ]
// }
alert (jamJSON.stringify (jamHelpers.fromGradientObject (gradientObject)));
// -> [ "N-86", "colorNoise", 17, false, true, 3523, "labColor", [ 25, 0, 33, 0 ], [ 75, 67, 100, 100 ] ]
Parameters:
{Object|Array} gradientObject
Gradient object in JSON AM Data Format
{Boolean} explicit Optional
Explicit flag: if true, return an explicit JSON object instead of a minimal JSON array
Returns:
{Object|Array} Simplified gradient JSON object or JSON array (cf. Gradient Object Simplified Format)
See:
jamHelpers.toGradientObject

<static> {Array} jamHelpers.fromIntegerList(integerList)
Get a JSON array of integer values from an integer list in JSON AM Data Format.
var integerList =
{
    "<list>":
    [
        { "<integer>": 0 },
        { "<integer>": 25 },
        { "<integer>": 50 },
        { "<integer>": 75 },
        { "<integer>": 100 }
    ]
};
alert (jamJSON.stringify (jamHelpers.fromIntegerList (integerList)));
// -> [ 0, 25, 50, 75, 100 ]
Parameters:
{Object|Array} integerList
Integer list in JSON AM Data Format
Returns:
{Array} JSON array of integer values (cf. Integer Simplified List Format)
See:
jamHelpers.toIntegerList

<static> {Array|Object} jamHelpers.fromPathComponentList(pathComponentList, explicit)
Get either a JSON object or a JSON array (made of two elements: simplified path component values and unit ID string for coordinates) from a path component list in JSON AM Data Format.
jamEngine.meaningfulIds = true;
jamEngine.parseFriendly = true;
var resultObj = jamEngine.jsonGet ([ { "path": { "<property>": "workPath" } } ]);
var pathComponentArr =
    jamHelpers.fromPathComponentList (resultObj["pathContents"][1][1]["pathComponents"], true);
jamUtils.writeJsonFile (new File ("~/Desktop/work-path.json"), pathComponentArr, '\t');
Parameters:
{Object|Array} pathComponentList
Path component list in JSON AM Data Format
{Boolean} explicit Optional
Explicit flag: if true, return an explicit JSON object instead of a minimal JSON array
Returns:
{Array|Object} JSON object or JSON array made of two elements: simplified path component values and unit ID string for coordinates ("distanceUnit", "percentUnit", "pixelsUnit") (cf. Path Component List Simplified Format)
See:
jamHelpers.toPathComponentList

<static> {Array} jamHelpers.fromPointList(pointList)
Get a JSON array of data (list of points) and optional unit ID string from a point list in JSON AM Data Format.
var pointList =
{
    "<list>":
    [
        {
            "<object>":
            {
                "point":
                {
                    "horizontal": { "<unitDouble>": { "percentUnit": 80 } },
                    "vertical": { "<unitDouble>": { "percentUnit": 50 } }
                }
            }
        },
        {
            "<object>":
            {
                "point":
                {
                    "horizontal": { "<unitDouble>": { "percentUnit": 20 } },
                    "vertical": { "<unitDouble>": { "percentUnit": 20 } }
                }
            }
        },
        {
            "<object>":
            {
                "point":
                {
                    "horizontal": { "<unitDouble>": { "percentUnit": 20 } },
                    "vertical": { "<unitDouble>": { "percentUnit": 80 } }
                }
            }
        }
    ]
};
alert (jamJSON.stringify (jamHelpers.fromPointList (pointList)));
// -> [ [ [ 80, 50 ], [ 20, 20 ], [ 20, 80 ] ], "percentUnit" ]
Parameters:
{Object|Array} pointList
Point list in JSON AM Data Format
Returns:
{Array} JSON array of data (list of points as JSON arrays of 2 numeric coordinates: [ horizontal, vertical ]) and optional unit ID string for coordinates (cf. Point List Simplified Format)
See:
jamHelpers.toPointList

<static> {String|Null} jamHelpers.hexFromColorObject(colorObject, noSign, lowercase)
Get a RGB color string in HTML/CSS hexadecimal notation from a color object in JSON AM Data Format.
jamEngine.meaningfulIds = true;
var resultObj = jamEngine.jsonGet ([ { "application": { "<enumerated>": { "ordinal": "targetEnum" } } } ]);
var fgHexColor = jamHelpers.hexFromColorObject (resultObj["foregroundColor"]);
alert (jamJSON.stringify (fgHexColor));  // -> "#FFDEAD"
var bgHexColor = jamHelpers.hexFromColorObject (resultObj["backgroundColor"], true, true);
alert (jamJSON.stringify (bgHexColor));  // -> "4b1f5e"
Parameters:
{Object|Array} colorObject
Color object in JSON AM Data Format
{Boolean} noSign Optional
Do not add a leading # sign (false by default)
{Boolean} lowercase Optional
Use lowercase hexadecimal digits (false by default)
Returns:
{String|Null} RGB color string in HTML/CSS hexadecimal notation (6 digits, starting with a # sign), or null if color object in JSON AM Data Format is not RGB
See:
jamHelpers.hexToColorObject

<static> {Object|Array} jamHelpers.hexToColorObject(hexColorString)
Get a color object in JSON AM Data Format from a RGB color string in HTML/CSS hexadecimal notation.
jamEngine.jsonPlay
(
    "set",
    {
        "target": { "<reference>": [ { "color": { "<property>": "backgroundColor" } } ] },
        "to": jamHelpers.hexToColorObject ("#F0F")
    }
);
jamEngine.jsonPlay
(
    "set",
    {
        "target": { "<reference>": [ { "color": { "<property>": "foregroundColor" } } ] },
        "to": jamHelpers.hexToColorObject ("#00FF00")
    }
);
Parameters:
{String} hexColorString
RGB color string in HTML/CSS hexadecimal notation (3 or 6 digits, starting with an optional # sign)
Returns:
{Object|Array} Color object in JSON AM Data Format
See:
jamHelpers.hexFromColorObject

<static> {Object|Array} jamHelpers.nameToColorObject(setName, colorName)
Get a color object in JSON AM Data Format from a color name belonging to a named colors set.
jamEngine.jsonPlay
(
    "set",
    {
        "target": { "<reference>": [ { "color": { "<property>": "backgroundColor" } } ] },
        "to": jamHelpers.nameToColorObject ("W3C", "Slate Grey")
    }
);
jamEngine.jsonPlay
(
    "set",
    {
        "target": { "<reference>": [ { "color": { "<property>": "foregroundColor" } } ] },
        "to": jamHelpers.nameToColorObject ("X11", "Deep Pink 4")
    }
);
Parameters:
{String} setName
Named colors set name (case-insensitive, whitespace ignored):
{String} colorName
Color name (case-insensitive, whitespace ignored)
Returns:
{Object|Array} Color object in JSON AM Data Format

<static> {Object|Array} jamHelpers.toBlendRangeList(blendRanges)
Get a blend range list in JSON AM Data Format from a JSON array of individual channel blend ranges.
var blendRanges =
[
    {
        "channel": "gray",
        "srcBlackMin": 0,
        "srcBlackMax": 80,
        "srcWhiteMin": 255,
        "srcWhiteMax": 255,
        "destBlackMin": 0,
        "destBlackMax": 0,
        "destWhiteMin": 255,
        "destWhiteMax": 255
    },
    {
        "channel": "red",
        "srcBlackMin": 0,
        "srcBlackMax": 0,
        "srcWhiteMin": 255,
        "srcWhiteMax": 255,
        "destBlackMin": 0,
        "destBlackMax": 0,
        "destWhiteMin": 145,
        "destWhiteMax": 255
    }
];
jamEngine.jsonPlay
(
    "set",
    {
        "target": { "<reference>": [ { "layer": { "<enumerated>": { "ordinal": "targetEnum" } } } ] },
        "to":
        {
            "<object>":
            {
                "layer":
                {
                    "blendRange": jamHelpers.toBlendRangeList (blendRanges)
                }
            }
        }
    }
);
Parameters:
{Array} blendRanges
JSON array of individual channel blend ranges, each one being either a JSON object or a JSON array (cf. Blend Range List Simplified Format)
Returns:
{Object|Array} Blend range list in JSON AM Data Format
See:
jamHelpers.fromBlendRangeList

<static> {Object|Array} jamHelpers.toColorObject(color)
Get a color object in JSON AM Data Format from a simplified color JSON object or JSON array.
jamEngine.jsonPlay
(
    "set",
    {
        "target": { "<reference>": [ { "color": { "<property>": "foregroundColor" } } ] },
        "to": jamHelpers.toColorObject ({ "luminance": 77, "a": -43, "b": 68 })
    }
);
jamEngine.jsonPlay
(
    "set",
    {
        "target": { "<reference>": [ { "color": { "<property>": "backgroundColor" } } ] },
        "to": jamHelpers.toColorObject ([ "RGBColor", [ 184, 0, 184 ] ])
    }
);
Parameters:
{Object|Array} color
Simplified color JSON object or JSON array (cf. Color Object Simplified Format)
Returns:
{Object|Array} Color object in JSON AM Data Format
See:
jamHelpers.fromColorObject

<static> {Object|Array} jamHelpers.toCurvePointList(curvePoints)
Get a curve point list in JSON AM Data Format from a JSON array of curve points.
var curvePoints =
[
    { "horizontal": 0, "vertical": 0 },
    { "horizontal": 75, "vertical": 150 },
    { "horizontal": 175, "vertical": 25, "continuity": false },
    { "horizontal": 255, "vertical": 255 }
];
jamEngine.jsonPlay
(
    "set",
    {
        "target":
        {
            "<reference>":
            [
                { "property": { "<property>": "layerEffects" } },
                { "layer": { "<enumerated>": { "ordinal": "targetEnum" } } }
            ]
        },
        "to":
        {
            "<object>":
            {
                "layerEffects":
                {
                    "scale": { "<unitDouble>": { "percentUnit": 100 } },
                    "chromeFX":
                    {
                        "<object>":
                        {
                            "chromeFX":
                            {
                                "enabled": { "<boolean>": true },
                                "mode": { "<enumerated>": { "blendMode": "normal" } },
                                "color": jamHelpers.toColorObject ([ "HSBColorClass", [ 190, 100, 100 ] ]),
                                "antiAlias": { "<boolean>": true },
                                "invert": { "<boolean>": false },
                                "opacity": { "<unitDouble>": { "percentUnit": 90 } },
                                "localLightingAngle": { "<unitDouble>": { "angleUnit": 45 } },
                                "distance": { "<unitDouble>": { "pixelsUnit": 10 } },
                                "blur": { "<unitDouble>": { "pixelsUnit": 15 } },
                                "mappingShape":
                                {
                                    "<object>":
                                    {
                                        "shapingCurve":
                                        {
                                            "curve": jamHelpers.toCurvePointList (curvePoints)
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
);
Parameters:
{Array} curvePoints
JSON array of curve points, each one being either a JSON object or a JSON array (cf. Curve Point List Simplified Format)
Returns:
{Object|Array} Curve point list in JSON AM Data Format
See:
jamHelpers.fromCurvePointList

<static> {Object|Array} jamHelpers.toCurvesAdjustmentList(curvesAdjustmentsArr)
Get a curves adjustment list in JSON AM Data Format from a JSON array of channel and individual channel curves values.
var curvesAdjustments =
[
    [ "red", [ "curve", [ [ 0, 0 ], [ 77, 51 ], [ 178, 204 ], [ 255, 255 ] ] ] ],
    [ "green", [ "curve", [ [ 0, 255 ], [ 127, 0 ], [ 255, 255 ] ] ] ],
    [ "blue", [ "curve", [ [ 0, 255 ], [ 255, 0 ] ] ] ]
];
jamEngine.jsonPlay
(
    "make",
    {
        "target": { "<reference>": [ { "adjustmentLayer": { "<class>": null } } ] },
        "using":
        {
            "<object>":
            {
                "adjustmentLayer":
                {
                    "name": { "<string>": "Curves" },
                    "opacity": { "<unitDouble>": { "percentUnit": 75 } },
                    "type":
                    {
                        "<object>":
                        {
                            "curves":
                            {
                                "adjustment": jamHelpers.toCurvesAdjustmentList (curvesAdjustments)
                            }
                        }
                    }
                }
            }
        }
    }
);
Parameters:
{Array} curvesAdjustmentsArr
JSON array of channel and individual channel curves values (cf. Curves Adjustment List Simplified Format)
Returns:
{Object|Array} Curves adjustment list in JSON AM Data Format

<static> {Object|Array} jamHelpers.toCustomShapeObject(customShapeArr)
Get a custom shape object in JSON AM Data Format from a JSON array of data (name and bound values) and optional unit ID string.
jamEngine.jsonPlay
(
    "set",
    {
        "target": { "<reference>": [ { "path": { "<property>": "workPath" } } ] },
        "to": jamHelpers.toCustomShapeObject ([ [ "Yin Yang", 20, 20, 80, 80 ], "percentUnit" ])
    }
);
Parameters:
{Array} customShapeArr
JSON array of data: [ name, left, top, right, bottom ], and optional unit ID string ("distanceUnit", "percentUnit", "pixelsUnit", etc.) (cf. Custom Shape Object Simplified Format)
Returns:
{Object|Array} Custom shape object in JSON AM Data Format

<static> {Object|Array} jamHelpers.toEllipseObject(ellipseArr)
Get an ellipse object in JSON AM Data Format from a JSON array of data (bound values) and optional unit ID string.
jamEngine.jsonPlay
(
    "set",
    {
        "target": { "<reference>": [ { "path": { "<property>": "workPath" } } ] },
        "to": jamHelpers.toEllipseObject ([ [ 10, 10, 90, 90 ], "percentUnit" ])
    }
);
Parameters:
{Array} ellipseArr
JSON array of data: [ left, top, right, bottom ], and optional unit ID string ("distanceUnit", "percentUnit", "pixelsUnit", etc.) (cf. Ellipse Object Simplified Format)
Returns:
{Object|Array} Ellipse object in JSON AM Data Format

<static> {Object|Array} jamHelpers.toGradientObject(gradient)
Get a gradient object in JSON AM Data Format from a simplified gradient JSON object or JSON array.
var customStopsGradient =
{
    "gradientForm": "customStops",
    "interpolation": 4096,
    "colors":
    [
        {
            "location": 0, "midpoint": 50, "type": "userStop",
            "color": { "red": 255, "green": 0, "blue": 0 }
        },
        {
            "location": 4096, "midpoint": 50, "type": "userStop",
            "color": { "red": 95, "green": 95, "blue": 0 }
        }
    ],
    "transparency":
    [
        { "location": 0, "midpoint": 50, "opacity": 75 },
        { "location": 4096, "midpoint": 50, "opacity": 100 }
    ]
};
jamEngine.jsonPlay
(
    "gradientClassEvent",
    {
        "from": jamHelpers.toPointObject ([ [ 50.0, 12.5 ], "percentUnit" ]),
        "to": jamHelpers.toPointObject ([ [ 50.0, 75.0 ], "percentUnit" ]),
        "opacity": { "<unitDouble>": { "percentUnit": 50 } },
        "mode": { "<enumerated>": { "blendMode": "hardLight" } },
        "type": { "<enumerated>": { "gradientType": "linear" } },
        "gradient": jamHelpers.toGradientObject (customStopsGradient)
    }
);
var colorNoiseGradient =
[
    "Color Noise",
    "colorNoise",
    345807450,
    false,
    true,
    1024,
    "RGBColor",
    [ 0, 18, 25, 0 ],
    [ 100, 60, 73, 100 ]
];
jamEngine.jsonPlay
(
    "gradientClassEvent",
    {
        "from": jamHelpers.toPointObject ([ [ 12.5, 50.0 ], "percentUnit" ]),
        "to": jamHelpers.toPointObject ([ [ 75.0, 50.0 ], "percentUnit" ]),
        "opacity": { "<unitDouble>": { "percentUnit": 100 } },
        "mode": { "<enumerated>": { "blendMode": "normal" } },
        "type": { "<enumerated>": { "gradientType": "linear" } },
        "gradient": jamHelpers.toGradientObject (colorNoiseGradient)
    }
);
Parameters:
{Object|Array} gradient
Simplified gradient JSON object or JSON array (cf. Gradient Object Simplified Format)
Returns:
{Object|Array} Gradient object in JSON AM Data Format
See:
jamHelpers.fromGradientObject

<static> {Object|Array} jamHelpers.toHueSatAdjustmentV2List(hueSatAdjustmentsArr)
Get a hue/saturation adjustment list in JSON AM Data Format from a JSON array of master and local color ranges.
jamEngine.jsonPlay
(
    "hueSaturation",
    {
        "colorize": { "<boolean>": true },
        "adjustment": jamHelpers.toHueSatAdjustmentV2List ([ [ 210, 30, 10 ] ])
    }
);
var hueSatAdjustments =
[
    [ 20, 0, 0 ],    // Master
    [ 1, 315, 345, 15, 45, 0, 50, 0 ],  // Reds
    [ 3, 75, 105, 135, 165, 0, 60, 0 ]  // Greens
];
jamEngine.jsonPlay
(
    "hueSaturation",
    {
        "adjustment": jamHelpers.toHueSatAdjustmentV2List (hueSatAdjustments)
    }
);
Parameters:
{Array} hueSatAdjustmentsArr
JSON array of master and local color ranges (cf. Hue/Saturation Adjustment List Simplified Format)
Returns:
{Object|Array} Hue/saturation adjustment list in JSON AM Data Format

<static> {Object|Array} jamHelpers.toIntegerList(integersArr)
Get an integer list in JSON AM Data Format from a JSON array of integer values.
var customMatrix =
[
    0,  0,  0,  0,  0,
    0,  1,  1,  1,  0,
    0,  1, -8,  1,  0,
    0,  1,  1,  1,  0,
    0,  0,  0,  0,  0
];
jamEngine.jsonPlay
(
    "custom",
    {
        "scale": { "<integer>": 1 },
        "offset": { "<integer>": 0 },
        "matrix": jamHelpers.toIntegerList (customMatrix)
    }
);
Parameters:
{Array} integersArr
JSON array of integer values (cf. Integer List Simplified Format)
Returns:
{Object|Array} Integer list in JSON AM Data Format
See:
jamHelpers.fromIntegerList

<static> {Object|Array} jamHelpers.toOffsetObject(offsetArr)
Get an offset object in JSON AM Data Format from a JSON array of data (offset values) and optional unit ID string.
jamEngine.jsonPlay
(
    "move",
    {
        "target": { "<reference>": [ { "layer": { "<enumerated>": { "ordinal": "targetEnum" } } } ] },
        "to": jamHelpers.toOffsetObject ([ [ 50, 50 ], "percentUnit" ])
    }
);
Parameters:
{Array} offsetArr
JSON array of data: [ horizontal, vertical ], and optional unit ID string ("distanceUnit", "percentUnit", "pixelsUnit", etc.) (cf. Offset Object Simplified Format)
Returns:
{Object|Array} Offset object in JSON AM Data Format

<static> {Object|Array} jamHelpers.toPathComponentList(pathComponents)
Get a path component list in JSON AM Data Format from either a JSON object or a JSON array (made of two elements: simplified path component values and unit ID string for coordinates).
// Self-intersecting five-pointed star path
var starPath =
{
    "pathComponents":
    [
        {
            "shapeOperation": "add",
            "windingFill": true,
            "subpathListKey":
            [
                {
                    "closedSubpath": true,
                    "points":
                    [
                        { "anchor": { "horizontal": 12.5, "vertical": 41 } },
                        { "anchor": { "horizontal": 87.5, "vertical": 41 } },
                        { "anchor": { "horizontal": 23, "vertical": 85.5 } },
                        { "anchor": { "horizontal": 50, "vertical": 14.5 } },
                        { "anchor": { "horizontal": 77, "vertical": 85.5 } }
                    ]
                }
            ]
        }
    ],
    "unit": "percentUnit"
};
jamEngine.jsonPlay
(
    "set",
    {
        "target": { "<reference>": [ { "path": { "<property>": "workPath" } } ] },
        "to": jamHelpers.toPathComponentList (starPath)
    }
);
jamEngine.jsonPlay
(
    "fill",
    {
        "target": { "<reference>": [ { "path": { "<property>": "workPath" } } ] },
        "wholePath": { "<boolean>": true },
        "using": { "<enumerated>": { "fillContents": "color" } },
        "color": jamHelpers.toColorObject ([ "RGBColor", [ 255, 0, 255 ] ]),  // Magenta
        "opacity": { "<unitDouble>": { "percentUnit": 100 } },
        "mode": { "<enumerated>": { "blendMode": "normal" } },
        "radius": { "<unitDouble>": { "pixelsUnit": 0.0 } },
        "antiAlias": { "<boolean>": true }
    }
);
jamEngine.jsonPlay
(
    "delete",
    {
        "target": { "<reference>": [ { "path": { "<property>": "workPath" } } ] }
    }
);
Parameters:
{Object|Array} pathComponents
JSON object or JSON array made of two elements: simplified path component values and unit ID string for coordinates ("distanceUnit", "percentUnit", "pixelsUnit") (cf. Path Component List Simplified Format)
Returns:
{Object|Array} Path component list in JSON AM Data Format
See:
jamHelpers.fromPathComponentList

<static> {Object|Array} jamHelpers.toPointList(pointsArr)
Get a point list in JSON AM Data Format from a JSON array of data (list of points) and optional unit ID string.
var points = [ [ [ 467, 116 ], [ 482, 335 ], [ 313, 274 ], [ 366, 102 ] ], "pixelsUnit" ];
jamEngine.jsonPlay
(
    "set",
    {
        "target": { "<reference>": [ { "channel": { "<property>": "selection" } } ] },
        "to": { "<object>": { "polygon": { "points": jamHelpers.toPointList (points) } } },
        "feather": { "<unitDouble>": { "pixelsUnit": 5 } },
        "antiAlias": { "<boolean>": true }
    }
);
Parameters:
{Array} pointsArr
JSON array of data (list of points as JSON arrays of 2 numeric coordinates: [ horizontal, vertical ]) and an optional unit ID string ("distanceUnit", "percentUnit", "pixelsUnit", etc.) (cf. Point List Simplified Format)
Returns:
{Object|Array} Point list in JSON AM Data Format
See:
jamHelpers.fromPointList

<static> {Object|Array} jamHelpers.toPointObject(pointArr)
Get a point object in JSON AM Data Format from a JSON array of data (coordinate values) and optional unit ID string.
jamEngine.jsonPlay
(
    "lensFlare",
    {
        "brightness": { "<integer>": 120 },
        "flareCenter": jamHelpers.toPointObject ([ [ 0.75, 0.75 ] ]),
        "lens": { "<enumerated>": { "lens": "zoom" } }
    }
);
Parameters:
{Array} pointArr
JSON array of data: [ horizontal, vertical ], and optional unit ID string ("distanceUnit", "percentUnit", "pixelsUnit", etc.) (cf. Point Object Simplified Format)
Returns:
{Object|Array} Point object in JSON AM Data Format

<static> {Object|Array} jamHelpers.toRationalPointList(rationalPointsArr)
Get a rational point list in JSON AM Data Format from a JSON array of a list of rational points and optional unit ID string.
var bounds = [ [ 0, 0, 100, 100 ], "percentUnit" ];
var meshPoints =
[
    [
        [ 0, 0 ], [ 50, 0 ], [ 50, 0 ], [ 100, 0 ],
        [ 0, 50 ], [ 100 / 3, 100 / 3 ], [ 200 / 3, 100 / 3 ], [ 100, 50 ],
        [ 0, 50 ], [ 100 / 3, 200 / 3 ], [ 200 / 3, 200 / 3 ], [ 100, 50 ],
        [ 0, 100 ], [ 50, 100 ], [ 50, 100 ], [ 100, 100 ]
    ],
    "percentUnit"
];
jamEngine.jsonPlay
(
    "transform",
    {
        "target": { "<reference>": [ { "layer": { "<enumerated>": { "ordinal": "targetEnum" } } } ] },
        "freeTransformCenterState": { "<enumerated>": { "quadCenterState": "QCSAverage" } },
        "warp":
        {
            "<object>":
            {
                "warp":
                {
                    "warpStyle": { "<enumerated>": { "warpStyle": "warpCustom" } },
                    "bounds": jamHelpers.toRectangleObject (bounds),
                    "uOrder": { "<integer>": 4 },
                    "vOrder": { "<integer>": 4 },
                    "customEnvelopeWarp":
                    {
                        "<object>":
                        {
                            "customEnvelopeWarp":
                            {
                                "meshPoints": jamHelpers.toRationalPointList (meshPoints)
                            }
                        }
                    }
                }
            }
        }
    }
);
Parameters:
{Array} rationalPointsArr
JSON array of a list of rational points (as JSON arrays of 2 numeric coordinates: [ horizontal, vertical ]) and an optional unit ID string ("distanceUnit", "percentUnit", "pixelsUnit", etc.) (cf. Rational Point List Simplified Format)
Returns:
{Object|Array} Rational point list in JSON AM Data Format

<static> {Object|Array} jamHelpers.toRectangleObject(rectangleArr)
Get a rectangle object in JSON AM Data Format from a JSON array of data (bound values and optional radius) and optional unit ID string.
// Plain rectangle
jamEngine.jsonPlay
(
    "set",
    {
        "target": { "<reference>": [ { "channel": { "<property>": "selection" } } ] },
        "to": jamHelpers.toRectangleObject ([ [ 10, 10, 90, 90 ], "percentUnit" ])
    }
);
// Rounded rectangle
jamEngine.jsonPlay
(
    "set",
    {
        "target": { "<reference>": [ { "path": { "<property>": "workPath" } } ] },
        "to": jamHelpers.toRectangleObject ([ [ 10, 10, 90, 90, 10 ], "percentUnit" ])
    }
);
Parameters:
{Array} rectangleArr
JSON array of data: [ left, top, right, bottom ] for plain rectangles or [ left, top, right, bottom, radius ] for rounded rectangles, and optional unit ID string ("distanceUnit", "percentUnit", "pixelsUnit", etc.) (cf. Rectangle Object Simplified Format)
Returns:
{Object|Array} Rectangle object in JSON AM Data Format

Documentation generated by JsDoc Toolkit 2.4.0 on Wed Oct 12 2016 23:32:44 GMT+0200 (CEST)