SoCoResource Class
Class SoCoResource. This resource contains information about Color Fill Layers
Inheritance Hierarchy
SystemObject
  Aspose.PSD.FileFormats.Psd.LayersLayerResource
    Aspose.PSD.FileFormats.Psd.Layers.LayerResourcesFillLayerResource
      Aspose.PSD.FileFormats.Psd.Layers.LayerResourcesSoCoResource

Namespace: Aspose.PSD.FileFormats.Psd.Layers.LayerResources
Assembly: Aspose.PSD (in Aspose.PSD.dll) Version: 21.12
Syntax
public class SoCoResource : FillLayerResource

The SoCoResource type exposes the following members.

Constructors
  NameDescription
Public methodSoCoResource
Initializes a new instance of the SoCoResource class.
Properties
  NameDescription
Public propertyCode exampleColor
Gets the RGB color .
Public propertyKey
Gets the layer resource key.
(Overrides LayerResourceKey.)
Public propertyLength
Gets the layer resource length in bytes.
(Overrides LayerResourceLength.)
Public propertyPsdVersion
Gets the minimal psd version required for layer resource. 0 indicates no restrictions.
(Overrides LayerResourcePsdVersion.)
Public propertySignature
Gets the layer resource signature.
(Overrides FillLayerResourceSignature.)
Methods
  NameDescription
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodSave
Saves the resource to the specified stream container.
(Overrides LayerResourceSave(StreamContainer, Int32).)
Protected methodSaveResourceHeader
Saves the resource header.
(Inherited from LayerResource.)
Public methodToString
Returns a String that represents this instance.
(Inherited from LayerResource.)
Fields
  NameDescription
Public fieldStatic memberTypeToolKey
The type tool info key.
Examples
The following example demonstrates how you edit SoCoResource (Layer Resource for Color Fill Layer)
[C#]

string sourceFile = "ColorFillLayer.psd";
string outputFile = "SoCoResource_Edited.psd";

// Load an existing image into an instance of PsdImage class
var im = (PsdImage)Image.Load(sourceFile);

using (im)
{
    foreach (var layer in im.Layers)
    {
        // Finding of FillLayer
        if (layer is FillLayer)
        {
            var fillLayer = (FillLayer)layer;
            foreach (var resource in fillLayer.Resources)
            {
                // Finding of SoCoResource in Layer Resource List
                if (resource is SoCoResource)
                {
                    var socoResource = (SoCoResource)resource;
                    var expectedColor = Color.FromArgb(63, 83, 141);

                    if ((expectedColor.R != socoResource.Color.R) ||
                        (expectedColor.G != socoResource.Color.G) ||
                        (expectedColor.B != socoResource.Color.B) ||
                        (expectedColor.A != socoResource.Color.A))
                    {
                        throw new Exception("Unexpected color");
                    }

                    // Setting the SoCoResource Color property
                    socoResource.Color = Color.Red;
                    break;
                }
            }
            break;
        }
        im.Save(outputFile);
    }
}
See Also