PsdProcessor.FrameCallback Property

Applies to: Graphics Mill 12.1, 6.x-12.x (may differ)

Gets or sets the callback function that processes image layers. The function should accept an alias for the calling object and a PsdFrame and return a GraphicsContainer. It is convenient to use lambda expressions as demonstrated below.

Namespace: Aurigma.GraphicsMill.Templates
Assembly: Aurigma.GraphicsMill.Templates (in Aurigma.GraphicsMill.Templates.dll)

Syntax

C#
public Func<PsdProcessor, PsdFrame, GraphicsContainer> FrameCallback { get; set; }

Examples

C#
var psdProcessor = new PsdProcessor();

psdProcessor.FrameCallback = (processor, frame) =>
{
    if (frame.Type != FrameType.Raster)
        return processor.ProcessFrame(frame);

    using (var invert = new Invert())
    {
        var graphicsContainer = new GraphicsContainer(frame.X + frame.Width, frame.Y + frame.Height, frame.DpiX, frame.DpiY);

        using (var graphics = graphicsContainer.GetGraphics())
        {
            graphics.DrawImage(frame + invert, frame.X, frame.Y);
        }

        return graphicsContainer;
    }
};

psdProcessor.Render(@"Images\BusinessCard.psd", @"Images\Output\InvertBackground.pdf");

See Also

Reference