Hello,
It seems the PG_GROP_SETCLIP is not working (at least for
PG_WIDGET_CANVAS). (After a very quick look in the pgserver source, I
suspect it is not implemented).
Also, using PG_GROP_RECT and PG_GROP_LINE results of a 1 pixel
difference.
See the attached example where the black X is for testing the clip, and
the red + for showing the 1 pixel difference.
Thanks in advance.
Olivier
--
Olivier Bornet SMARTDATA SA
[EMAIL PROTECTED] Centre du Parc
http://www.smartdata.ch av. des Pr�s-Beudin 20
Phone +41-27-723'55'03 1920 Martigny
Fax +41-27-723'55'19 Phone +41-27-723'55'18
#include <picogui.h>
#define X 50
#define Y 50
#define W 50
#define H 50
#define DELTA 20
#define RED 0x00FF0000
#define GREEN 0x0000FF00
#define BLUE 0x000000FF
#define BLACK 0x00000000
#define WHITE 0x00FFFFFF
int main(int argc,char **argv) {
pghandle w;
/* init */
pgInit( argc, argv );
pgRegisterApp( PG_APP_NORMAL, "Canvas Clip", 0 );
w = pgNewWidget( PG_WIDGET_CANVAS, 0, 0 );
/* draw a rectangle representing the clip */
pgWriteCmd( w, PGCANVAS_GROP, 2, PG_GROP_SETCOLOR, BLUE );
pgWriteCmd( w, PGCANVAS_GROP, 5, PG_GROP_RECT, X, Y, W, H );
/* active the clip */
pgWriteCmd( w, PGCANVAS_GROP, 5, PG_GROP_SETCLIP, X, Y, W, H );
/* draw a X wich go outside the clip region */
pgWriteCmd( w, PGCANVAS_GROP, 2, PG_GROP_SETCOLOR, BLACK );
pgWriteCmd( w, PGCANVAS_GROP, 5, PG_GROP_LINE,
X - DELTA, Y - DELTA,
W + 2 * DELTA, H + 2 * DELTA );
pgWriteCmd( w, PGCANVAS_GROP, 5, PG_GROP_LINE,
X - DELTA, Y + H + DELTA,
W + 2 * DELTA, -( H + 2 * DELTA ));
/* draw a + excactly in the region */
pgWriteCmd( w, PGCANVAS_GROP, 2, PG_GROP_SETCOLOR, RED );
pgWriteCmd( w, PGCANVAS_GROP, 5, PG_GROP_LINE, X + W / 2, Y, 0, H );
pgWriteCmd( w, PGCANVAS_GROP, 5, PG_GROP_LINE, X, Y + H / 2, W, 0 );
/* main loop */
pgEventLoop();
}