Sign in Join
Wiki copytemporary

BGRABitmap tutorial 6/es: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: BGRABitmap tutorial 6/es

OldNewLine
1+Esta tutoría muestra como usar diferentes tipos de líneas y figuras.
2+
3+### Crear un nuevo proyecto
4+
5+Crea un nuevo proyecto y añade referencia a [[BGRABitmap]], de la misma forma que en [[BGRABitmap tutorial/es|la primer tutoría]].
6+
7+### Añade un manejador de pintado
8+
9+Con el inspector de objetos, añade un manejador OnPaint y escribe :
10+
11+``` pascal
12+procedure TForm1.FormPaint(Sender: TObject);
13+var image: TBGRABitmap;
14+ c: TBGRAPixel;
15+begin
16+ image := TBGRABitmap.Create(ClientWidth, ClientHeight, clBtnFace);
17+ c := clWindowText;
18+
19+ image.RectangleAntialias(80,80,300,200, c, 50);
20+
21+ image.Draw(Canvas,0,0,True);
22+ image.free;
23+end;
24+```
25+
26+### Ejecuta el programa
27+
28+Esto debe dibujar un rectángulo con un lápiz negro ancho.
29+
30+<figure>
31+<img src="BGRATutorial6a.png" title="BGRATutorial6a.png" />
32+<figcaption>BGRATutorial6a.png</figcaption>
33+</figure>
34+
35+### Cambiar estilo de unión
36+
37+Si desea esquinas redondeadas, puede especificar:
38+
39+``` pascal
40+ image.JoinStyle := pjsRound;
41+```
42+
43+### Ejecuta el programa
44+
45+Esto debe dibujar un rectángulo con un lápiz negro ancho con esquinas redondeadas.
46+
47+<figure>
48+<img src="BGRATutorial6b.png" title="BGRATutorial6b.png" />
49+<figcaption>BGRATutorial6b.png</figcaption>
50+</figure>
51+
52+### Mezclar estilos de unión
53+
54+Usted puede mezclar estilos de unión en un rectángulo como este:
55+
56+``` pascal
57+ image.FillRoundRectAntialias(80,80,300,200, 20,20, c, [rrTopRightSquare,rrBottomLeftSquare]);
58+```
59+
60+Esta función utiliza esquinas redondeadas de forma predeterminada, pero se puede reemplazar con esquinas rectas o curvas bisel. Usted debe obtener la siguiente imagen.
61+
62+<figure>
63+<img src="BGRATutorial6e.png" title="BGRATutorial6e.png" />
64+<figcaption>BGRATutorial6e.png</figcaption>
65+</figure>
66+
67+### Cambiar el estilo de la pluma
68+
69+Usted puede dibujar una línea de puntos así:
70+
71+``` pascal
72+ image.JoinStyle := pjsBevel;
73+ image.PenStyle := psDot;
74+ image.DrawPolyLineAntialias([PointF(40,200), PointF(120,100), PointF(170,140), PointF(250,60)],c,10);
75+```
76+
77+Usted debe obtener la siguiente imagen. Observe que la línea comienza con una tapa redonda.
78+
79+<figure>
80+<img src="Tutorial6c.png" title="Tutorial6c.png" />
81+<figcaption>Tutorial6c.png</figcaption>
82+</figure>
83+
84+### Cambio extremo de línea
85+
86+Puede dibujar una polilínea con una tapa cuadrada de esta manera:
87+
88+``` pascal
89+ image.JoinStyle := pjsBevel;
90+ image.LineCap := pecSquare;
91+ image.PenStyle := psSolid;
92+ image.DrawPolyLineAntialias([PointF(40,200), PointF(120,100), PointF(170,140), PointF(250,60)],c,10);
93+```
94+
95+<figure>
96+<img src="BGRATutorial6d.png" title="BGRATutorial6d.png" />
97+<figcaption>BGRATutorial6d.png</figcaption>
98+</figure>
99+
100+### Dibujo de línea abierta
101+
102+Usted puede dibujar una línea que se abre, es decir, el final de la línea se completa en el interior.
103+
104+``` pascal
105+ image.DrawPolyLineAntialias([PointF(40,200), PointF(120,100), PointF(170,140), PointF(250,60)],c,10,False);
106+```
107+
108+<figure>
109+<img src="BGRATutorial6f.png" title="BGRATutorial6f.png" />
110+<figcaption>BGRATutorial6f.png</figcaption>
111+</figure>
112+
113+De esta manera usted puede conectar líneas, uno tras otro sin llamar la unión en dos ocasiones, lo cual es útil con el dibujo semi-transparente. Se puede comparar la siguiente manera:
114+
115+``` pascal
116+ c := BGRA(0,0,0,128);
117+
118+ image.DrawLineAntialias(40,150, 120,50, c, 10);
119+ image.DrawLineAntialias(120,50, 170,90, c, 10);
120+ image.DrawLineAntialias(170,90, 250,10, c, 10);
121+
122+ image.DrawLineAntialias(40,250, 120,150, c, 10, False);
123+ image.DrawLineAntialias(120,150, 170,190, c, 10, False);
124+ image.DrawLineAntialias(170,190, 250,110, c, 10, True);
125+```
126+
127+<figure>
128+<img src="Tutorial6g.png" title="Tutorial6g.png" />
129+<figcaption>Tutorial6g.png</figcaption>
130+</figure>
131+
132+[[BGRABitmap tutorial 5/es|Tutoría anterior (capas y máscaras)]] \| [[BGRABitmap tutorial 7/es|Siguiente tutoría (splines)]]
133+
134+---
135+*From the Free Pascal wiki, page "BGRABitmap tutorial 6/es", as it stood on 2024-02-15 after a change by Circular, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
136+Category: Castellano
137+Category: Español

Back to history