draw_quad(BMAP*, VECTOR* vPos, VECTOR* vOffs, VECTOR* vSize, VECTOR* vScale, COLOR* vColor, var alpha, var angle)
Draws a 2D bitmap or color filled rectangle on the screen.
Parameters:
BMAP* - Bitmap to be drawn, or NULL for drawing a filled rectangle.
vPos - Screen XY position for the upper left corner of the rectangle.
vOffs - XY offset into the bitmap in pixels, or NULL for starting with the upper left corner of the bitmap.
vSize - XY size of the bitmap or rectangle in pixels, or NULL for drawing the whole bitmap.
vScale - XY scale factor, or NULL for a scale factor of 1.
When the XY size is larger than the scaled bitmap, the image is tiled.
vColor - BGR color vector of the rectangle resp. color tint for the bitmap, or NULL for no color.
alpha - Opacity of the bitmap or rectangle, 0..100.
angle - Angle of the bitmap or rectangle, counterclockwise in degrees.
The rectangle is rotated about its center.
Speed:
Fast
Remarks:
- The bitmap or rectangle is only visible in the next frame. For displaying it permanently, as if it were a panel, use a while ... wait(1) loop.
- Drawing a quad multiple times with small position, scale, or alpha increments generates a cool blur effect, especially when using a bitmap into which the scene was rendered.
-
For drawing a colored dot at position xy, call draw_quad(NULL,vector(x-size/2,y-size/2,0),NULL,vector(size,size,0),color,alpha,0);.
- The bmap_rendertarget function can be used to draw the quad into a bitmap.
Example (lite-C):
void main()
{
while(1) {
wait(1);
var i;
for(i=1; i<30; i++)
draw_quad(NULL,
vector((screen_size.x-screen_size.y)/2,screen_size.y/2,0),NULL,
vector(screen_size.y,5,0),NULL,
COLOR_RED,0.1*i*i,10*total_ticks+1.5*i);
}
}
See also:
draw_text, draw_point3d, draw_line, draw_begin, bmap_rendertarget
► latest version online