public drawObject(drawObjectMode _drawMode = drawObjectMode.brush) { drawMode = _drawMode; if (_drawMode == drawObjectMode.erase) { var material = new CanvasItemMaterial(); material.BlendMode = CanvasItemMaterial.BlendModeEnum.Sub; Material = material; } }
public void setBrush(drawObjectMode _mode, Color color, float scale = 1) { if (_mode == drawObjectMode.brush) { var rnd = new Random(); var chalkImage = brushTextureResources[rnd.Next(0, brushTextureResources.Count)].GetData(); chalkImage.Resize((int)(chalkImage.GetSize().x *scale), (int)(chalkImage.GetSize().y *scale)); var chalkTexture = new ImageTexture(); chalkTexture.CreateFromImage(chalkImage); drawTexture = chalkTexture; } else if (_mode == drawObjectMode.erase) { var eraseImage = eraseTextureResource.GetData(); eraseImage.Resize((int)(eraseImage.GetSize().x *scale), (int)(eraseImage.GetSize().y *scale)); var eraseTexture = new ImageTexture(); eraseTexture.CreateFromImage(eraseImage); drawTexture = eraseTexture; } }