VERSIÓ 1.3.12
- [FIX] La paleta per defecte era tota transparent - [NEW] draw.rrect() i draw.rrectf()
This commit is contained in:
75
mini.cpp
75
mini.cpp
@@ -84,8 +84,8 @@ Uint32 windowID;
|
||||
Uint32 *pixels;
|
||||
int pitch;
|
||||
|
||||
uint32_t palette[256] = { 0x001a1c2c, 0x005d275d, 0x00b13e53, 0x00ef7d57, 0x00ffcd75, 0x00a7f070, 0x0038b764, 0x00257179,
|
||||
0x0029366f, 0x003b5dc9, 0x0041a6f6, 0x0073eff7, 0x00f4f4f4, 0x0094b0c2, 0x00566c86, 0x00333c57 };
|
||||
uint32_t palette[256] = { 0xFF1a1c2c, 0xFF5d275d, 0xFFb13e53, 0xFFef7d57, 0xFFffcd75, 0xFFa7f070, 0xFF38b764, 0xFF257179,
|
||||
0xFF29366f, 0xFF3b5dc9, 0xFF41a6f6, 0xFF73eff7, 0xFFf4f4f4, 0xFF94b0c2, 0xFF566c86, 0xFF333c57 };
|
||||
|
||||
const char base64[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
||||
|
||||
@@ -921,6 +921,77 @@ void circfill(int x, int y, uint8_t r, uint8_t color) {
|
||||
circfill(x, y, r);
|
||||
}
|
||||
|
||||
|
||||
void roundrect(int x, int y, int w, int h, uint8_t r) {
|
||||
int xi=0, yi=r;
|
||||
int d=3-2*r;
|
||||
|
||||
int xf = w+x-1;
|
||||
int yf = h+y-1;
|
||||
int x1 = x+r, y1 = y+r;
|
||||
int x2 = xf-r, y2 = yf-r;
|
||||
hline(x1, y, x2);
|
||||
hline(x1, yf, x2);
|
||||
vline(x, y1, y2);
|
||||
vline(xf, y1, y2);
|
||||
|
||||
while (yi>=xi++) {
|
||||
d += d>0 ? 4*(xi-yi--)+10 : 4*xi+6;
|
||||
pset(x2+xi, y2+yi);
|
||||
pset(x1-xi, y2+yi);
|
||||
pset(x2+xi, y1-yi);
|
||||
pset(x1-xi, y1-yi);
|
||||
pset(x2+yi, y2+xi);
|
||||
pset(x1-yi, y2+xi);
|
||||
pset(x2+yi, y1-xi);
|
||||
pset(x1-yi, y1-xi);
|
||||
}
|
||||
}
|
||||
|
||||
void roundrect(int x, int y, int w, int h, uint8_t r, uint8_t color) {
|
||||
ds::pen_color=color;
|
||||
roundrect(x, y, w, h, r);
|
||||
}
|
||||
|
||||
void roundrectfill(int x, int y, int w, int h, uint8_t r) {
|
||||
int xi=0, yi=r;
|
||||
int d=3-2*r;
|
||||
|
||||
int xf = w+x-1;
|
||||
int yf = h+y-1;
|
||||
int x1 = x+r, y1 = y+r;
|
||||
int x2 = xf-r, y2 = yf-r;
|
||||
for (int i=y1; i<=y2; ++i) hline(x, i, xf);
|
||||
|
||||
while (yi>=xi++) {
|
||||
d += d>0 ? 4*(xi-yi--)+10 : 4*xi+6;
|
||||
hline(x1-xi, y2+yi, x2+xi);
|
||||
hline(x1-xi, y1-yi, x2+xi);
|
||||
hline(x1-yi, y2+xi, x2+yi);
|
||||
hline(x1-yi, y1-xi, x2+yi);
|
||||
}
|
||||
}
|
||||
|
||||
void roundrectfill(int x, int y, int w, int h, uint8_t r, uint8_t color) {
|
||||
ds::pen_color=color;
|
||||
roundrectfill(x, y, w, h, r);
|
||||
}
|
||||
/*
|
||||
void roundrectfill(int x, int y, uint8_t r) {
|
||||
int xi=0, yi=r;
|
||||
int d=3-2*r;
|
||||
(*fun_ptr)(x, y, xi, yi);
|
||||
while (yi>=xi++) {
|
||||
d += d>0 ? 4*(xi-yi--)+10 : 4*xi+6;
|
||||
(*fun_ptr)(x, y, xi, yi);
|
||||
}
|
||||
}
|
||||
|
||||
void roundrectfill(int x, int y, uint8_t r, uint8_t color) {
|
||||
ds::pen_color=color;
|
||||
roundrectfill(x, y, r);
|
||||
}
|
||||
*/
|
||||
void _drawoval(int xc, int yc, int x, int y, float xf, float yf) {
|
||||
pset((xc+x)*xf, (yc+y)*yf);
|
||||
pset((xc-x)*xf, (yc+y)*yf);
|
||||
|
||||
Reference in New Issue
Block a user