Graphics Utility Suites¶
After Effects exposes its internal transform and graphic utility routines through the following function suites.
Transform Worlds¶
These functions combine PF_EffectWorlds
in interesting ways. When you use these, you're using the same code After Effects does internally.
PF_WorldTransformSuite1¶
Function |
Purpose |
---|---|
|
Composite a rectangle from one
|
|
Blends two images, alpha-weighted. Does not deal with different-sized sources, though the destination may be either
|
|
Convolve an image with an arbitrary size kernel on each of the a, r, g, and b channels separately. You can specify a rectangle to convolve (for instance, the Do not use if the source is the destination. Describe the convolution using Kernel Flags.
|
|
Copies a region from one
|
|
A higher fidelity version of the above (using the same parameters). |
|
Blends using a transfer mode, with an optional mask.
|
|
Given a The matrices pointer points to a matrix array used for motion-blur. When is a transform not a transform? A Z-scale transform is not a transform, unless the transformed layer is a parent of other layers that do not all lie in the z=0 plane.
|
Kernel Flags¶
Functions such as convolve
or gaussian kernel work with kernels, or matrices of filter weight values. These matrices can be in any format. The kernel flags describe how the matrices should be created and used. OR together any flags you need.
The flags relevant to given routines are documented along with the routine prototype.The first entry in the left column is always the default and has value 0.
Kernel Flags |
Indicates |
---|---|
|
Specifies a one or two dimensional kernel. |
|
|
|
|
|
|
|
Specifies the direction of the convolution. |
|
Use Use
|
|
Use Use |
Fill 'Em Up!¶
The FillMatteSuite can be used to fill a PF_EffectWorld
, either with a specific color or premultiplied with an alpha value.
PF_FillMatteSuite2¶
Function |
Purpose |
---|---|
|
Fills a rect with a color (or, if the color pointer is null, fills with black and alpha zero). If the rect is null, it fills the entire image.
|
|
Same as fill, but takes a pointer to a |
|
Takes a pointer to a |
|
Converts to (and from) r, g, and b color values pre-multiplied with black to represent the alpha channel. Quality independent.
|
|
Converts to (and from) having r, g, and b color values premultiplied with any color to represent the alpha channel.
|
|
Same as above, but takes a pointer to a |
|
Takes a pointer to a |
Sampling Images¶
Note: areas outside the bounds of the image being sampled are treated as zero alpha. For convenience, the functions from PF_Sampling8Suite1
, PF_Sampling16Suite1
, and PF_SamplingFloatSuite1
are all listed in this table.
PF_SamplingSuite Functions (Multiple Suites)¶
Function |
Purpose |
---|---|
|
Performs nearest neighbor sampling.
|
|
Same as above, but takes a pointer to a |
|
Takes a pointer to a |
|
Queries the appropriate alpha-weighted interpolation of colors at a non-integral point in a source image, in high quality. Nearest neighbor sampling is used in low quality. Because the sampling routine, if used, will typically be called many times, it is convenient to copy the function pointer out to the callbacks structure and into a register or onto the stack to speed up your inner loop. See the sample code for an example. Note The sampling assumes that 0,0 is the center of the top left pixel.
|
|
Same as above, but takes a pointer to a |
|
Takes a pointer to a |
|
Use this to calculate the appropriate alpha weighted average of an axis-aligned non-integral rectangle of color in a source image, in high quality. Nearest neighbor sampling is used in low quality. Because of overflow issues, this can only average a maximum of a 256 x 256 pixel area (i.e. x and y radius < 128 pixels). Note The sampling radius must be at least one in both x and y.
Note Areas outside the boundaries of the layer are considered the same as zero alpha, for sampling purposes. |
|
Same as above, but takes a |
PF_BatchSamplingSuite1 Functions¶
Function |
Purpose |
---|---|
|
Your effect is going to perform some batch sampling; After Effects will perform setup tasks to optimize your sampling.
|
|
Tells After Effects you're done sampling.
|
|
Obtains a pointer to After Effects' batch sampling function (highly optimized).
|
|
Obtains a pointer to After Effects' 16-bpc batch sampling function (also highly optimized).
|
Do The Math For Me¶
Along with the variety of graphics utilities, we also provide a block of ANSI standard routines so that plug-ins will not need to include other libraries to use standard functions.
We give function pointers to a large number of math functions (trig functions, square root, logs, etc.).
Using our suite functions provides for some (application level) error handling, and prevents problems with including different versions of multiple "standard" libraries.
All functions return a double. All angles are expressed in radians, use PF_RAD_PER_DEGREE
(a constant from AE_EffectCB.h) to convert from degrees to radians if necessary.
PF_ANSICallbackSuite1¶
Function | Purpose | Replaces |
---|---|---|
acos |
Returns the arc cosine of x. | PF_ACOS |
asin |
Returns the arc sine of x. | PF_ASIN |
atan |
Returns the arc tangent of x. | PF_ATAN |
atan2 |
Returns atan(y/x). | PF_ATAN2 |
ceil |
Returns the next integer above x. | PF_CEIL |
cos |
Returns the cosine of x. | PF_COS |
exp |
Returns e to the power of x. | PF_EXP |
fabs |
Returns the absolute value of x. | PF_FABS |
floor |
Returns the closest integer below x. | PF_FLOOR |
fmod |
Returns x modulus y. | PF_FMOD |
hypot |
Returns the hypotenuse of x and y, which is sqrt(x*x + y*y). | PF_HYPOT |
log |
Returns the natural log (ln) of x. | PF_LOG |
log10 |
Returns the log (base 10) of x. | PF_LOG10 |
pow |
Returns x to the power of y. | PF_POW |
sin |
Returns the sine of x. | PF_SIN |
sqrt |
Returns the square root of x. | PF_SQRT |
tan |
Returns the tangent of x. | PF_TAN |
(while not strictly math functions, these emulate ANSI functionality) | ||
sprintf |
Emulates the C sprintf function. | PF_SPRINTF |
strcpy |
Emulates the C strcpy function. | PF_STRCPY |