bRect

Syntax

int fm_bRect(int x, int y, int centerx, int centery, int radiusx, int radiusy)

Arguments

x, y
Current x and y coordinates in the image
centerx, centery
Center coordinates of the circle
radiusx, radiusy
Horizontal and vertical radius of the rectangle

Return

If the supplied x and y values lie within the defined rectangle a value of 1 will be returned, otherwise 0.

Description

Lets you easily draw a rectangle on the image.

Example

%ffp 

ctl(0): "Center X",range=(0,255),val=128
ctl(1): "Center Y",range=(0,255),val=128
ctl(2): "Radius X",range=(0,128),val=64
ctl(3): "Radius Y",range=(0,128),val=64

ForEveryTile:
{

	int Draw;

	setCtlRange(0,0,X);
	setCtlRange(1,0,Y);
	setCtlRange(2,0,X);
	setCtlRange(3,0,Y);

	for (y=y_start; y<y_end; y++){
		updateProgress(y,y_end);
	for (x=x_start; x<x_end; x++){ 

		Draw= bRect (x,y,ctl(0),ctl(1),ctl(2),ctl(3));

	for (z=0; z<Z; z++){ 

		if (Draw) pset(x,y,z,255);

	}}}

	return true;
}

Also see

bCircle, bRect2, bTriangle

Comments

Everyone can add his comments about his experiences with this function here. Tips for using it are welcome, too.