Eyeon:Script/Reference/Applications/Fuse/Classes/Image/Transform
From VFXPedia
< Eyeon:Script | Reference | Applications | Fuse | Classes | Image
Contents |
Summary
The Transform method can be used to change the scale, angle and position of an image. The results of the transform will be copied into the image provided as the first argument. If the first argument is set to nil, the method will return a new Image object containing the results.
Usage
image = Image:Transform(image dest_image, table taglist)
- dest_image (image, required)
- The image to write the transform results into. May be nil, in which case an image is created.
- taglist (table, required)
- The taglist argument is a table containing entries which describe the image transformation.
XF_Angle The angle of the transformed image in degrees. XF_XAxis The x co-ordinate for the transformations axis (or pivot). XF_YAxis The y co-ordinate for the transformations axis (or pivot). XF_EdgeMode An string which describes which technique to use to handle edges of the image. Valid options are "Black", "Wrap", or "Duplicate". XF_XOffset The x co-ordinate for the transformations center. XF_YOffset The y co-ordinate for the transformations center. XF_XSize The scale of the transformed image along the x axis. XF_YSize The scale of the transformed image along the y axis.
Return
The results of the transformation are returned as an Image object, or nil if the operation failed. If dest_image was provided, that will be returned.
Example
The following example is the process() event from the FuseTransform.Fuse example at Example Fuses
edge_modes = {"Black", "Wrap", "Duplicate"} function Process(req) local img = InImage:GetValue(req) local center = InCenter:GetValue(req) local pivot = InPivot:GetValue(req) local sizex = InSizeX:GetValue(req).Value local sizey = InSizeY:GetValue(req).Value local angle = InAngle:GetValue(req).Value local edges = InEdges:GetValue(req).Value if locked then sizey = sizex end out = img:Transform(nil, { XF_XOffset = center.X, XF_YOffset = center.Y, XF_XAxis = pivot.X, XF_YAxis = pivot.Y, XF_XSize = sizex, XF_YSize = sizey, XF_Angle = angle, XF_EdgeMode = edge_modes[edges+1], }) OutImage:Set(req, out) end
Tips for Transform (edit)
- The defaults for XF_XOffset and XF_YOffset are zero, so if you don't want to do translation you still need to specify 0.5 for each one if you don't want your image to end up in the bottom left corner.