ClassID.ClassID

ClassID(byte[])

Initializes a new instance of the ClassID class.

public ClassID(byte[] classID)
ParameterTypeDescription
classIDByte[]The class ID as series of bytes.

See Also


ClassID(byte[], bool)

Initializes a new instance of the ClassID class.

public ClassID(byte[] classID, bool isZeroLength)
ParameterTypeDescription
classIDByte[]The class ID as series of bytes.
isZeroLengthBooleanif set to true [is zero length]. The recorded string length is zero but actual is four.

Exceptions

exceptioncondition
ArgumentNullExceptionclassID is null.

See Also


ClassID(int)

Initializes a new instance of the ClassID class.

public ClassID(int classID)
ParameterTypeDescription
classIDInt32The class ID.

See Also


ClassID(uint)

Initializes a new instance of the ClassID class.

public ClassID(uint classID)
ParameterTypeDescription
classIDUInt32The class ID.

See Also


ClassID(string, bool)

Initializes a new instance of the ClassID class.

public ClassID(string classID, bool isZeroLength)
ParameterTypeDescription
classIDStringThe class ID in ASCII encoding.
isZeroLengthBooleanif set to true [is zero length].

Examples

This example demonstrates that that the layer, imported from an image, is converted to smart object layer and the saved PSD file is correct.

[C#]

// Tests that the layer, imported from an image, is converted to smart object layer and the saved PSD file is correct.

string outputFilePath = outputFolder + Path.DirectorySeparatorChar + "layerTest2.psd";
string outputPngFilePath = Path.ChangeExtension(outputFilePath, ".png");
using (PsdImage image = (PsdImage)Image.Load(baseFolder + Path.DirectorySeparatorChar + "layerTest1.psd"))
{
    string layerFilePath = baseFolder + Path.DirectorySeparatorChar + "picture.jpg";
    using (var stream = new FileStream(layerFilePath, FileMode.Open))
    {
        Layer layer = null;
        try
        {
            layer = new Layer(stream);
            image.AddLayer(layer);
        }
        catch (Exception)
        {
            if (layer != null)
            {
                layer.Dispose();
            }

            throw;
        }

        var layer2 = image.Layers[2];
        var layer3 = image.SmartObjectProvider.ConvertToSmartObject(image.Layers.Length - 1);
        var bounds = layer3.Bounds;
        layer3.Left = (image.Width - layer3.Width) / 2;
        layer3.Top = layer2.Top;
        layer3.Right = layer3.Left + bounds.Width;
        layer3.Bottom = layer3.Top + bounds.Height;

        image.Save(outputFilePath);
        image.Save(outputPngFilePath, new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha });
    }
}

See Also


ClassID(string)

Initializes a new instance of the ClassID class.

public ClassID(string classID)
ParameterTypeDescription
classIDStringThe class ID in ASCII encoding.

See Also