private void SetBodyTextureSolidColor(Asset asset) { ColorAsset colorAsset = (ColorAsset)asset; SolidColorPixelSource pixelSource = new SolidColorPixelSource(1024, 1024, colorAsset.Color); mBodyTexture.SetLayerSource(asset.Type, pixelSource); }
public void ClearLayer(string layerName) { // Check if a layer exists if (HasLayer(layerName)) { // Get relevant layer PixelSourceLayer layer = GetLayer(layerName); // Mark the layer as dirty MarkAsDirty(layer); if (layer.PixelBlendMode == Pixel.PixelBlendMode.Multiply) { layer.PixelSource = new SolidColorPixelSource(mWidth, mHeight, Color.white); } else { layer.PixelSource = SolidColorPixelSource.Clear(mWidth, mHeight); } } else { Console.LogError("LayeredTexture ClearLayer: Layer with name " + layerName + " does not exist in this Complex Texture"); } }
/* * Add an empty layer to a zone */ public void CreateLayerInZone(string layerName, string zoneName, Pixel.PixelBlendMode blendMode) { if (!HasZone(zoneName)) { Console.LogError("LayeredPalette AddLayer(): Zone " + zoneName + " does not exist"); } else { TextureZone zone = GetZone(zoneName); SolidColorPixelSource newPixelSource = SolidColorPixelSource.Clear((int)zone.Area.width, (int)zone.Area.height); PixelSourceLayer newLayer = new PixelSourceLayer(this, newPixelSource, blendMode, (int)zone.Area.x, (int)zone.Area.y); CreateLayerInZone(layerName, zoneName, newLayer); } }