BGRABitmap tutorial 6/es: what changed
Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.
| Old | New | Line | |
|---|---|---|---|
| 1 | 1 | Esta tutoría muestra como usar diferentes tipos de líneas y figuras. | |
| 2 | 2 | ||
| 3 | 3 | ### Crear un nuevo proyecto | |
| 4 | 4 | ||
| 5 | 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 | 6 | ||
| 7 | 7 | ### Añade un manejador de pintado | |
| 8 | 8 | ||
| 9 | 9 | Con el inspector de objetos, añade un manejador OnPaint y escribe : | |
| 10 | 10 | ||
| 11 | 11 | ``` pascal | |
| 12 | 12 | procedure TForm1.FormPaint(Sender: TObject); | |
| 13 | 13 | var image: TBGRABitmap; | |
| 14 | 14 | c: TBGRAPixel; | |
| 15 | 15 | begin | |
| 16 | 16 | image := TBGRABitmap.Create(ClientWidth, ClientHeight, clBtnFace); | |
| 17 | 17 | c := clWindowText; | |
| 18 | 18 | ||
| 19 | 19 | image.RectangleAntialias(80,80,300,200, c, 50); | |
| 20 | 20 | ||
| 21 | 21 | image.Draw(Canvas,0,0,True); | |
| 22 | 22 | image.free; | |
| 23 | 23 | end; | |
| 24 | 24 | ``` | |
| 25 | 25 | ||
| 26 | 26 | ### Ejecuta el programa | |
| 27 | 27 | ||
| 28 | 28 | Esto debe dibujar un rectángulo con un lápiz negro ancho. | |
| 29 | 29 | ||
| 30 | - | ||
| 31 | - | ||
| 32 | - | ||
| 33 | - | ||
| 30 | + |  | |
| 34 | 31 | ||
| 35 | 32 | ### Cambiar estilo de unión | |
| 36 | 33 | ||
| 37 | 34 | Si desea esquinas redondeadas, puede especificar: | |
| 38 | 35 | ||
| 39 | 36 | ``` pascal | |
| 40 | 37 | image.JoinStyle := pjsRound; | |
| 41 | 38 | ``` | |
| 42 | 39 | ||
| 43 | 40 | ### Ejecuta el programa | |
| 44 | 41 | ||
| 45 | 42 | Esto debe dibujar un rectángulo con un lápiz negro ancho con esquinas redondeadas. | |
| 46 | 43 | ||
| 47 | - | ||
| 48 | - | ||
| 49 | - | ||
| 50 | - | ||
| 44 | + |  | |
| 51 | 45 | ||
| 52 | 46 | ### Mezclar estilos de unión | |
| 53 | 47 | ||
| 54 | 48 | Usted puede mezclar estilos de unión en un rectángulo como este: | |
| 55 | 49 | ||
| 56 | 50 | ``` pascal | |
| 57 | 51 | image.FillRoundRectAntialias(80,80,300,200, 20,20, c, [rrTopRightSquare,rrBottomLeftSquare]); | |
| 58 | 52 | ``` | |
| 59 | 53 | ||
| 60 | 54 | 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 | 55 | ||
| 62 | - | ||
| 63 | - | ||
| 64 | - | ||
| 65 | - | ||
| 56 | + |  | |
| 66 | 57 | ||
| 67 | 58 | ### Cambiar el estilo de la pluma | |
| 68 | 59 | ||
| 69 | 60 | Usted puede dibujar una línea de puntos así: | |
| 70 | 61 | ||
| 71 | 62 | ``` pascal | |
| 72 | 63 | image.JoinStyle := pjsBevel; | |
| 73 | 64 | image.PenStyle := psDot; | |
| 74 | 65 | image.DrawPolyLineAntialias([PointF(40,200), PointF(120,100), PointF(170,140), PointF(250,60)],c,10); | |
| 75 | 66 | ``` | |
| 76 | 67 | ||
| 77 | 68 | Usted debe obtener la siguiente imagen. Observe que la línea comienza con una tapa redonda. | |
| 78 | 69 | ||
| 79 | - | ||
| 80 | - | ||
| 81 | - | ||
| 82 | - | ||
| 70 | + |  | |
| 83 | 71 | ||
| 84 | 72 | ### Cambio extremo de línea | |
| 85 | 73 | ||
| 86 | 74 | Puede dibujar una polilínea con una tapa cuadrada de esta manera: | |
| 87 | 75 | ||
| 88 | 76 | ``` pascal | |
| 89 | 77 | image.JoinStyle := pjsBevel; | |
| 90 | 78 | image.LineCap := pecSquare; | |
| 91 | 79 | image.PenStyle := psSolid; | |
| 92 | 80 | image.DrawPolyLineAntialias([PointF(40,200), PointF(120,100), PointF(170,140), PointF(250,60)],c,10); | |
| 93 | 81 | ``` | |
| 94 | 82 | ||
| 95 | - | ||
| 96 | - | ||
| 97 | - | ||
| 98 | - | ||
| 83 | + |  | |
| 99 | 84 | ||
| 100 | 85 | ### Dibujo de línea abierta | |
| 101 | 86 | ||
| 102 | 87 | Usted puede dibujar una línea que se abre, es decir, el final de la línea se completa en el interior. | |
| 103 | 88 | ||
| 104 | 89 | ``` pascal | |
| 105 | 90 | image.DrawPolyLineAntialias([PointF(40,200), PointF(120,100), PointF(170,140), PointF(250,60)],c,10,False); | |
| 106 | 91 | ``` | |
| 107 | 92 | ||
| 108 | - | ||
| 109 | - | ||
| 110 | - | ||
| 111 | - | ||
| 93 | + |  | |
| 112 | 94 | ||
| 113 | 95 | 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 | 96 | ||
| 115 | 97 | ``` pascal | |
| 116 | 98 | c := BGRA(0,0,0,128); | |
| 117 | 99 | ||
| 118 | 100 | image.DrawLineAntialias(40,150, 120,50, c, 10); | |
| 119 | 101 | image.DrawLineAntialias(120,50, 170,90, c, 10); | |
| 120 | 102 | image.DrawLineAntialias(170,90, 250,10, c, 10); | |
| 121 | 103 | ||
| 122 | 104 | image.DrawLineAntialias(40,250, 120,150, c, 10, False); | |
| 123 | 105 | image.DrawLineAntialias(120,150, 170,190, c, 10, False); | |
| 124 | 106 | image.DrawLineAntialias(170,190, 250,110, c, 10, True); | |
| 125 | 107 | ``` | |
| 126 | 108 | ||
| 127 | - | ||
| 128 | - | ||
| 129 | - | ||
| 130 | - | ||
| 109 | + |  | |
| 131 | 110 | ||
| 132 | 111 | [[BGRABitmap tutorial 5/es|Tutoría anterior (capas y máscaras)]] \| [[BGRABitmap tutorial 7/es|Siguiente tutoría (splines)]] | |
| 133 | 112 | ||
| 134 | 113 | --- | |
| 135 | 114 | *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 | 115 | Category: Castellano | |
| 137 | 116 | Category: Español |
