ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Core.Geometry Namespace / BasicMaterial Class / TextureResource Property

In This Topic
    TextureResource Property
    In This Topic
    A TextureResource that contains Texture.
    public TextureResource TextureResource {get; set;}
    Public Property TextureResource As TextureResource
    Can be null, when this material does not contain a texture. Different material instances can share the same TextureResource.
    Create BasicMaterial with JPEG texture
    // read the jpeg into a buffer
    //At 3.0 you need
    System.Drawing.Image image = System.Drawing.Image.FromFile(@"C:\temp\myImageFile.jpg");
    MemoryStream memoryStream = new MemoryStream();
    System.Drawing.Imaging.ImageFormat format = System.Drawing.Imaging.ImageFormat.Jpeg;
    image.Save(memoryStream, format);
    byte[] imageBuffer = memoryStream.ToArray();
    var jpgTexture = new JPEGTexture(imageBuffer);
    // texture properties
    int bpp = jpgTexture.BytesPerPixel;
    int columnCount = jpgTexture.ColumnCount;
    int rowCount = jpgTexture.RowCount;
    // build the textureResource and the material
    BasicMaterial material = new BasicMaterial();
    material.TextureResource = new TextureResource(jpgTexture);
    Create BasicMaterial with Uncompressed texture
    UncompressedTexture uncompressedTexture1 = new UncompressedTexture(new byte[10 * 12 * 3], 10, 12, 3);
    // texture properties
    int bpp = uncompressedTexture1.BytesPerPixel;
    int columnCount = uncompressedTexture1.ColumnCount;
    int rowCount = uncompressedTexture1.RowCount;
    // build the textureResource and the material
    TextureResource tr = new TextureResource(uncompressedTexture1);
    BasicMaterial material = new BasicMaterial();
    material.TextureResource = tr;

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also