Eyeon:Script/Reference/Applications/Fuse/Classes/Image/Transform

From VFXPedia

< Eyeon:Script | Reference | Applications | Fuse | Classes | Image
Revision as of 06:40, 13 December 2010 by Daniel (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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_AngleThe angle of the transformed image in degrees.
XF_XAxisThe x co-ordinate for the transformations axis (or pivot).
XF_YAxisThe y co-ordinate for the transformations axis (or pivot).
XF_EdgeModeAn string which describes which technique to use to handle edges of the image. Valid options are "Black", "Wrap", or "Duplicate".
XF_XOffsetThe x co-ordinate for the transformations center.
XF_YOffsetThe y co-ordinate for the transformations center.
XF_XSizeThe scale of the transformed image along the x axis.
XF_YSizeThe 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.