Combiner Class

Combines two images using the specified mode.

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

Syntax

C#
public sealed class Combiner : MaskTransform

Remarks

Images can be combined in the different way: just copying pixels from one image to another, alpha blending, bitwise operations, etc. You can adjust it with Mode property.

Examples

The following code creates a collage from the two photos, given mask and background images:

C#
using (var photo1 = new Bitmap(@"Images\monkey.jpg"))
using (var photo2 = new Bitmap(@"Images\dog.jpg"))
using (var background = new Bitmap(@"Images\CollageBackground.jpg"))
using (var mask = new Bitmap(@"Images\CollageMask.jpg"))
{
    //Resulting collage.
    var collage = new Bitmap();

    //Coordinates of placeholders.
    var point1 = new System.Drawing.Point(130, 165);
    var point2 = new System.Drawing.Point(460, 200);

    //Create the transform.
    var combiner = new Combiner(CombineMode.Copy);

    //Combine with the first image.
    combiner.TopImage = photo1;
    combiner.X = point1.X - photo1.Width / 2;
    combiner.Y = point1.Y - photo1.Height / 2;
    collage = combiner.ApplyMaskTransform(background, mask);

    //Combine with the second image.
    combiner.TopImage = photo2;
    combiner.X = point2.X - photo2.Width / 2;
    combiner.Y = point2.Y - photo2.Height / 2;
    collage = combiner.ApplyMaskTransform(collage, mask);

    collage.Save(@"Images\Output\collage.jpg");

    collage.Dispose();
}

Inheritance Hierarchy

Thread Safety

Static members of this type are not safe for multi-threaded operations. Instance members of this type are not safe for multi-threaded operations.

See Also

Reference

Manual