Instruccion PAINT

Objetivo:

Rellenar una figura de gráficos con el atributo seleccionado.

Sintaxis:

 PAINT (x start,y start)[,paint attribute[,border attribute][,bckgrnd attribute]]

Comentarios:

La instruccion PAINT rellena una figura de gráficos arbitraria del atributo borde especificado con el atributo de pintura especificado. Si paint attribute no es dado, esto predeterminado al atributo de primer plano (3 o 1). border attribute predeterminado de atributo para paint attribute. Ver COLOR y declaraciones PALETTE para más información.

PAINT debe comenzar en un punto no fronterizo, de otra modo, PAINT no tendrá ningún efecto.

PAINT puede llenar cualquier figura, pero la pintura de bordes dentados o figuras muy complejas puede resultar en un error "Out of memory". La instruccion CLEAR puede ser usada para aumentar la cantidad del espacio de pila disponible.

Los puntos que son especificados fuera de los límites de la pantalla no serán trazados y ningún error ocurrirá.

Ver la declaración SCREEN para una descripción de los modos de pantalla diferentes.

Embaldosado de pintura

El embaldosado PAINT es similar para LINE la estilización. Como LINE, PAINT mira una máscara de embaldosado cada vez que un punto es dejado en la pantalla.

Si paint attribute es omitido, el atributo de primer plano estándar es usado.

Si paint attribute es una fórmula numérica, entonces el número debe ser un color válido, y esto es usado para pintar el área como antes.

Si paint attribute es una fórmula de cadena, entonces el embaldosado es realizado como sigue:

La máscara de azulejo es siempre ocho bits de ancho y puede ser de 1 a 64 bytes de largo.

Cada byte en la cadena de azulejo enmascara ocho trozos a lo largo del eje x dejando puntos. Cada byte de la cadena de azulejo es hecho girar como requerido para alinearse a lo largo del eje y, tal que:

 tile_byte_mask=y MOD tile_length

donde y es la posición del cursor de gráficos en el y-eje.

tile_length es la longitud en bytes de la cuerda de azulejo definida por el usuario (1 a 64 bytes).

Este es hecho de modo que el modelo de azulejo sea reproducido uniformemente sobre la pantalla entera (como si PAINT (0,0).. fue usada).

x Increases -->        Bit of Tile Byte
x,y  8 7 6 5 4 3 2 1
0,0 |x|x|x|x|x|x|x|x|  Tile byte 1
0,1 |x|x|x|x|x|x|x|x|  Tile byte 2
0,2 |x|x|x|x|x|x|x|x|  Tile byte 3
.
.
.
0,63 |x|x|x|x|x|x|x|x| Tile byte 64
                       (maximum allowed)

En el modo de alta resolución (PROTEGEN 2), la pantalla puede ser pintada con Xs por la declaración siguiente:

 PAINT (320,100),CHR$(&H81)+CHR$(&H42)+CHR$(&H24)+CHR$(&H18)+CHR$(&H18)+CHR$(&H24)+CHR$(&H81)

Este aparece en la pantalla como sigue:

x increases -->
0,0 |x| | | | | | |x|  CHR$(&H81)  Tile byte 1
0,1 | |x| | | | |x| |  CHR$(&H42)  Tile byte 2
0,2 | | |x| | |x| | |  CHR$(&H24)  Tile byte 3
0,3 | | | |x|x| | | |  CHR$(&H18)  Tile byte 4
0,4 | | | |x|x| | | |  CHR$(&H18)  Tile byte 5
0,5 | | |x| | |x| | |  CHR$(&H24)  Tile byte 6
0,6 | |x| | | | |x| |  CHR$(&H42)  Tile byte 7
0,7 |x| | | | | | |x|  CHR$(&H81)  Tile byte 8

Ya que hay dos trozos por pixel en el modo de resolución media (SCREEN 1), cada byte del modelo de azulejo sólo describe cuatro pixeles. En este caso, cada dos trozos del byte de azulejo describen uno de los cuatro colores posibles asociados con cada uno de los cuatro pixeles para ser dejados.

bckgrnd attribute especifica el modelo de azulejo de fondo o byte en color para saltarse comprobando terminación divisoria. el bckgrnd attribute es una fórmula de cuerda que devuelve un carácter. Cuando omitido, la falta es CHR$(0).

De vez en cuando, usted puede querer pintar el azulejo sobre un área ya pintada que es el mismo color que dos líneas consecutivas en el modelo de azulejo. PAINT se marcha cuando esto encuentra dos líneas consecutivas del mismo color que el punto puesto (el punto es rodeado). No es posible dibujar líneas azules y rojas alternadoras en un fondo rojo sin bckgrnd attribute. PAINT. PAINT paradas tan pronto como el primer pixel rojo es dibujado. Especificando rojo (CHR$(&HAA)) como el atributo de fondo, la línea roja es dibujada sobre el fondo rojo.

