forked from notsecure/uTox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
svg.c
622 lines (524 loc) · 21.7 KB
/
svg.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
#include "main.h"
#include "math.h"
#define SQRT2 1.41421356237309504880168872420969807856967187537694807317667973799
static uint8_t pixel(double d) {
if(d >= 1.0) {
return 0;
} else if(d <= 0.0) {
return 0xFF;
} else {
return (1.0 - d) * 255.0;
}
}
static uint8_t pixelmin(double d, uint8_t p) {
if(d >= 1.0) {
return p;
} else if(d <= 0.0) {
return 0;
} else {
uint8_t value = d * 255.0;
if(value >= p) {
return p;
} else {
return value;
}
}
}
static uint8_t pixelmax(double d, uint8_t p) {
if(d >= 1.0) {
return p;
} else if(d <= 0.0) {
return 0xFF;
} else {
uint8_t value = (1.0 - d) * 255.0;
if(value >= p) {
return value;
} else {
return p;
}
}
}
static void drawrectrounded(uint8_t *data, int width, int height, int radius)
{
int x, y;
double hw = (double)radius - 0.5;
for(y = 0; y != height; y++) {
for(x = 0; x != width; x++) {
if((x < radius || x >= width - radius) && (y < radius || y >= height - radius)) {
double dx, dy;
dx = (x < radius) ? x - hw : x + hw - width + 1.0;
dy = (y < radius) ? y - hw : y + hw - height + 1.0;
double d = sqrt(dx * dx + dy * dy) - hw;
*data++ = pixel(d);
} else {
*data++ = 0xFF;
}
}
}
}
static void drawrectroundedex(uint8_t *data, int width, int height, int radius, uint8_t flags)
{
_Bool c1 = ((flags & 1) != 0);
_Bool c2 = ((flags & 2) != 0);
_Bool c3 = ((flags & 4) != 0);
_Bool c4 = ((flags & 8) != 0);
int x, y;
double hw = (double)radius - 0.5;
for(y = 0; y != height; y++) {
for(x = 0; x != width; x++) {
if(((c1 && x < radius) || (c2 && x >= width - radius)) && ((c3 && y < radius) || (c4 && y >= height - radius))) {
double dx, dy;
dx = (x < radius) ? x - hw : x + hw - width + 1.0;
dy = (y < radius) ? y - hw : y + hw - height + 1.0;
double d = sqrt(dx * dx + dy * dy) - hw;
*data++ = pixel(d);
} else {
*data++ = 0xFF;
}
}
}
}
static void drawrectroundedsub(uint8_t *p, int width, int height, int sx, int sy, int sw, int sh, int radius)
{
int x, y;
double hw = (double)radius - 0.5;
for(y = sy; y != sy + sh; y++) {
for(x = sx; x != sx + sw; x++) {
uint8_t *data = &p[y * width + x];
x -= sx;
y -= sy;
if((x < radius || x >= sw - radius) && (y < radius || y >= sh - radius)) {
double dx, dy;
dx = (x < radius) ? x - hw : x + hw - sw + 1.0;
dy = (y < radius) ? y - hw : y + hw - sh + 1.0;
double d = sqrt(dx * dx + dy * dy) - hw;
*data = pixel(d);
} else {
*data = 0xFF;
}
x += sx;
y += sy;
}
}
}
static void drawrectroundedneg(uint8_t *p, int width, int height, int sx, int sy, int sw, int sh, int radius)
{
int x, y;
double hw = (double)radius - 0.5;
for(y = sy; y != sy + sh; y++) {
for(x = sx; x != sx + sw; x++) {
uint8_t *data = &p[y * width + x];
x -= sx;
y -= sy;
if((x < radius || x >= sw - radius) && (y < radius || y >= sh - radius)) {
double dx, dy;
dx = (x < radius) ? x - hw : x + hw - sw + 1.0;
dy = (y < radius) ? y - hw : y + hw - sh + 1.0;
double d = sqrt(dx * dx + dy * dy) - hw;
*data = 0xFF - pixel(d);
} else {
*data = 0;
}
x += sx;
y += sy;
}
}
}
static void drawcircle(uint8_t *data, int width)
{
int x, y;
double hw = (double)width / 2.0 - 0.5;
for(y = 0; y != width; y++) {
for(x = 0; x != width; x++) {
double dx = (x - hw), dy = (y - hw);
double d = sqrt(dx * dx + dy * dy) - hw + 0.5;
*data++ = pixel(d);
}
}
}
static void drawnewcircle(uint8_t *data, int width, int height, double cx, double cy, double subwidth)
{
int x, y;
double hw = cx - 0.5, vw = cy - 0.5, sw = (double)subwidth / 2.0;
for(y = 0; y != height; y++) {
for(x = 0; x != width; x++) {
double dx = (x - hw), dy = (y - vw);
double d = sqrt(dx * dx + dy * dy) - sw;
*data = pixelmax(d, *data); data++;
}
}
}
static void drawnewcircle2(uint8_t *data, int width, int height, double cx, double cy, double subwidth, uint8_t flags)
{
int x, y;
double hw = cx - 0.5, vw = cy - 0.5, sw = (double)subwidth / 2.0;
_Bool b = (flags & 1) != 0;
for(y = 0; y != height; y++) {
for(x = 0; x != width; x++) {
double dx = (x - hw), dy = (y - vw);
if(b && dy > 0) {
dy *= 1.25;
}
if(!b && dx > 0) {
dx *= 1.25;
}
double d = sqrt(dx * dx + dy * dy) - sw;
if((b && dx < 0) || (!b && dy < 0)) {
*data++ = pixel(d);
} else {
*data = pixelmax(d, *data); data++;
}
}
}
}
static void drawhead(uint8_t *data, int width, double cx, double cy, double subwidth)
{
int x, y;
double hw = (double)cx - 0.5, vw = (double)cy - 0.5, sw = (double)subwidth / 2.0;
for(y = 0; y != width; y++) {
for(x = 0; x != width; x++) {
double dx = (x - hw), dy = (y - vw);
if(dy > 0) {
dy *= 0.75;
}
double d = sqrt(dx * dx + dy * dy) - sw;
*data = pixelmax(d, *data); data++;
}
}
}
static void drawsubcircle(uint8_t *data, int width, int height, double cx, double cy, double subwidth)
{
int x, y;
double hw = cx - 0.5, vw = cy - 0.5, sw = subwidth / 2.0;
for(y = 0; y != height; y++) {
for(x = 0; x != width; x++) {
double dx = (x - hw), dy = (y - vw);
double d = sqrt(dx * dx + dy * dy) - sw;
*data = pixelmin(d, *data); data++;
}
}
}
static void drawcross(uint8_t *data, int width)
{
int x, y;
double hw = 0.5 * (double)(width - 1);
double w = 0.0625 * (double)width;
for(y = 0; y != width; y++) {
for(x = 0; x != width; x++) {
double dx = fabs(x - hw), dy = fabs(y - hw);
double d = fmin(dx, dy) - w;
*data++ = pixel(d);
}
}
}
static void drawxcross(uint8_t *data, int width, int height, int radius)
{
int x, y;
double cx = 0.5 * (double)(width - 1);
double cy = 0.5 * (double)(height - 1);
double w = 0.0625 * (double)radius;
for(y = 0; y != height; y++) {
for(x = 0; x != width; x++) {
double dx = (double)x - cx, dy = (double)y - cy;
double d1 = (SQRT2 / 2.0) * fabs(dx + dy), d2 = (SQRT2 / 2.0) * fabs(dx - dy);
double d = fmin(d1, d2) - w;
d = fmax(fabs(dx) + fabs(dy) - (SQRT2 / 2.0) * (double)height - w, d);
*data = pixelmax(d, *data); data++;
}
}
}
static void drawline(uint8_t *data, int width, int height, double sx, double sy, double span, double radius)
{
int x, y;
double cx = sx - 0.5, cy = sy - 0.5;
for(y = 0; y != height; y++) {
for(x = 0; x != width; x++) {
double dx = (double)x - cx, dy = (double)y - cy;
double d = (SQRT2 / 2.0) * fabs(dx + dy) - radius;
d = fmax(fabs(dx) + fabs(dy) - (SQRT2 / 2.0) * (double)span - radius, d);
*data = pixelmax(d, *data); data++;
}
}
}
static void drawlinedown(uint8_t *data, int width, int height, double sx, double sy, double span, double radius)
{
int x, y;
double cx = sx - 0.5, cy = sy - 0.5;
for(y = 0; y != height; y++) {
for(x = 0; x != width; x++) {
double dx = (double)x - cx, dy = (double)y - cy;
double d = (SQRT2 / 2.0) * fabs(dx - dy) - radius;
d = fmax(fabs(dx) + fabs(dy) - (SQRT2 / 2.0) * (double)span - radius, d);
*data = pixelmax(d, *data); data++;
}
}
}
static void drawlinevert(uint8_t *data, int width, int height, double sx, double w)
{
int x, y;
double cx = sx + w / 2.0 - 0.5;
for(y = 0; y != height; y++) {
for(x = 0; x != width; x++) {
double d = fabs((double)x - cx) - w / 2.0;
*data = pixelmax(d, *data); data++;
}
}
}
static void drawtri(uint8_t *data, int width, int height, double sx, double sy, double size, uint8_t dir)
{
int x, y;
double cx = sx - 0.5, cy = sy - 0.5;
for(y = 0; y != height; y++) {
for(x = 0; x != width; x++) {
double dx = (double)x - cx, dy = (double)y - cy;
if(!dir) {
if(dx < 0.0 && dy > 0.0) {
double d = -dx + dy - size;
*data = pixelmax(d, *data);
}
} else {
if(dx > 0.0 && dy < 0.0) {
double d = dx - dy - size;
*data = pixelmax(d, *data);
}
}
data++;
}
}
}
static void drawlineround(uint8_t *data, int width, int height, double sx, double sy, double span, double radius, double subwidth, uint8_t flags)
{
int x, y;
double cx = sx - 0.5, cy = sy - 0.5, sw = (double)subwidth / 2.0;
for(y = 0; y != height; y++) {
for(x = 0; x != width; x++) {
double dx = (double)x - cx, dy = (double)y - cy;
double d = (SQRT2 / 2.0) * fabs(dx + dy) - radius;
d = fmax(fabs(dx) + fabs(dy) - (SQRT2 / 2.0) * (double)span - radius, d);
double ddx, ddy, d2;
if(!flags) {
ddx = (double)x - cx - span * SQRT2; ddy = (double)y - cy + span * SQRT2;
d2 = sqrt(ddx * ddx + ddy * ddy) - sw;
d = fmin(d, d2);
}
ddx = (double)x - cx + span * SQRT2; ddy = (double)y - cy - span * SQRT2;
d2 = sqrt(ddx * ddx + ddy * ddy) - sw;
d = fmin(d, d2);
*data = pixelmax(d, *data); data++;
}
}
}
static void drawlineroundempty(uint8_t *data, int width, int height, double sx, double sy, double span, double radius, double subwidth)
{
int x, y;
double cx = sx - 0.5, cy = sy - 0.5, sw = (double)subwidth / 2.0;
for(y = 0; y != height; y++) {
for(x = 0; x != width; x++) {
double dx = (double)x - cx, dy = (double)y - cy;
double d = (SQRT2 / 2.0) * fabs(dx + dy) - radius;
d = fmax(fabs(dx) + fabs(dy) - (SQRT2 / 2.0) * (double)span - radius, d);
double ddx = (double)x - cx - span * SQRT2 , ddy = (double)y - cy + span * SQRT2;
double d2 = sqrt(ddx * ddx + ddy * ddy) - sw;
d = fmin(d, d2);
ddx = (double)x - cx + span * SQRT2; ddy = (double)y - cy - span * SQRT2;
d2 = sqrt(ddx * ddx + ddy * ddy) - sw;
d = fmin(d, d2);
*data = pixelmin(d, *data); data++;
}
}
}
static void drawgroup(uint8_t *data, int width)
{
double s = (double)width / BM_CONTACT_WIDTH;
drawnewcircle(data, width, s * 9 * SCALE, s * 5 * SCALE, s * 9 * SCALE, s * 7.5 * SCALE);
drawnewcircle(data, width, s * 9 * SCALE, s * 15 * SCALE, s * 9 * SCALE, s * 7.5 * SCALE);
drawsubcircle(data, width, width, s * 5 * SCALE, s * 4 * SCALE, s * 5.5 * SCALE);
drawsubcircle(data, width, width, s * 15 * SCALE, s * 4 * SCALE, s * 5.5 * SCALE);
drawhead(data, width, s * 5 * SCALE, s * 3 * SCALE, s * 4.5 * SCALE);
drawhead(data, width, s * 15 * SCALE, s * 3 * SCALE, s * 4.5 * SCALE);
drawnewcircle(data, width, s * 20 * SCALE, s * 10 * SCALE, s * 20 * SCALE, s * 14.5 * SCALE);
drawsubcircle(data, width, width, s * 10 * SCALE, s * 12 * SCALE, s * 6.5 * SCALE);
drawsubcircle(data, width, width, s * 10 * SCALE, s * 8 * SCALE, s * 9.5 * SCALE);
drawhead(data, width, s * 10 * SCALE, s * 8 * SCALE, s * 7.5 * SCALE);
}
_Bool svg_draw(_Bool needmemory)
{
int size, s;
void *p;
if(svg_data) {
free(svg_data);
}
/* Build what we expect the size to be. */
size = SCROLL_WIDTH * SCROLL_WIDTH +
BM_STATUSAREA_WIDTH * BM_STATUSAREA_HEIGHT +
/* Panel buttons */
BM_ADD_WIDTH * BM_ADD_WIDTH * 4 +
BM_CONTACT_WIDTH * BM_CONTACT_WIDTH * 2 +
BM_LBICON_WIDTH * BM_LBICON_HEIGHT * 3 + // file, call, video
BM_STATUS_WIDTH * BM_STATUS_WIDTH * 4 +
BM_STATUS_NOTIFY_WIDTH * BM_STATUS_NOTIFY_WIDTH +
BM_LBUTTON_WIDTH * BM_LBUTTON_HEIGHT +
BM_SBUTTON_WIDTH * BM_SBUTTON_HEIGHT +
/* File transfer */
BM_FT_WIDTH * BM_FT_HEIGHT + BM_FTM_WIDTH * BM_FT_HEIGHT +
(BM_FTB_WIDTH * (BM_FTB_HEIGHT + SCALE) + BM_FTB_WIDTH * BM_FTB_HEIGHT) +
BM_FB_WIDTH * BM_FB_HEIGHT * 4 +
/* Chat Buttons */
BM_CHAT_BUTTON_WIDTH * (BM_CHAT_BUTTON_HEIGHT + SCALE) * 2 + // Chat button 1, 2
BM_CHAT_SEND_WIDTH * BM_CHAT_SEND_HEIGHT +
BM_CHAT_SEND_OVERLAY_WIDTH * BM_CHAT_SEND_OVERLAY_HEIGHT +
BM_CI_WIDTH * BM_CI_WIDTH;
svg_data = calloc(1, size);
if(!svg_data) {
return 0;
}
p = svg_data;
drawcircle(p, SCROLL_WIDTH);
loadalpha(BM_SCROLLHALFTOP, p, SCROLL_WIDTH, SCROLL_WIDTH / 2);
loadalpha(BM_SCROLLHALFBOT, p + SCROLL_WIDTH * SCROLL_WIDTH / 2, SCROLL_WIDTH, SCROLL_WIDTH / 2);
p += SCROLL_WIDTH * SCROLL_WIDTH;
drawrectrounded(p, BM_STATUSAREA_WIDTH, BM_STATUSAREA_HEIGHT, SCALE * 2);
loadalpha(BM_STATUSAREA, p, BM_STATUSAREA_WIDTH, BM_STATUSAREA_HEIGHT);
p += BM_STATUSAREA_WIDTH * BM_STATUSAREA_HEIGHT;
/* Draw panel Buttons */
s = BM_ADD_WIDTH * BM_ADD_WIDTH;
drawcross(p, BM_ADD_WIDTH);
loadalpha(BM_ADD, p, BM_ADD_WIDTH, BM_ADD_WIDTH);
p += s;
drawgroup(p, BM_ADD_WIDTH);
loadalpha(BM_GROUPS, p, BM_ADD_WIDTH, BM_ADD_WIDTH);
p += s;
drawline(p, BM_ADD_WIDTH, BM_ADD_WIDTH, SCALE * 3, SCALE * 3, SCALE * 5, 0.75 * SCALE);
drawline(p, BM_ADD_WIDTH, BM_ADD_WIDTH, SCALE * 6, SCALE * 6, SCALE * 5, 0.75 * SCALE);
drawtri(p, BM_ADD_WIDTH, BM_ADD_WIDTH, 6 * SCALE, 0, 4 * SCALE, 0);
drawtri(p, BM_ADD_WIDTH, BM_ADD_WIDTH, 3 * SCALE, 9 * SCALE, 4 * SCALE, 1);
loadalpha(BM_TRANSFER, p, BM_ADD_WIDTH, BM_ADD_WIDTH);
p += s;
drawcross(p, BM_ADD_WIDTH);
drawxcross(p, BM_ADD_WIDTH, BM_ADD_WIDTH, BM_ADD_WIDTH);
drawnewcircle(p, BM_ADD_WIDTH, BM_ADD_WIDTH, 0.5 * BM_ADD_WIDTH, 0.5 * BM_ADD_WIDTH, 7 * SCALE);
drawsubcircle(p, BM_ADD_WIDTH, BM_ADD_WIDTH, 0.5 * BM_ADD_WIDTH, 0.5 * BM_ADD_WIDTH, 3 * SCALE);
loadalpha(BM_SETTINGS, p, BM_ADD_WIDTH, BM_ADD_WIDTH);
p += s;
s = BM_CONTACT_WIDTH * BM_CONTACT_WIDTH;
drawnewcircle(p, BM_CONTACT_WIDTH, 18 * SCALE, 10 * SCALE, 18 * SCALE, 14 * SCALE);
drawsubcircle(p, BM_CONTACT_WIDTH, BM_CONTACT_WIDTH, 10 * SCALE, 10 * SCALE, 6 * SCALE);
drawhead(p, BM_CONTACT_WIDTH, 10 * SCALE, 6 * SCALE, 8 * SCALE);
loadalpha(BM_CONTACT, p, BM_CONTACT_WIDTH, BM_CONTACT_WIDTH);
p += s;
drawgroup(p, BM_CONTACT_WIDTH);
loadalpha(BM_GROUP, p, BM_CONTACT_WIDTH, BM_CONTACT_WIDTH);
p += s;
/* Draw button icon overlays. */
s = BM_LBICON_WIDTH * BM_LBICON_HEIGHT;
drawlineround(p, BM_LBICON_WIDTH, BM_LBICON_HEIGHT, 5.5 * SCALE, 5 * SCALE, 1 * SCALE, 3.85 * SCALE, 6.6 * SCALE, 0);
drawlineroundempty(p, BM_LBICON_WIDTH, BM_LBICON_HEIGHT, 5.5 * SCALE, 5 * SCALE, 1 * SCALE, 2.4 * SCALE, 4.5 * SCALE);
drawsubcircle(p, BM_LBICON_WIDTH, BM_LBICON_HEIGHT, 6.0 * SCALE, 8.1 * SCALE, 2.5 * SCALE);
drawlineround(p, BM_LBICON_WIDTH, BM_LBICON_HEIGHT, 7.0 * SCALE, 5.40 * SCALE, 0.5 * SCALE, 2.2 * SCALE, 3.75 * SCALE, 1);
drawlineroundempty(p, BM_LBICON_WIDTH, BM_LBICON_HEIGHT, 7.25 * SCALE, 5.15 * SCALE, 0.75 * SCALE, 0.75 * SCALE, 1.5 * SCALE);
loadalpha(BM_FILE, p, BM_LBICON_WIDTH, BM_LBICON_HEIGHT);
p += s;
drawnewcircle(p, BM_LBICON_WIDTH, BM_LBICON_HEIGHT, SCALE, 0, 19 * SCALE);
drawsubcircle(p, BM_LBICON_WIDTH, BM_LBICON_HEIGHT, SCALE, 0, 15 * SCALE);
drawnewcircle2(p, BM_LBICON_WIDTH, BM_LBICON_HEIGHT, 9 * SCALE, 2 * SCALE, 3 * SCALE, 0);
drawnewcircle2(p, BM_LBICON_WIDTH, BM_LBICON_HEIGHT, 3 * SCALE, 8 * SCALE, 3 * SCALE, 1);
loadalpha(BM_CALL, p, BM_LBICON_WIDTH, BM_LBICON_HEIGHT);
p += s;
int x, y;
uint8_t *data = p;
for(y = 0; y != BM_LBICON_HEIGHT; y++) {
for(x = 0; x != SCALE * 4; x++) {
double d = fabs(y - 4.5 * SCALE) - 0.66 * (SCALE * 4 - x);
*data++ = pixel(d);
}
data += BM_LBICON_WIDTH - SCALE * 4;
}
drawrectroundedsub(p, BM_LBICON_WIDTH, BM_LBICON_HEIGHT, 4 * SCALE, SCALE, 7 * SCALE, 7 * SCALE, SCALE);
loadalpha(BM_VIDEO, p, BM_LBICON_WIDTH, BM_LBICON_HEIGHT);
p += s;
/* Draw user status Buttons */
s = BM_STATUS_WIDTH * BM_STATUS_WIDTH;
drawcircle(p, BM_STATUS_WIDTH);
loadalpha(BM_ONLINE, p, BM_STATUS_WIDTH, BM_STATUS_WIDTH);
p += s;
drawcircle(p, BM_STATUS_WIDTH);
drawsubcircle(p, BM_STATUS_WIDTH, BM_STATUS_WIDTH / 2, 0.5 * BM_STATUS_WIDTH, 0.5 * BM_STATUS_WIDTH, 3 * SCALE);
loadalpha(BM_AWAY, p, BM_STATUS_WIDTH, BM_STATUS_WIDTH);
p += s;
drawcircle(p, BM_STATUS_WIDTH);
drawsubcircle(p, BM_STATUS_WIDTH, BM_STATUS_WIDTH / 2, 0.5 * BM_STATUS_WIDTH, 0.5 * BM_STATUS_WIDTH, 3 * SCALE);
loadalpha(BM_BUSY, p, BM_STATUS_WIDTH, BM_STATUS_WIDTH);
p += s;
drawcircle(p, BM_STATUS_WIDTH);
drawsubcircle(p, BM_STATUS_WIDTH, BM_STATUS_WIDTH, 0.5 * BM_STATUS_WIDTH, 0.5 * BM_STATUS_WIDTH, 3 * SCALE);
loadalpha(BM_OFFLINE, p, BM_STATUS_WIDTH, BM_STATUS_WIDTH);
p += s;
drawcircle(p, BM_STATUS_NOTIFY_WIDTH);
drawsubcircle(p, BM_STATUS_NOTIFY_WIDTH, BM_STATUS_NOTIFY_WIDTH, 0.5 * BM_STATUS_NOTIFY_WIDTH, 0.5 * BM_STATUS_NOTIFY_WIDTH, 5 * SCALE);
loadalpha(BM_STATUS_NOTIFY, p, BM_STATUS_NOTIFY_WIDTH, BM_STATUS_NOTIFY_WIDTH);
p += BM_STATUS_NOTIFY_WIDTH * BM_STATUS_NOTIFY_WIDTH;
drawrectrounded(p, BM_LBUTTON_WIDTH, BM_LBUTTON_HEIGHT, SCALE * 2);
loadalpha(BM_LBUTTON, p, BM_LBUTTON_WIDTH, BM_LBUTTON_HEIGHT);
p += BM_LBUTTON_WIDTH * BM_LBUTTON_HEIGHT;
drawrectrounded(p, BM_SBUTTON_WIDTH, BM_SBUTTON_HEIGHT, SCALE);
loadalpha(BM_SBUTTON, p, BM_SBUTTON_WIDTH, BM_SBUTTON_HEIGHT);
p += BM_SBUTTON_WIDTH * BM_SBUTTON_HEIGHT;
/* Draw file transfer buttons */
drawrectrounded(p, BM_FT_WIDTH, BM_FT_HEIGHT, SCALE * 2);
loadalpha(BM_FT, p, BM_FT_WIDTH, BM_FT_HEIGHT);
p += BM_FT_WIDTH * BM_FT_HEIGHT;
drawrectroundedex(p, BM_FTM_WIDTH, BM_FT_HEIGHT, SCALE * 2, 13);
loadalpha(BM_FTM, p, BM_FTM_WIDTH, BM_FT_HEIGHT);
p += BM_FTM_WIDTH * BM_FT_HEIGHT;
drawrectroundedex(p, BM_FTB_WIDTH, BM_FTB_HEIGHT + SCALE, SCALE * 2, 6);
loadalpha(BM_FTB1, p, BM_FTB_WIDTH, BM_FTB_HEIGHT + SCALE);
p += BM_FTB_WIDTH * (BM_FTB_HEIGHT + SCALE);
drawrectroundedex(p, BM_FTB_WIDTH, BM_FTB_HEIGHT, SCALE * 2, 10);
loadalpha(BM_FTB2, p, BM_FTB_WIDTH, BM_FTB_HEIGHT);
p += BM_FTB_WIDTH * BM_FTB_HEIGHT;
s = BM_FB_WIDTH * BM_FB_HEIGHT;
drawxcross(p, BM_FB_WIDTH, BM_FB_HEIGHT, BM_FB_HEIGHT);
loadalpha(BM_NO, p, BM_FB_WIDTH, BM_FB_HEIGHT);
p += s;
drawlinevert(p, BM_FB_WIDTH, BM_FB_HEIGHT, 0.75 * SCALE, 1.25 * SCALE);
drawlinevert(p, BM_FB_WIDTH, BM_FB_HEIGHT, 4.25 * SCALE, 1.25 * SCALE);
loadalpha(BM_PAUSE, p, BM_FB_WIDTH, BM_FB_HEIGHT);
p += s;
drawline(p, BM_FB_WIDTH, BM_FB_HEIGHT, SCALE * 1.75, SCALE * 3.5, SCALE * 2.5, 0.5 * SCALE);
drawline(p, BM_FB_WIDTH, BM_FB_HEIGHT, SCALE * 4, SCALE * 3.5, SCALE * 2.5, 0.5 * SCALE);
drawlinedown(p, BM_FB_WIDTH, BM_FB_HEIGHT, SCALE * 1.75, SCALE * 1.75, SCALE * 2.5, 0.5 * SCALE);
drawlinedown(p, BM_FB_WIDTH, BM_FB_HEIGHT, SCALE * 4, SCALE * 1.75, SCALE * 2.5, 0.5 * SCALE);
loadalpha(BM_RESUME, p, BM_FB_WIDTH, BM_FB_HEIGHT);
p += s;
drawline(p, BM_FB_WIDTH, BM_FB_HEIGHT, SCALE * 3.75, SCALE * 2.75, SCALE * 4, 0.5 * SCALE);
drawlinedown(p, BM_FB_WIDTH, BM_FB_HEIGHT, SCALE * 1.9, SCALE * 3.25, SCALE * 2.5, 0.5 * SCALE);
loadalpha(BM_YES, p, BM_FB_WIDTH, BM_FB_HEIGHT);
p += s;
drawrectroundedex(p, BM_CHAT_BUTTON_WIDTH, BM_CHAT_BUTTON_HEIGHT, SCALE * 2, 6);
loadalpha(BM_CB1, p, BM_CHAT_BUTTON_WIDTH, BM_CHAT_BUTTON_HEIGHT);
p += BM_CHAT_BUTTON_WIDTH * BM_CHAT_BUTTON_HEIGHT;
drawrectroundedex(p, BM_CHAT_BUTTON_WIDTH, BM_CHAT_BUTTON_HEIGHT + SCALE, SCALE * 2, 10);
loadalpha(BM_CB2, p, BM_CHAT_BUTTON_WIDTH, BM_CHAT_BUTTON_HEIGHT + SCALE);
p += BM_CHAT_BUTTON_WIDTH * (BM_CHAT_BUTTON_HEIGHT + SCALE);
/* Draw chat send button */
drawrectrounded(p, BM_CHAT_SEND_WIDTH, BM_CHAT_SEND_HEIGHT, 4 * SCALE);
loadalpha(BM_CHAT_SEND, p, BM_CHAT_SEND_WIDTH, BM_CHAT_SEND_HEIGHT);
p += BM_CHAT_SEND_WIDTH * BM_CHAT_SEND_HEIGHT;
/* Draw chat send overlay */
drawnewcircle(p, BM_CHAT_SEND_OVERLAY_WIDTH, BM_CHAT_SEND_OVERLAY_HEIGHT, 10 * SCALE, 9 * SCALE, 15 * SCALE);
drawtri(p, BM_CHAT_SEND_OVERLAY_WIDTH, BM_CHAT_SEND_OVERLAY_HEIGHT, 14 * SCALE, 14 * SCALE, 5 * SCALE, 0);
loadalpha(BM_CHAT_SEND_OVERLAY, p, BM_CHAT_SEND_OVERLAY_WIDTH, BM_CHAT_SEND_OVERLAY_HEIGHT);
p += BM_CHAT_SEND_OVERLAY_WIDTH * BM_CHAT_SEND_OVERLAY_HEIGHT;
drawrectrounded(p, BM_CI_WIDTH, BM_CI_WIDTH, SCALE * 2);
drawrectroundedneg(p, BM_CI_WIDTH, BM_CI_WIDTH, SCALE, SCALE, (_BM_CI_WIDTH - 2) * SCALE, (_BM_CI_WIDTH - 2) * SCALE, 1 * SCALE);
loadalpha(BM_CI1, p, BM_CI_WIDTH, BM_CI_WIDTH);
p += BM_CI_WIDTH * BM_CI_WIDTH;
if(p - svg_data != size) {
debug("something went wrong\n");
}
if(!needmemory) {
free(svg_data);
svg_data = NULL;
}
return 1;
}