libdraw: add Cursor2, a 32x32 high-res cursor

Also add setcursor2, esetcursor2, and draw protocol encoding.
Calls to the old setcursor, esetcursor create a 32x32 by
pixel doubling when needed.
This commit is contained in:
Russ Cox 2018-11-15 20:22:59 -05:00
parent 9af9ceca26
commit 8581c2b567
11 changed files with 86 additions and 7 deletions

View file

@ -12,6 +12,16 @@ struct Cursor
uchar set[2*16];
};
typedef struct Cursor2 Cursor2;
struct Cursor2
{
Point offset;
uchar clr[4*32];
uchar set[4*32];
};
void scalecursor(Cursor2*, Cursor*);
#if defined(__cplusplus)
}
#endif

View file

@ -568,9 +568,10 @@ int mousescrollsize(int);
*/
struct Mouse;
struct Cursor;
struct Cursor2;
int _displaybouncemouse(Display *d, struct Mouse *m);
int _displayconnect(Display *d);
int _displaycursor(Display *d, struct Cursor *c);
int _displaycursor(Display *d, struct Cursor *c, struct Cursor2 *c2);
int _displayinit(Display *d, char *label, char *winsize);
int _displaylabel(Display *d, char *label);
int _displaymoveto(Display *d, Point p);

View file

@ -13,6 +13,9 @@ tag[1] Rmoveto
tag[1] Tcursor cursor[]
tag[1] Rcursor
tag[1] Tcursor2 cursor[]
tag[1] Rcursor2
tag[1] Tbouncemouse x[4] y[4] button[4]
tag[1] Rbouncemouse
@ -89,6 +92,8 @@ enum {
Rtop,
Tresize = 26,
Rresize,
Tcursor2 = 28,
Rcursor2,
Tmax,
};
@ -104,6 +109,7 @@ struct Wsysmsg
Mouse mouse;
int resized;
Cursor cursor;
Cursor2 cursor2;
int arrowcursor;
Rune rune;
char *winsize;

View file

@ -61,7 +61,9 @@ extern int emenuhit(int, Mouse*, Menu*);
extern int eatomouse(Mouse*, char*, int);
extern Rectangle getrect(int, Mouse*);
struct Cursor;
struct Cursor2;
extern void esetcursor(struct Cursor*);
extern void esetcursor2(struct Cursor*, struct Cursor2*);
extern void emoveto(Point);
extern Rectangle egetrect(int, Mouse*);
extern void edrawgetrect(Rectangle, int);

View file

@ -38,7 +38,9 @@ extern void moveto(Mousectl*, Point);
extern int readmouse(Mousectl*);
extern void closemouse(Mousectl*);
struct Cursor;
struct Cursor2;
extern void setcursor(Mousectl*, struct Cursor*);
extern void setcursor2(Mousectl*, struct Cursor*, struct Cursor2*);
extern void drawgetrect(Rectangle, int);
extern Rectangle getrect(int, Mousectl*);
extern int menuhit(int, Mousectl*, Menu*, Screen*);