Eyeon:Script/Reference/Applications/Fuse/ViewShader/Events/ApplyToImage

From VFXPedia

< Eyeon:Script | Reference | Applications | Fuse
Revision as of 08:16, 4 November 2009 by Daniel (Talk | contribs)
(diff) ← Older revision | Current revision (diff) | Newer revision → (diff)
Jump to: navigation, search

ViewShader Reference Manual > ApplyToImage

Event Function


Contents


Summary

The ApplyToImage event function is executed any time a control is changed in a ViewShader, or whenever a new image is to be displayed and LUTs are enabled. Similar in concept to ScriptOperator's Process() event function, its job is to apply the user's desired effect to a source image, and return the result.

Like Process(), it is given a Request object containing all the Parameters needed to apply the user's desired effect. Inputs are used to extract the Parameters and their values. A new Image must be created and processed accordingly, then returned.

Implementing ApplyToImage() is optional, but is required if LUTs are to be performed in software, using the CPU, not with the GPU. If LUTs can be applied by the GPU, ApplyToImage() is not called.

Usage

ApplyToImage(object request, object sourceimage)

Arguments

request (Request object)

This contains Parameters from all the ScriptViewShader's controls

sourceimage (Image object)

The source image to be used

Returns

A new Image should be created and returned, containing the pixels processed from the source image.

Examples

function ApplyToImage(req, srcimg)
    local gamma = InGamma:GetValue(req).Value
 
    if gamma ~= 0.0 then
        gamma = 1.0 / gamma
    else
        gamma = 1000000
    end
 
    local outimage = srcimg:CopyOf()
    if outimage then
        outimage:Gamma(gamma, gamma, gamma, 1.0)
    end
 
    return outimage
end

See Also