B4X:

```
void calldrawrect{
B4R::Array* b;
B4R::Object* o;
char* c = (char*)b->data;
c[0] = 0;
c[1] = 0;
c[2] = 20;
c[3] = 20;
o = b;
B4RdrawRect(o);
}
```

B4X:

```
void B4RdrawRect(B4R::Object* o){
B4R::Array* b = (B4R::Array*)B4R::Object::toPointer(o);
char* c = (char*)b->data;
int x1 = (c[0]);
int y1 = (c[1]);
int x2 = (c[2]);
int y2 = (c[3]);
int tmp;
if (x1>x2)
{
tmp=x1;
x1=x2;
x2=tmp;
}
if (y1>y2)
{
tmp=y1;
y1=y2;
y2=tmp;
}
drawHLine(x1, y1, x2-x1);
drawHLine(x1, y2, x2-x1);
drawVLine(x1, y1, y2-y1);
drawVLine(x2, y1, y2-y1+1);
}
```