void DoPaint(int x, int y, int z, byte color, PaintMode mode, Edit.Brush brush, int size) { for (int px = x - (size - 1); px <= x + (size - 1); px++) { for (int py = y - (size - 1); py <= y + (size - 1); py++) { for (int pz = z - (size - 1); pz <= z + (size - 1); pz++) { if (IsOutOfBounds(px, py, pz)) { continue; } if (mode == PaintMode.Filled && IsEmpty(px, py, pz)) { continue; } if (mode == PaintMode.Empty && !IsEmpty(px, py, pz)) { continue; } if (brush == Edit.Brush.Diamond && Mathf.Abs(px - x) + Mathf.Abs(py - y) + Mathf.Abs(pz - z) >= size) { continue; } if (brush == Edit.Brush.Sphere && Vector3.Distance(new Vector3(x, y, z), new Vector3(px, py, pz)) > size) { continue; } PreviewChunk.use.chunk.SetPaletteIndexAt(px, py, pz, color); edits[ToIndex(px, py, pz)] = color; } } } }
public override void Draw(Node node, PaintMode printMode, Color color) { if ((printMode == PaintMode.BACKGROUND)) { base.painter_.FillRectangle(node); } }
public void SetPixel(int x, int y, PaintMode?mode = null, bool?erase = null) { Tile curTile = CurrentWorld.Tiles[x, y]; PaintMode curMode = mode ?? TilePicker.PaintMode; bool isErase = erase ?? TilePicker.IsEraser; switch (curMode) { case PaintMode.Tile: SetTile(curTile, isErase); break; case PaintMode.Wall: SetWall(curTile, isErase); break; case PaintMode.TileAndWall: SetTile(curTile, isErase); SetWall(curTile, isErase); break; case PaintMode.Wire: SetPixelAutomatic(curTile, wire: !isErase); break; case PaintMode.Liquid: SetPixelAutomatic(curTile, liquid: isErase ? (byte)0 : (byte)255, isLava: TilePicker.IsLava); break; } Color curBgColor = GetBackgroundColor(y); PixelMap.SetPixelColor(x, y, Render.PixelMap.GetTileColor(CurrentWorld.Tiles[x, y], curBgColor, _showWalls, _showTiles, _showLiquid, _showWires)); }
void DoBoxFill(int sx, int sy, int sz, int dx, int dy, int dz, byte color, PaintMode mode) { for (int px = Mathf.Min(sx, dx); px <= Mathf.Max(sx, dx); px++) { for (int py = Mathf.Min(sy, dy); py <= Mathf.Max(sy, dy); py++) { for (int pz = Mathf.Min(sz, dz); pz <= Mathf.Max(sz, dz); pz++) { if (IsOutOfBounds(px, py, pz)) { continue; } if (mode == PaintMode.Filled && IsEmpty(px, py, pz)) { continue; } if (mode == PaintMode.Empty && !IsEmpty(px, py, pz)) { continue; } PreviewChunk.use.chunk.SetPaletteIndexAt(px, py, pz, color); edits[ToIndex(px, py, pz)] = color; } } } }
internal override void CopyPropertiesFrom(LW_Element element) { LW_PaintStyle style = element as LW_PaintStyle; if (style != null) { m_Material = style.m_Material; m_MainTexture = style.m_MainTexture; m_PaintMode = style.m_PaintMode; m_UvMode = style.m_UvMode; m_UvTiling = style.m_UvTiling; m_UvOffset = style.m_UvOffset; if (style.m_GradientColors != null) { m_GradientColors = new List <LW_ColorStop>(style.m_GradientColors); } else { m_GradientColors = null; } m_GradientPosition = style.m_GradientPosition; m_GradientRotation = style.m_GradientRotation; m_GradientScale = style.m_GradientScale; m_GradientSpreadMethod = style.m_GradientSpreadMethod; m_GradientUnits = style.m_GradientUnits; m_GradientStart = style.m_GradientStart; m_GradientEnd = style.m_GradientEnd; m_Opacity = style.m_Opacity; } base.CopyPropertiesFrom(element); }
void DoFloodFill(int x, int y, int z, byte color, PaintMode mode) { if (IsOutOfBounds(x, y, z)) { return; } byte c = GetChunk().GetPaletteIndexAt(x, y, z); Queue <int> open = new Queue <int>(); HashSet <int> closed = new HashSet <int>(); open.Enqueue(ToIndex(x, y, z)); closed.Add(ToIndex(x, y, z)); while (open.Count > 0) { int index = open.Dequeue(); int px, py, pz; FromIndex(index, out px, out py, out pz); PreviewChunk.use.chunk.SetPaletteIndexAt(px, py, pz, color); edits[index] = color; foreach (int n in GetFillNeighbors(px, py, pz, c)) { if (!closed.Contains(n)) { open.Enqueue(n); closed.Add(n); } } } }
public override void Draw(Node node, PaintMode printMode, Color color) { if (((printMode != PaintMode.BACKGROUND)) && ((printMode == PaintMode.FOREGROUND))) { if ((node.isVisible && (node.literalText != null)) && (node.literalText.Length > 0)) { if (node.parent_ != null) { bool notInBrackets = true; try { if ((node.parent_.type_.type == ElementType.Mo) && ((Box_Mo)node.parent_.box).isBracketed) { notInBrackets = false; } } catch { } if (notInBrackets) { base.painter_.DrawString(node, node.parent_.style_, color); } } else { base.painter_.DrawString(node, null, color); } } } }
public override void Draw(Node node, PaintMode printMode, Color color) { if (((printMode != PaintMode.BACKGROUND)) && ((printMode == PaintMode.FOREGROUND))) { if ((node.isVisible && (node.literalText != null)) && (node.literalText.Length > 0)) { if (node.parent_ != null) { bool notInBrackets = true; try { if ((node.parent_.type_.type == ElementType.Mo) && ((Box_Mo) node.parent_.box).isBracketed) { notInBrackets = false; } } catch { } if (notInBrackets) { base.painter_.DrawString(node, node.parent_.style_, color); } } else { base.painter_.DrawString(node, null, color); } } } }
public override void Draw(Node node, PaintMode printMode, Color color) { if ((printMode == PaintMode.BACKGROUND)) { base.painter_.FillRectangle(node); } else if ((printMode == PaintMode.FOREGROUND)) { try { if (node.NotBlack()) { color = node.style_.color; } } catch { } if ((this.attrs != null) && this.isBevelled) { for (int i = 0; i < this.thick; i++) { base.painter_.DrawLine((((base.rect.x + this.beveledFirstWidth) + this.lineThick) + i) + (this.width / 4), (base.rect.y + base.rect.height) - (3 * this.lineThick), (((((base.rect.x + base.rect.width) - this.beveledWidth) - this.lineThick) - this.thick) + i) - (this.width / 4), base.rect.y + (3 * this.lineThick), 1, color); } } else { base.painter_.DrawLine(base.rect.x + (this.width / 4), base.rect.y + this.totalH, (base.rect.x + base.rect.width) - (this.width / 4), base.rect.y + this.totalH, this.thick, color); } } }
public override void Draw(Node node, PaintMode printMode, Color color) { if (((printMode == PaintMode.FOREGROUND)) && ((node.firstChild == null))) { base.painter_.OutlineRect(node); } }
public override void Draw(Node node, PaintMode printMode, Color color) { if ((printMode == PaintMode.BACKGROUND)) { base.painter_.FillRectangle(node); } else if ((printMode == PaintMode.FOREGROUND)) { if (this.leftQuote.Length > 0) { base.painter_.DrawQuote(node, node.box.X, node.box.Y, this.leftQuote, node.scriptLevel_, node.style_, color); } if ((node.isVisible && (node.literalText != null)) && (node.literalText.Length > 0)) { if (node.NotBlack()) { color = node.style_.color; } int px = node.box.X; node.box.X = node.box.X + this.leftQuoteWidth; try { base.painter_.DrawString(node, node.style_, color); } catch { } node.box.X = px; } if (this.rightQuote.Length > 0) { base.painter_.DrawQuote(node, (node.box.X + node.box.Width) - this.rightQuoteWidth, node.box.Y, this.rightQuote, node.scriptLevel_, node.style_, color); } } }
private void cbPaintModes_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (CbPaintModes.SelectedItem != null) { _currentPaintMode = _paintModeDict[((ComboBoxItem)CbPaintModes.SelectedItem).Content.ToString()]; } }
public void SetPixel(int x, int y, PaintMode? mode = null, bool? erase = null) { Tile curTile = CurrentWorld.Tiles[x, y]; PaintMode curMode = mode ?? TilePicker.PaintMode; bool isErase = erase ?? TilePicker.IsEraser; switch (curMode) { case PaintMode.Tile: SetTile(curTile, isErase); break; case PaintMode.Wall: SetWall(curTile, isErase); break; case PaintMode.TileAndWall: SetTile(curTile, isErase); SetWall(curTile, isErase); break; case PaintMode.Wire: SetPixelAutomatic(curTile, wire: !isErase); break; case PaintMode.Wire2: SetPixelAutomatic(curTile, wire2: !isErase); break; case PaintMode.Wire3: SetPixelAutomatic(curTile, wire3: !isErase); break; case PaintMode.Liquid: SetPixelAutomatic(curTile, liquid: isErase ? (byte)0 : (byte)255, isLava: TilePicker.IsLava); break; } Color curBgColor = GetBackgroundColor(y); PixelMap.SetPixelColor(x, y, Render.PixelMap.GetTileColor(CurrentWorld.Tiles[x, y], curBgColor, _showWalls, _showTiles, _showLiquid, _showWires)); }
public override void Draw(Node node, PaintMode printMode, Color color) { if (((printMode == PaintMode.FOREGROUND)) && (node.firstChild == null)) { base.painter_.OutlineRect(node); } }
private void EyedropperInput(MapTileGridCreator.Core.Cell selectedCell) { if (Event.current.type == EventType.Layout) { HandleUtility.AddDefaultControl(0); // Consume the event } //Select prefab from pallett and got to paint if (Event.current.type == EventType.MouseDown && Event.current.button == 0) { GameObject prefabInstance = selectedCell.gameObject; GameObject prefab = FuncEditor.GetPrefabFromInstance(prefabInstance); int newIndex = _pallet.FindIndex(x => x.Equals(prefab)); if (newIndex >= 0) { _mode_paint = (int)PaintMode.Single; _pallet_index = newIndex; Debug.Log("Prefab " + prefab.name + " selected."); } else { Debug.LogError("Prefab is not from the pallet"); } } //Cancel else if (Event.current.type == EventType.MouseDown && Event.current.button == 1) { _mode_paint = PaintMode.Single; } }
// Invoked from World.Settings internal static void LoadSettings(IEnumerable <XElement> xmlToolSettings) { foreach (var xElement in xmlToolSettings.Elements("Tool")) { string toolName = (string)xElement.Attribute("Name"); switch (toolName) { case "Paint": _paintMode = (PaintMode)ToEnum(typeof(PaintMode), (string)xElement.Attribute("Mode") ?? PaintMode.Tile.ToString()); break; case "Brush": _brushWidth = (int?)xElement.Attribute("Width") ?? 20; _brushHeight = (int?)xElement.Attribute("Height") ?? 20; _brushOutline = (int?)xElement.Attribute("Outline") ?? 1; _brushShape = (BrushShape)ToEnum(typeof(BrushShape), (string)xElement.Attribute("Shape") ?? BrushShape.Square.ToString()); break; case "Tile": _paintTile = (int?)xElement.Attribute("Tile") ?? 0; _paintTileMask = (int?)xElement.Attribute("Mask") ?? 0; _paintTileMaskMode = (MaskMode)ToEnum(typeof(MaskMode), (string)xElement.Attribute("Mode") ?? MaskMode.Off.ToString()); break; case "Wall": _paintWall = (int?)xElement.Attribute("Wall") ?? 0; _paintWallMask = (int?)xElement.Attribute("Mask") ?? 0; _paintWallMaskMode = (MaskMode)ToEnum(typeof(MaskMode), (string)xElement.Attribute("Mode") ?? MaskMode.Off.ToString()); break; } } }
PaintMode GetPaintModeForTool(MotionEventToolType toolType, PaintMode defaultMode) { if (toolType == MotionEventToolType.Eraser) { return(PaintMode.Erase); } return(defaultMode); }
public void SetPixel(int x, int y, PaintMode? mode = null, bool? erase = null) { Tile curTile = CurrentWorld.Tiles[x, y]; PaintMode curMode = mode ?? TilePicker.PaintMode; bool isErase = erase ?? TilePicker.IsEraser; switch (curMode) { case PaintMode.Tile: SetTile(curTile, isErase); break; case PaintMode.Wall: SetWall(curTile, isErase); break; case PaintMode.TileAndWall: SetTile(curTile, isErase); SetWall(curTile, isErase); break; case PaintMode.Wire: SetPixelAutomatic(curTile, wire: !isErase); break; case PaintMode.Wire2: SetPixelAutomatic(curTile, wire2: !isErase); break; case PaintMode.Wire3: SetPixelAutomatic(curTile, wire3: !isErase); break; case PaintMode.Liquid: SetPixelAutomatic(curTile, liquid: isErase ? (byte)0 : (byte)255, isLava: TilePicker.IsLava, isHoney: TilePicker.IsHoney); break; } switch (TilePicker.HalfBlockMode) { case HalfBlockMode.HalfBlock: curTile.HalfBrick = true; curTile.Slope = (byte)TilePicker.HalfBlockMode; break; case HalfBlockMode.RampLeft: curTile.HalfBrick = true; curTile.Slope = (byte)TilePicker.HalfBlockMode; break; case HalfBlockMode.RampRight: curTile.HalfBrick = true; curTile.Slope = (byte)TilePicker.HalfBlockMode; break; case HalfBlockMode.Solid: curTile.HalfBrick = false; curTile.Slope = 0; break; case HalfBlockMode.NoAction: default: break; } Color curBgColor = GetBackgroundColor(y); PixelMap.SetPixelColor(x, y, Render.PixelMap.GetTileColor(CurrentWorld.Tiles[x, y], curBgColor, _showWalls, _showTiles, _showLiquid, _showWires)); }
public bool SetCurrentPaintMode(PaintMode mode) { if (this.CurrentPaintMode != mode) { this.CurrentPaintMode = mode; return(true); } return(false); }
public void SetDefaults() { paintMode = PaintMode.Paint; widthProfile = AnimationCurve.Linear(0, 1, 1, 1); heightProfile = AnimationCurve.Linear(0, 0, 1, 0); strengthProfile = AnimationCurve.Linear(0, 1, 1, 1); jitterProfile = AnimationCurve.Linear(0, 0, 1, 0); }
public void DrawGlyphs(FontHandle font, uint[] glyphIndices, PaintMode paintModes, bool allowAutoHinting) { unsafe { fixed(uint *p = glyphIndices) { vgDrawGlyphs(font, (uint)glyphIndices.Length, p, null, null, (uint)paintModes, allowAutoHinting ? 1U : 0); } } }
public void DrawGlyphs(FontHandle font, uint glyphCount, byte[] utf32Text, PaintMode paintModes, bool allowAutoHinting) { unsafe { fixed(byte *bytes = utf32Text) { vgDrawGlyphs(font, glyphCount, (uint *)bytes, null, null, (uint)paintModes, allowAutoHinting ? 1U : 0); } } }
public void DrawGlyphString(FontHandle font, string text, PaintMode paintModes, bool allowAutoHinting) { unsafe { ReadOnlySpan <char> chars = text.AsSpan(); int byteCount = System.Text.Encoding.UTF32.GetByteCount(chars); byte *bytes = stackalloc byte[byteCount]; System.Text.Encoding.UTF32.GetBytes(chars, new Span <byte>(bytes, byteCount)); vgDrawGlyphs(font, (uint)text.Length, (uint *)bytes, null, null, (uint)paintModes, allowAutoHinting ? 1U : 0); } }
public override void Draw(Node node, PaintMode printMode, Color color) { if ((printMode == PaintMode.BACKGROUND)) { base.painter_.FillRectangle(node); } else if (((printMode == PaintMode.FOREGROUND)) && ((node.literalText != null) && (node.literalText.Length > 0))) { base.painter_.DrawString(node, node.style_, color); } }
public override void Draw(Node node, PaintMode printMode, Color color) { if (printMode == PaintMode.BACKGROUND) { DrawBackground(node); } else if (printMode == PaintMode.FOREGROUND) { DrawForeground(color, node); } }
public void SaveSettings() { GridPainterSettings.Default.CellSize = CellSize; GridPainterSettings.Default.ShowRulers = ShowRulers; GridPainterSettings.Default.ShowLines = showLines; // Save field value here instead fo calculable property GridPainterSettings.Default.PaintMode = PaintMode.ToString(); GridPainterSettings.Default.LineArgb = System.Drawing.Color.FromArgb(LineArgb); GridPainterSettings.Default.Line10Argb = System.Drawing.Color.FromArgb(Line10Argb); GridPainterSettings.Default.NumbersArgb = System.Drawing.Color.FromArgb(NumbersArgb); GridPainterSettings.Default.Save(); }
public void DrawText(VGFont font, uint glyphCount, byte[] utf32Text, PaintMode paintModes, bool allowAutoHinting) { unsafe { int mm = matrixMode; // Get current matrix: float *m = stackalloc float[9]; vgGetMatrix(m); // Switch to image matrix if not already: if (mm != (int)MatrixMode.VG_MATRIX_IMAGE_USER_TO_SURFACE) { vgSeti(ParamType.VG_MATRIX_MODE, (int)MatrixMode.VG_MATRIX_IMAGE_USER_TO_SURFACE); vgLoadMatrix(m); } //VG_MATRIX_IMAGE_USER_TO_SURFACE // Render text: fixed(byte *bytes = utf32Text) { uint *p = (uint *)bytes; for (uint i = 0; i < glyphCount; i++, p++) { //vgDrawGlyph(textFont, *p, (uint)paintModes, 0U); // Translate to origin of glyph: var origin = font.Origins[*p]; vgTranslate(-origin[0], -origin[1]); // Draw the image: vgDrawImage(font.Images[*p]); // Undo origin translation: vgTranslate(origin[0], origin[1]); // Advance to next glyph position: var escapement = font.Escapements[*p]; vgTranslate(escapement[0], escapement[1]); } } // Restore previous matrix mode: if (mm != (int)MatrixMode.VG_MATRIX_IMAGE_USER_TO_SURFACE) { vgSeti(ParamType.VG_MATRIX_MODE, mm); } // Restore old matrix: vgLoadMatrix(m); } }
private void BmpForm_Load(object sender, EventArgs e) { toolStrip1.Hide(); OriginBmp = new Bitmap(this.BackgroundImage); BackBmp = (Bitmap)OriginBmp.Clone(); BackGraphics = Graphics.FromImage(BackBmp); BackGraphics.FillRectangle(new SolidBrush(Color.FromArgb(130, Color.Gray)), Screen.PrimaryScreen.Bounds); // 加上灰色透明覆盖 this.BackgroundImage = BackBmp; ScreenHeight = BackBmp.Height; ScreenWidth = BackBmp.Width; BackGraphics.Dispose(); this.paintmode = PaintMode.none; }
//change paint mode public void SetPaintMode(string mode) { switch (mode) { case "Add": paintMode = PaintMode.Place; break; case "Subtract": paintMode = PaintMode.Break; break; } }
void FloodFill(int x, int y, int z, byte color, PaintMode mode) { if (IsOutOfBounds(x, y, z)) { return; } foreach (int index in GetSymmetryPoints(x, y, z)) { int px, py, pz; FromIndex(index, out px, out py, out pz); DoFloodFill(px, py, pz, color, mode); } }
// Set current paint mode public void SetPaintMode(PaintMode paintMode) { this.paintMode = paintMode; if (paintMode == PaintMode.paint) { paintTile = selectedEditorTile; } else { paintTile = defaultTile; } }
public void DrawText(FontHandle textFont, uint glyphCount, byte[] utf32Text, PaintMode paintModes, bool allowAutoHinting, float size) { unsafe { int mm = matrixMode; // Get current matrix: float *m = stackalloc float[9]; vgGetMatrix(m); // Switch to glyph matrix if not already: if (mm != (int)MatrixMode.VG_MATRIX_GLYPH_USER_TO_SURFACE) { vgSeti(ParamType.VG_MATRIX_MODE, (int)MatrixMode.VG_MATRIX_GLYPH_USER_TO_SURFACE); vgLoadMatrix(m); } // Render text: //vgScale(size, size); float *origin = stackalloc float[2]; origin[0] = 0f; origin[1] = 0f; vgSetfv(ParamType.VG_GLYPH_ORIGIN, 2, origin); fixed(byte *bytes = utf32Text) { // default: vgDrawGlyphs(textFont, glyphCount, (uint *)bytes, null, null, (uint)paintModes, 0U); // paintModes = 0 still renders glyphs! //vgDrawGlyphs(textFont, glyphCount, (uint*)bytes, null, null, (uint)0, 0U); //uint* p = (uint*)bytes; //for (uint i = 0; i < glyphCount; i++, p++) //{ // vgDrawGlyph(textFont, *p++, (uint)paintModes, 0U); //} } // Restore matrix mode: if (mm != (int)MatrixMode.VG_MATRIX_GLYPH_USER_TO_SURFACE) { // TODO: restore glyph matrix before switching back? vgSeti(ParamType.VG_MATRIX_MODE, mm); } // Restore old matrix: vgLoadMatrix(m); } }
public override void Draw(Node node, PaintMode printMode, Color color) { if ((printMode == PaintMode.BACKGROUND)) { base.painter_.FillRectangle(node); } else if ((printMode == PaintMode.FOREGROUND)) { if ((node.firstChild == null)) { base.painter_.OutlineRect(node); } } }
private void Awake() { if (instance == null) { instance = this; } else { Debug.LogError("Tried to instantiate more than one Bee!"); return; } paintMode = PaintMode.EnemiesLocked; }
public override void Draw(Node node, PaintMode printMode, Color color) { if (printMode == PaintMode.BACKGROUND) { if (node.style_ != null) { base.painter_.FillRectangle(node, node.style_.background); } } else if (((printMode == PaintMode.FOREGROUND)) && ((node.firstChild == null))) { base.painter_.OutlineRect(node); } }
public void SetPixel(int x, int y, PaintMode? mode = null, bool? erase = null) { Tile curTile = CurrentWorld.Tiles[x, y]; PaintMode curMode = mode ?? TilePicker.PaintMode; bool isErase = erase ?? TilePicker.IsEraser; switch (curMode) { case PaintMode.TileAndWall: if (TilePicker.TileStyleActive) SetTile(curTile, isErase); if (TilePicker.WallStyleActive) SetWall(curTile, isErase); if (TilePicker.BrickStyleActive && TilePicker.ExtrasActive) SetPixelAutomatic(curTile, brickStyle: TilePicker.BrickStyle); if (TilePicker.TilePaintActive) SetPixelAutomatic(curTile, tileColor: isErase ? 0 : TilePicker.TileColor); if (TilePicker.WallPaintActive) SetPixelAutomatic(curTile, wallColor: isErase ? 0 : TilePicker.WallColor); if (TilePicker.ExtrasActive) SetPixelAutomatic(curTile, actuator: isErase ? false : TilePicker.Actuator, actuatorInActive: isErase ? false : TilePicker.ActuatorInActive); break; case PaintMode.Wire: if (TilePicker.RedWireActive) SetPixelAutomatic(curTile, wire: !isErase); if (TilePicker.BlueWireActive) SetPixelAutomatic(curTile, wire2: !isErase); if (TilePicker.GreenWireActive) SetPixelAutomatic(curTile, wire3: !isErase); if (TilePicker.YellowWireActive) SetPixelAutomatic(curTile, wire4: !isErase); break; case PaintMode.Liquid: SetPixelAutomatic(curTile, liquid: isErase ? (byte)0 : (byte)255, liquidType: TilePicker.LiquidType); break; case PaintMode.Track: SetTrack(x, y, curTile, isErase, (TilePicker.TrackMode == TrackMode.Hammer), true); break; } // curTile.BrickStyle = TilePicker.BrickStyle; Color curBgColor = GetBackgroundColor(y); PixelMap.SetPixelColor(x, y, Render.PixelMap.GetTileColor(CurrentWorld.Tiles[x, y], curBgColor, _showWalls, _showTiles, _showLiquid, _showRedWires, _showBlueWires, _showGreenWires, _showYellowWires)); }
public override void Draw(Node node, PaintMode printMode, Color color) { if ((printMode == PaintMode.BACKGROUND)) { if (node.isVisible) { base.painter_.FillRectangle(node); } } else if ((printMode == PaintMode.FOREGROUND)) { if ((node.isVisible && (node.literalText != null)) && (node.literalText.Length > 0)) { if (node.NotBlack()) { color = node.style_.color; } base.painter_.DrawString(node, node.style_, color); } } }
// Invoked from World.Settings internal static void LoadSettings(IEnumerable<XElement> xmlToolSettings) { foreach (var xElement in xmlToolSettings.Elements("Tool")) { string toolName = (string)xElement.Attribute("Name"); switch (toolName) { case "Paint": _paintMode = (PaintMode)ToEnum(typeof(PaintMode), (string)xElement.Attribute("Mode") ?? PaintMode.TileAndWall.ToString()); break; case "Brush": _brushWidth = (int?)xElement.Attribute("Width") ?? 20; _brushHeight = (int?)xElement.Attribute("Height") ?? 20; _brushOutline = (int?)xElement.Attribute("Outline") ?? 1; _brushShape = (BrushShape)ToEnum(typeof(BrushShape), (string)xElement.Attribute("Shape") ?? BrushShape.Square.ToString()); break; case "Tile": _paintTile = (int?)xElement.Attribute("Tile") ?? 0; _paintTileMask = (int?)xElement.Attribute("Mask") ?? 0; _paintTileActive = (bool)xElement.Attribute("Active"); _paintTileMaskMode = (MaskMode)ToEnum(typeof(MaskMode), (string)xElement.Attribute("Mode") ?? MaskMode.Off.ToString()); break; case "Wall": _paintWall = (int?)xElement.Attribute("Wall") ?? 0; _paintWallMask = (int?)xElement.Attribute("Mask") ?? 0; _paintWallActive = (bool)xElement.Attribute("Active"); _paintWallMaskMode = (MaskMode)ToEnum(typeof(MaskMode), (string)xElement.Attribute("Mode") ?? MaskMode.Off.ToString()); break; case "Wire": _redWire = (bool)xElement.Attribute("Red"); _blueWire = (bool)xElement.Attribute("Blue"); _greenWire = (bool)xElement.Attribute("Green"); break; } } }
void Paint (PaintMode mode, float x, float y) { Paint (mode, x, y, 1.0f, 0, 0, 0, 0, 0); }
public void print(Rectangle rect, PaintMode printMode, Color MathColor) { try { if (box == null) { return; } box.Draw(this, printMode, MathColor); NodesList nodesList = GetChildrenNodes(); Node node = nodesList.Next(); bool notOnWhite = false; while (node != null) { if (!notOnWhite && (((type_.type == ElementType.Math) || (type_.type == ElementType.Mtd)) || (type_.type == ElementType.Mrow))) { notOnWhite = node.NotOnWhite(); } if (node.isVisible && (node.type_.type != ElementType.Mphantom)) { node.print(rect, printMode, MathColor); } node = nodesList.Next(); } if ((printMode == PaintMode.BACKGROUND)) { if (!notOnWhite || (((type_.type != ElementType.Math) && (type_.type != ElementType.Mtd)) && (type_.type != ElementType.Mrow))) { return; } ((BaseBox) box).painter_.FillBackground(this); } } catch { } }
void Paint (PaintMode mode, float x, float y, float pressure, float major, float minor, float orientation, float distance, float tilt) { if (mBitmap != null) { if (major <= 0 || minor <= 0) { // If size is not available, use a default value. major = minor = 16; } switch (mode) { case PaintMode.Draw: mPaint.Color = new Color (COLORS[mColorIndex]); mPaint.Alpha = Math.Min ((int)(pressure * 128), 255); DrawOval (mCanvas, x, y, major, minor, orientation, mPaint); break; case PaintMode.Erase: mPaint.Color = new Color (BACKGROUND_COLOR); mPaint.Alpha = Math.Min ((int)(pressure * 128), 255); DrawOval (mCanvas, x, y, major, minor, orientation, mPaint); break; case PaintMode.Splat: mPaint.Color = new Color (COLORS[mColorIndex]); mPaint.Alpha = 64; DrawSplat (mCanvas, x, y, orientation, distance, tilt, mPaint); break; } } mFadeSteps = 0; Invalidate (); }
/// <summary> /// Forces the immediate Shutdown and saving of state on this thread /// We must not change thread because we are probably going into the background and therefore the main UI thread will not /// come alive again until the app is back in teh foreground again /// </summary> public void ForceSaveAndExit() { if (this.paintMode != PaintMode.Exiting) { this.paintMode = PaintMode.Exiting; this.SaveAndExit(); } }
public tk2dTileMapEditorBrush(tk2dTileMapEditorBrush source) { this.name = source.name; this.type = source.type; this.paintMode = source.paintMode; tiles = new tk2dSparseTile[source.tiles.Length]; for (int i = 0; i < source.tiles.Length; ++i) tiles[i] = new tk2dSparseTile(source.tiles[i]); multiSelectTiles = new int[source.multiSelectTiles.Length]; for (int i = 0; i < source.multiSelectTiles.Length; ++i) multiSelectTiles[i] = source.multiSelectTiles[i]; edgeMode = source.edgeMode; multiLayer = source.multiLayer; overrideWithSpriteBounds = source.overrideWithSpriteBounds; }
public override void Draw(Node node, PaintMode printMode, Color color) { if ((printMode == PaintMode.BACKGROUND)) { base.painter_.FillRectangle(node); } else if ((printMode == PaintMode.FOREGROUND)) { int x1 = 0; int y1 = 0; int x2 = 0; int y2 = 0; int xx2 = 0; int yy2 = 0; if ((printMode == PaintMode.BACKGROUND)) { base.painter_.FillRectangle(node); } else if ((printMode == PaintMode.FOREGROUND)) { Point[] points; if (node.NotBlack()) { color = node.style_.color; } if (this.lineThick_ > 1) { x1 = (((base.rect.x) + this.flineThick_) - this.dlineThick_) + 1; y1 = base.rect.y + (base.rect.height / 2); x2 = (base.rect.x) + this.elineThick_; y2 = base.rect.y + base.rect.height; xx2 = (((base.rect.x ) + this.twlineThick_) + this.lineThick_) - 1; yy2 = ((base.rect.y + this.lthick2_) + this.lineThick_) - 1; double diff1 = this.diff(x1, y1, this.aspect(x1, y1, x2, y2)); double d = this.aspect(x2, y2, xx2, yy2); double diff2 = this.diff(x2, y2, d); int num11 = 0; int num12 = 0; double num13 = 0; double num14 = 0; num13 = (diff2 - diff1) / (this.aspect(x1, y1, x2, y2) - d); num14 = (num13 * this.aspect(x1, y1, x2, y2)) + diff1; num11 = Convert.ToInt32(Math.Round(num13)); num12 = Convert.ToInt32(Math.Round(num14)); Point point9 = new Point(x1, (y1 + this.lineThick_) - 1); Point point8 = new Point(num11, num12); diff1 = this.diff((x1 + this.dlineThick_) - 1, y1, this.aspect(x1, y1, x2, y2)); diff2 = this.diff((base.rect.x ) + this.twlineThick_, base.rect.y + this.lthick2_, d); num13 = (diff2 - diff1) / (this.aspect(x1, y1, x2, y2) - d); num14 = (num13 * this.aspect(x1, y1, x2, y2)) + diff1; num11 = Convert.ToInt32(Math.Round(num13)); num12 = Convert.ToInt32(Math.Round(num14)); Point point3 = new Point(num11, num12); Point point2 = new Point((x1 + this.dlineThick_) - 1, y1); Point point10 = new Point(base.rect.x, ((base.rect.y + (base.rect.height / 2)) + this.lineThick_) - 1); Point point11 = new Point(base.rect.x, base.rect.y + (base.rect.height / 2)); Point point1 = new Point(base.rect.x, base.rect.y + (base.rect.height / 2)); Point point4 = new Point((base.rect.x) + this.twlineThick_, base.rect.y + this.lthick2_); Point point7 = new Point(((base.rect.x) + this.twlineThick_) + this.lineThick_, ((base.rect.y + this.lthick2_) + this.lineThick_) - 1); Point point5 = new Point((base.rect.x + base.rect.width) - this.spaceHeight_, base.rect.y + this.lthick2_); Point point6 = new Point((base.rect.x + base.rect.width) - this.spaceHeight_, ((base.rect.y + this.lthick2_) + this.lineThick_) - 1); points = new Point[] { point1, point2, point3, point4, point5, point6, point7, point8, point9, point10, point11 }; Point[] pointArray1 = points; base.painter_.Polyline(pointArray1, color); } else { base.painter_.DrawLine(base.rect.x, base.rect.y + (base.rect.height / 2), ((base.rect.x ) + this.flineThick_) - 1, base.rect.y + (base.rect.height / 2), color); x1 = (((base.rect.x ) + this.flineThick_) - this.dlineThick_) + 1; y1 = base.rect.y + (base.rect.height / 2); x2 = (base.rect.x ) + this.elineThick_; y2 = base.rect.y + base.rect.height; xx2 = (base.rect.x ) + this.twlineThick_; yy2 = base.rect.y + this.lthick2_; double num15 = this.aspect(x1, y1, x2, y2); double num16 = this.diff(x1, y1, num15); double num17 = this.aspect(x2, y2, xx2, yy2); double num18 = this.diff(x2, y2, num17); int num19 = 0; int num20 = 0; double num21 = 0; double num22 = 0; num21 = (num18 - num16) / (num15 - num17); num22 = (num21 * num15) + num16; num19 = Convert.ToInt32(Math.Round(num21)); num20 = Convert.ToInt32(Math.Round(num22)); Point point12 = new Point(x1, y1); Point point16 = new Point(x1, y1); Point point15 = new Point(num19, num20); num16 = this.diff((x1 + this.dlineThick_) - 1, y1, num15); num21 = (num18 - num16) / (num15 - num17); num22 = (num21 * num15) + num16; num19 = Convert.ToInt32(Math.Round(num21)); num20 = Convert.ToInt32(Math.Round(num22)); Point point14 = new Point(num19, num20); Point point13 = new Point((base.rect.x ) + this.flineThick_, y1); points = new Point[] { point12, point13, point14, point15, point16 }; base.painter_.Polyline(points, color); base.painter_.DrawLine((base.rect.x ) + this.elineThick_, base.rect.y + base.rect.height, (base.rect.x) + this.twlineThick_, base.rect.y + this.lthick2_, color); base.painter_.DrawLine((base.rect.x ) + this.twlineThick_, base.rect.y + this.lthick2_, (base.rect.x + base.rect.width) - this.spaceHeight_, base.rect.y + this.lthick2_, color); } } } }
public extern static void SetPaint(uint paint, PaintMode paintModes);
public extern static uint GetPaint(PaintMode paintMode);
public extern static void DrawGlyph(uint font, uint glyphIndex, PaintMode paintModes, Boolean allowAutoHinting);
unsafe extern static void DrawGlyphs(uint font, int glyphCount, uint *glyphIndices, float *adjustments_x, float *adjustments_y, PaintMode paintModes, Boolean allowAutoHinting);
public override void Draw(Node node, PaintMode printMode, Color color) { base.painter_.FillRectangle(node, Color.Gray); }
public virtual void Draw(Node node, PaintMode printMode, Color color) { }
public override void Draw(Node node, PaintMode printMode, Color color) { this.isBracketed = false; if ((printMode == PaintMode.BACKGROUND)) { base.painter_.FillRectangle(node); } else if ((printMode == PaintMode.FOREGROUND)) { int x = node.box.X; int width = node.box.Width; node.box.X = x + this.lspace; node.box.Width = (width - this.lspace) - this.rspace; try { if (node.NotBlack()) { color = node.style_.color; } if (base.painter_.IsStretchy(node)) { if (base.painter_.DrawBracketed(node, color)) { this.isBracketed = true; } } else if ((node.literalText != null) && (node.literalText.Length > 0)) { base.painter_.DrawString(node, node.style_, color); } } catch { } node.box.X = x; node.box.Width = width; } }
public extern static void DrawPath(uint path, PaintMode paintModes);
void DrawPaintToolUI() { GUILayout.BeginHorizontal(); if (GUILayout.Toggle(paintMode == PaintMode.PAINT,EditorGUIUtility.Load("Paint_brush_icon.psd") as Texture2D,GUI.skin.FindStyle("ButtonLeft"),GUILayout.MaxHeight(28))) paintMode = PaintMode.PAINT; if (GUILayout.Toggle(paintMode == PaintMode.SMOOTH,EditorGUIUtility.Load("Smooth_brush_icon.psd") as Texture2D,GUI.skin.FindStyle("ButtonRight"),GUILayout.MaxHeight(28))) paintMode = PaintMode.SMOOTH; GUILayout.EndHorizontal(); selectionMask = GUILayout.Toggle(selectionMask,"Selection mask"); GUILayout.BeginHorizontal(); GUILayout.Label("Radius"); brushRadius = EditorGUILayout.Slider(brushRadius,5,200); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Opacity"); brushOpacity = EditorGUILayout.Slider(brushOpacity*20,0,1)/20f; GUILayout.EndHorizontal(); GUI.enabled = paintMode == PaintMode.PAINT; GUILayout.BeginHorizontal(); GUILayout.Label("Min value"); GUILayout.FlexibleSpace(); minBrushValue = EditorGUILayout.FloatField(minBrushValue,GUILayout.Width(EditorGUIUtility.fieldWidth)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); GUILayout.Label("Max value"); GUILayout.FlexibleSpace(); maxBrushValue = EditorGUILayout.FloatField(maxBrushValue,GUILayout.Width(EditorGUIUtility.fieldWidth)); GUILayout.EndHorizontal(); GUI.enabled = true; }
/// <summary> /// Initiates the shutdown process. /// We will display a 'busy' form/window -- we pass in a delegate/action to be run once the form /// has displayed /// </summary> private void InitiateShutdown() { if (this.paintMode != PaintMode.Exiting) { this.paintMode = PaintMode.Exiting; this.saveBusyMessageDisplay.Show(new Action(this.SaveAndExit)); } }
public override void Draw(Node tableNode, PaintMode printMode, Color color) { if ((printMode == PaintMode.BACKGROUND)) { base.painter_.FillRectangle(tableNode); } else { if (tableNode.NotBlack()) { color = tableNode.style_.color; } if (this.table.frame == TableLineStyle.SOLID) { tableNode.box.Width = this.table.totalHorzFrameSpacing; base.painter_.Rectangle(tableNode, color); tableNode.box.Width = this.table.totalWidth; } else if (this.table.frame == TableLineStyle.DASHED) { tableNode.box.Width = this.table.totalHorzFrameSpacing; base.painter_.DrawNodeRect(tableNode, color); tableNode.box.Width = this.table.totalWidth; } for (int i = 0; i < this.table.RowCount; i++) { MRow row = this.table.GetRow(i); for (int j = 0; j < row.Count; j++) { MCell cell = (MCell) row.cells[j]; int rspan = 0; int colSpan = 0; rspan = (i + cell.rowSpan) - 1; colSpan = cell.colSpan; if (rspan < (this.table.RowCount - 1)) { int x1 = 0; int x2 = 0; int y1 = 0; if (colSpan == 0) { x1 = base.rect.x; } else { x1 = (base.rect.x + this.table.spanBases[colSpan]) - (this.table.spanWidth[colSpan - 1] / 2); } if (colSpan == (this.table.ColCount - 1)) { x2 = base.rect.x + this.table.totalHorzFrameSpacing; } else { x2 = ((base.rect.x + this.table.spanBases[(colSpan + cell.columnSpan) - 1]) + this.table.spanHeight[(colSpan + cell.columnSpan) - 1]) + (this.table.spanWidth[(colSpan + cell.columnSpan) - 1] / 2); } y1 = (row.node.box.Y + this.table.rowspanWidth(i, cell.rowSpan)) + (this.table.spacingWidth[rspan] / 2); if (row.lines == TableLineStyle.SOLID) { base.painter_.DrawLine(x1, y1, x2, y1, color); } else if (row.lines == TableLineStyle.DASHED) { base.painter_.DrawDashLine(x1, y1, x2, y1, color); } } } } for (int i = 0; i < this.table.RowCount; i++) { MRow row = this.table.GetRow(i); for (int j = 0; j < row.Count; j++) { MCell cell = (MCell) row.cells[j]; int cspn = (cell.colSpan + cell.columnSpan) - 1; if (cspn < (this.table.ColCount - 1)) { int x1 = 0; int y1 = 0; int y2 = 0; int hh = 0; for (int k = 0; k < cell.rowSpan; k++) { MRow rrow = this.table.GetRow(i + k); hh += rrow.node.box.Height; if (k < (cell.rowSpan - 1)) { hh += this.table.spacingWidth[i + k]; } } x1 = ((base.rect.x + this.table.spanBases[cspn]) + this.table.spanHeight[cspn]) + (this.table.spanWidth[cspn] / 2); if (i == 0) { y1 = base.rect.y; } else { y1 = row.node.box.Y - (this.table.spacingWidth[i - 1] / 2); } if ((i + (cell.rowSpan - 1)) == (this.table.RowCount - 1)) { y2 = base.rect.y + base.rect.height; } else { y2 = (row.node.box.Y + hh) + (this.table.spacingWidth[i] / 2); } if (this.table.colLines[cspn] == TableLineStyle.SOLID) { base.painter_.DrawLine(x1, y1, x1, y2, color); } else if (this.table.colLines[cspn] == TableLineStyle.DASHED) { base.painter_.DrawDashLine(x1, y1, x1, y2, color); } } } } for (int i = 0; i < this.table.RowCount; i++) { MRow row = this.table.GetRow(i); if (row.isLabeled) { row.node.box.Width = this.table.totalWidth; } } } }
public override void Draw(Node node, PaintMode printMode, Color color) { }