public Lapiz Duplicar(Brocha brocha) { return(new Lapiz() { Brocha = brocha, Ancho = Ancho }); }
public void RellenarRectangulo(Brocha brocha, Punto inicio, TamBloque bloque) { Brush b = _brochas.Obtener(brocha); PointF pt = Traducir(inicio); SizeF tam = Traducir(bloque); g.FillRectangle(b, pt.X, pt.Y, tam.Width, tam.Height); }
protected void Update() { bool Creacion = Input.GetKeyDown(KeyCode.C); bool Seleccion = Input.GetKeyDown(KeyCode.S); bool Eliminar = Input.GetKeyDown(KeyCode.E); bool subirCapa = Input.GetKeyDown(KeyCode.KeypadPlus); bool bajarCapa = Input.GetKeyDown(KeyCode.KeypadMinus); bool planoGrid = Input.GetKeyDown(KeyCode.Tab); bool ModoTipoAzulejo = Input.GetKeyDown(KeyCode.Space); if (ModoTipoAzulejo) { if (tipoAzulejo == TipoAzulejo.Automatico) { tipoAzulejo = TipoAzulejo.Simple; } else { tipoAzulejo = TipoAzulejo.Automatico; } } if (planoGrid) { CamaraGrid.instanciar().gameObject.SetActive(!CamaraGrid.instanciar().gameObject.activeSelf); } if (subirCapa) { if (capa < CamaraConfiguracionComponente.mapaTam.y) { capa += 1; CamaraGrid.instanciar().actualizarPosicion(CamaraConfiguracionComponente.azulejoTam.y, CamaraGrid.GridElevacion.Subir); } } if (bajarCapa) { if (capa > 1) { capa -= 1; CamaraGrid.instanciar().actualizarPosicion(CamaraConfiguracionComponente.azulejoTam.y, CamaraGrid.GridElevacion.Bajar); } } if (Creacion) { brocha = Brocha.Creacion; } if (Seleccion) { brocha = Brocha.Seleccion; } if (Eliminar) { brocha = Brocha.Eliminar; } }
public void DibujarTexto(Punto posicion, Letra letra, Brocha brocha, string texto) { Font f = _letras.Obtener(letra); Brush b = _brochas.Obtener(brocha); //StringFormat st = new StringFormat(StringFormat.GenericTypographic); //st.SetMeasurableCharacterRanges(new CharacterRange[]{new CharacterRange(0, texto.Length)}); //Region[] regs = g.MeasureCharacterRanges(texto, f, new RectangleF(Traducir(posicion), new SizeF(g.DpiX * 100, g.DpiY * 100)),st); g.DrawString(texto, f, b, Traducir(posicion), FormatoPresentacion); }
public Estilo(Bloque bloque) { //Debug.Assert(bloque != null); Debug.Assert(bloque.Formato != null); Formato f = bloque.Formato; ColorFondo = new BrochaSolida(f.ObtenerColorFondo()); ColorLetra = new BrochaSolida(f.ObtenerColorLetra()); Letra = Letra.Crear(f.FamiliaLetra, f.ObtenerTamLetraEscalado(), f.ObtenerNegrilla(), f.ObtenerCursiva(), f.ObtenerSubrayado()); }
/// <summary> /// Convert a brush to a WPF brush /// </summary> /// <param name="brocha">The brush to convert </param> /// <returns></returns> public static Brush ConvertToBrush(Brocha brocha) { try { if (typeof(SolidaBrush) == brocha.GetType())//If the brush is solid { return(new SolidColorBrush(ConvertToColor(((SolidaBrush)brocha).Color))); } if (brocha.GetType() == typeof(LinearGradienteBrush))//If the brush is a linear gradient { LinearGradienteBrush mybrush = (LinearGradienteBrush)brocha; return(new LinearGradientBrush(ConvertToColor(mybrush.Color_Ini), ConvertToColor(mybrush.Color_Fin), ConvertToPoint(mybrush.Ini), ConvertToPoint(mybrush.Fin))); } if (brocha.GetType() == typeof(RadialGradienteBrush))//If { RadialGradienteBrush mybrush = (RadialGradienteBrush)brocha; RadialGradientBrush newbrush = new RadialGradientBrush(ConvertToColor(mybrush.Color_Ini), ConvertToColor(mybrush.Color_Fin)); newbrush.Center = ConvertToPoint(mybrush.Center); newbrush.RadiusX = mybrush.RadiusX; newbrush.RadiusY = mybrush.RadiusY; return(newbrush); } if (brocha.GetType() == typeof(ImagenBrush))//If the bruch is an imagen { return(new ImageBrush(new BitmapImage(new Uri(((ImagenBrush)brocha).Source)))); } } catch (Exception) { return(null); } return(null); }
public override bool Equals(object obj) { Lapiz l = (Lapiz)obj; return(Ancho.Equals(l.Ancho) && Brocha.Equals(l.Brocha)); }
public override int GetHashCode() { return(Brocha.GetHashCode() & Ancho.GetHashCode()); }