Usted no puede especificar más de dos bytes consecutivos en la cuerda de azulejo que emparejan el atributo de fondo. La especificación de más de dos resultados en "Illegal function call" error.

Ejemplos:

10 CLS
20 SCREEN 1
30 LINE (0, 0)-(100, 150), 2, B
40 PAINT (50, 50), 1, 2
50 LOCATE 20, 1

La declaración PAINT en la línea 40 rellena la caja dibujada en la línea 30 con 1 en color.

 

PAINT Statement

Purpose:

To fill in a graphics figure with the selected attribute.

Syntax:

PAINT (x start,y start)[,paint attribute[,border attribute][,bckgrnd attribute]]

Comments:

The PAINT statement fills in an arbitrary graphics figure of the specified border attribute with the specified paint attribute. If paint attribute is not given, it will default to the foreground attribute (3 or 1). border attribute defaults to paint attribute. See the COLOR and PALETTE statements for more information.

PAINT must start on a non-border point, otherwise, PAINT will have no effect.

PAINT can fill any figure, but painting jagged edges or very complex figures may result in an "Out of memory" error. The CLEAR statement may be used to increase the amount of stack space available.

Points that are specified outside the limits of the screen will not be plotted and no error will occur.

See the SCREEN statement for a description of the different screen modes.

Paint Tiling

PAINT tiling is similar to LINE styling. Like LINE, PAINT looks at a tiling mask each time a point is put down on the screen.

If paint attribute is omitted, the standard foreground attribute is used.

If paint attribute is a numeric formula, then the number must be a valid color, and it is used to paint the area as before.

If paint attribute is a string formula, then tiling is performed as follows:

The tile mask is always eight bits wide and may be from 1 to 64 bytes long.

Each byte in the tile string masks eight bits along the x axis when putting down points. Each byte of the tile string is rotated as required to align along the y axis, such that:

tile_byte_mask=y MOD tile_length

where y is the position of the graphics cursor on the y-axis.

tile_length is the length in bytes of the tile string defined by the user (1 to 64 bytes).

This is done so that the tile pattern is replicated uniformly over the entire screen (as if a PAINT (0,0).. were used).

x Increases -->        Bit of Tile Byte
x,y  8 7 6 5 4 3 2 1
0,0 |x|x|x|x|x|x|x|x|  Tile byte 1
0,1 |x|x|x|x|x|x|x|x|  Tile byte 2
0,2 |x|x|x|x|x|x|x|x|  Tile byte 3
.
.
.
0,63 |x|x|x|x|x|x|x|x| Tile byte 64
                       (maximum allowed)

In high-resolution mode (SCREEN 2), the screen can be painted with Xs by the following statement:

PAINT (320,100),CHR$(&H81)+CHR$(&H42)+CHR$(&H24)+CHR$(&H18)+CHR$(&H18)+CHR$(&H24)+CHR$(&H81)

This appears on the screen as follows:

x increases -->
0,0 |x| | | | | | |x|  CHR$(&H81)  Tile byte 1
0,1 | |x| | | | |x| |  CHR$(&H42)  Tile byte 2
0,2 | | |x| | |x| | |  CHR$(&H24)  Tile byte 3
0,3 | | | |x|x| | | |  CHR$(&H18)  Tile byte 4
0,4 | | | |x|x| | | |  CHR$(&H18)  Tile byte 5
0,5 | | |x| | |x| | |  CHR$(&H24)  Tile byte 6
0,6 | |x| | | | |x| |  CHR$(&H42)  Tile byte 7
0,7 |x| | | | | | |x|  CHR$(&H81)  Tile byte 8

Since there are two bits per pixel in medium-resolution mode (SCREEN 1), each byte of the tile pattern only describes four pixels. In this case, every two bits of the tile byte describes one of the four possible colors associated with each of the four pixels to be put down.

bckgrnd attribute specifies the background tile pattern or color byte to skip when checking for boundary termination. bckgrnd attribute is a string formula returning one character. When omitted, the default is CHR$(0).

Occasionally, you may want to paint tile over an already painted area that is the same color as two consecutive lines in the tile pattern. PAINT quits when it encounters two consecutive lines of the same color as the point being set (the point is surrounded). It is not possible to draw alternating blue and red lines on a red background without bckgrnd attribute. PAINT stops as soon as the first red pixel is drawn. By specifying red (CHR$(&HAA)) as the background attribute, the red line is drawn over the red background.

You cannot specify more than two consecutive bytes in the tile string that match the background attribute. Specifying more than two results in an "Illegal function call" error.

Examples:

10 CLS
20 SCREEN 1
30 LINE (0, 0)-(100, 150), 2, B
40 PAINT (50, 50), 1, 2
50 LOCATE 20, 1

The PAINT statement in line 40 fills in the box drawn in line 30 with  color 1.

1