My favorites | Sign in
Project Home Downloads Source
Checkout   Browse   Changes    
 
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
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
#include "Draw.h"

NAMESPACE_UPP

Image WithHotSpots(const Image& m, int x1, int y1, int x2, int y2)
{
Image h = m;
ImageBuffer b(h);
b.SetHotSpot(Point(x1, y1));
b.Set2ndSpot(Point(x2, y2));
return b;
}

Image WithHotSpot(const Image& m, int x1, int y1)
{
Image h = m;
ImageBuffer b(h);
b.SetHotSpot(Point(x1, y1));
return b;
}

Image CreateImage(Size sz, const RGBA& rgba)
{
ImageBuffer ib(sz);
Fill(~ib, rgba, ib.GetLength());
return ib;
}

Image CreateImage(Size sz, Color color)
{
return CreateImage(sz, (RGBA)color);
}

Size DstSrc(ImageBuffer& dest, Point& p, const Image& src, Rect& sr)
{
if(p.x < 0) {
sr.left += -p.x;
p.x = 0;
}
if(p.y < 0) {
sr.top += -p.y;
p.y = 0;
}
sr = sr & src.GetSize();
Size sz = dest.GetSize() - p;
sz.cx = min(sz.cx, sr.GetWidth());
sz.cy = min(sz.cy, sr.GetHeight());
return sz;
}

void DstSrcOp(ImageBuffer& dest, Point p, const Image& src, const Rect& srect,
void (*op)(RGBA *t, const RGBA *s, int n))
{
Rect sr = srect;
Size sz = DstSrc(dest, p, src, sr);
if(sz.cx > 0)
while(--sz.cy >= 0)
(*op)(dest[p.y++] + p.x, src[sr.top++] + sr.left, sz.cx);
}

void Copy(ImageBuffer& dest, Point p, const Image& src, const Rect& srect)
{
DstSrcOp(dest, p, src, srect, Copy);
}

void Over(ImageBuffer& dest, Point p, const Image& src, const Rect& srect)
{
DstSrcOp(dest, p, src, srect, AlphaBlend);
}

void OverStraightOpaque(ImageBuffer& dest, Point p, const Image& src, const Rect& srect)
{
DstSrcOp(dest, p, src, srect, AlphaBlendStraightOpaque);
}

void Copy(Image& dest, Point p, const Image& _src, const Rect& srect)
{
Image src = _src;
ImageBuffer b(dest);
Copy(b, p, src, srect);
dest = b;
}

void Over(Image& dest, Point p, const Image& _src, const Rect& srect)
{
Image src = _src;
ImageBuffer b(dest);
Over(b, p, src, srect);
dest = b;
}

void OverStraightOpaque(Image& dest, Point p, const Image& _src, const Rect& srect)
{
Image src = _src;
ImageBuffer b(dest);
OverStraightOpaque(b, p, src, srect);
dest = b;
}

void Crop(RasterEncoder& tgt, Raster& img, const Rect& rc)
{
Rect r = rc & img.GetSize();
tgt.Create(r.Size(), img);
for(int y = r.top; y < r.bottom; y++)
tgt.WriteLine(~img[y] + r.left);
}

Image Crop(const Image& img, const Rect& rc)
{
if(rc.left == 0 && rc.top == 0 && rc.Size() == img.GetSize())
return img;
if((rc & img.GetSize()).IsEmpty())
return Image();
ImageRaster src(img);
ImageEncoder tgt;
Crop(tgt, src, rc);
return tgt;
}

Image Crop(const Image& img, int x, int y, int cx, int cy)
{
return Crop(img, RectC(x, y, cx, cy));
}

Image ColorMask(const Image& src, Color key)
{
ImageBuffer ib(src.GetSize());
const RGBA *s = src;
const RGBA *e = src + src.GetLength();
RGBA *t = ~ib;
byte kr = key.GetR();
byte kg = key.GetG();
byte kb = key.GetB();
while(s < e) {
if(s->r == kr && s->g == kg && s->b == kb)
*t++ = RGBAZero();
else
*t++ = *s;
s++;
}
ib.SetHotSpots(src);
return ib;
}

void CanvasSize(RasterEncoder& tgt, Raster& img, int cx, int cy)
{
tgt.Create(cx, cy, img);
int ccx = min(img.GetWidth(), cx);
int ccy = min(img.GetHeight(), cy);
for(int y = 0; y < ccy; y++) {
memcpy(~tgt, img[y], ccx * sizeof(RGBA));
memset(~tgt + ccx, 0, (cx - ccx) * sizeof(RGBA));
tgt.WriteLine();
}
for(int y = cy - ccy; --y >= 0;) {
memset(~tgt, 0, cx * sizeof(RGBA));
tgt.WriteLine();
}
}

Image CanvasSize(const Image& img, int cx, int cy)
{
ImageRaster src(img);
ImageEncoder tgt;
CanvasSize(tgt, src, cx, cy);
return tgt;
}

Image AssignAlpha(const Image& img, const Image& alpha)
{
Size sz = Size(min(img.GetWidth(), alpha.GetWidth()),
min(img.GetHeight(), alpha.GetHeight()));
if(sz.cx == 0 || sz.cy == 0)
return Image();
ImageBuffer ib(sz);
for(int y = 0; y < sz.cy; y++) {
const RGBA *s = img[y];
const RGBA *e = s + sz.cx;
const RGBA *a = alpha[y];
RGBA *t = ib[y];
while(s < e) {
*t = *s++;
(t++)->a = (a++)->a;
}
}
ib.SetHotSpots(img);
return ib;
}

int EqualightCh(int c, int l, int h)
{
return Saturate255((c - l) * 255 / (h - l) + l);
}

Image Equalight(const Image& img, int thold)
{
int histogram[256];
ZeroArray(histogram);
const RGBA *s = ~img;
const RGBA *e = s + img.GetLength();
while(s < e) {
histogram[Grayscale(*s)]++;
s++;
}
int n = (thold * img.GetLength()) >> 8;
int h = 255;
int l = 0;
while(l < h) {
if(n < 0)
break;
n -= histogram[l++];
if(n < 0)
break;
n -= histogram[h--];
}
if(l >= h)
return img;
ImageBuffer w(img.GetSize());
RGBA *t = w;
s = ~img;
while(s < e) {
t->r = EqualightCh(s->r, l, h);
t->g = EqualightCh(s->g, l, h);
t->b = EqualightCh(s->b, l, h);
t->a = s->a;
s++;
t++;
}
w.SetHotSpots(img);
return w;
}

Image Grayscale(const Image& img)
{
const RGBA *s = ~img;
const RGBA *e = s + img.GetLength();
ImageBuffer w(img.GetSize());
RGBA *t = w;
while(s < e) {
int q = Grayscale(*s);
t->r = q;
t->g = q;
t->b = q;
t->a = s->a;
t++;
s++;
}
w.SetHotSpots(img);
return w;
}

Image Grayscale(const Image& img, int amount)
{
const RGBA *s = ~img;
const RGBA *e = s + img.GetLength();
ImageBuffer w(img.GetSize());
RGBA *t = w;
int na = 256 - amount;
while(s < e) {
int q = Grayscale(*s);
t->r = Saturate255((amount * q + na * s->r) >> 8);
t->g = Saturate255((amount * q + na * s->g) >> 8);
t->b = Saturate255((amount * q + na * s->b) >> 8);
t->a = s->a;
t++;
s++;
}
w.SetHotSpots(img);
return w;
}

Image Colorize(const Image& img, Color color, int alpha)
{
const RGBA *s = ~img;
const RGBA *e = s + img.GetLength();
ImageBuffer w(img.GetSize());
Unmultiply(w);
RGBA *t = w;
byte r = color.GetR();
byte g = color.GetG();
byte b = color.GetB();
alpha = alpha + (alpha >> 7);
while(s < e) {
int ga = Grayscale(*s);
ga = ga + (ga >> 7);
t->r = (alpha * (((ga * r) >> 8) - s->r) >> 8) + s->r;
t->g = (alpha * (((ga * g) >> 8) - s->g) >> 8) + s->g;
t->b = (alpha * (((ga * b) >> 8) - s->b) >> 8) + s->b;
t->a = s->a;
t++;
s++;
}
Premultiply(w);
w.SetHotSpots(img);
return w;
}

Image AdjustForDarkBk(const Image& img)
{
const RGBA *s = ~img;
const RGBA *e = s + img.GetLength();
ImageBuffer w(img.GetSize());
RGBA *t = w;
while(s < e) {
RGBA h = *s;
Unmultiply(&h, &h, 1);
int q = Grayscale(*s);
if(q < 40) {
int lvl0 = max(s->r, max(s->g, s->b));
int l = 255 - lvl0;
t->r = Saturate255(l + s->r);
t->g = Saturate255(l + s->g);
t->b = Saturate255(l + s->b);
}
else
if(q > 216) {
int lvl0 = min(s->r, min(s->g, s->b));
int l = 255 - lvl0;
t->r = Saturate255(l + s->r - lvl0);
t->g = Saturate255(l + s->g - lvl0);
t->b = Saturate255(l + s->b - lvl0);
}
else {
t->r = s->r;
t->g = s->g;
t->b = s->b;
}
t->a = s->a;
t++;
s++;
}
Premultiply(w);
w.SetHotSpots(img);
return w;
}

inline
byte ContrastCh(int amount, int ch)
{
return Saturate255(128 + (amount * (ch - 128) >> 8));
}

Image Contrast(const Image& img, int amount)
{
const RGBA *s = ~img;
const RGBA *e = s + img.GetLength();
ImageBuffer w(img.GetSize());
Unmultiply(w);
RGBA *t = w;
while(s < e) {
t->r = ContrastCh(amount, s->r);
t->g = ContrastCh(amount, s->g);
t->b = ContrastCh(amount, s->b);
t->a = s->a;
t++;
s++;
}
Premultiply(w);
w.SetHotSpots(img);
return w;
}

void sLine(RGBA *t, int cx, const RasterLine l[3], ImageFilter9& filter)
{
RGBA h[3][3];
const RGBA *x[3];
x[0] = h[0];
x[1] = h[1];
x[2] = h[2];
if(cx == 1) {
h[0][0] = l[0][0]; h[0][1] = l[0][0]; h[0][2] = l[0][0];
h[1][0] = l[1][0]; h[1][1] = l[1][0]; h[1][2] = l[1][0];
h[2][0] = l[2][0]; h[2][1] = l[2][0]; h[2][2] = l[2][0];
*t = filter(x);
return;
}
h[0][0] = l[0][0]; h[0][1] = l[0][0]; h[0][2] = l[0][1];
h[1][0] = l[1][0]; h[1][1] = l[1][0]; h[1][2] = l[1][1];
h[2][0] = l[2][0]; h[2][1] = l[2][0]; h[2][2] = l[2][1];
*t++ = filter(x);
for(int i = 1; i < cx - 1; i++) {
x[0] = ~l[0] + i - 1;
x[1] = ~l[1] + i - 1;
x[2] = ~l[2] + i - 1;
*t++ = filter(x);
}
h[0][0] = l[0][cx - 2]; h[0][1] = l[0][cx - 1]; h[0][2] = l[0][cx - 1];
h[1][0] = l[1][cx - 2]; h[1][1] = l[1][cx - 1]; h[1][2] = l[1][cx - 1];
h[2][0] = l[2][cx - 2]; h[2][1] = l[2][cx - 1]; h[2][2] = l[2][cx - 1];
x[0] = h[0];
x[1] = h[1];
x[2] = h[2];
*t++ = filter(x);
}

void Filter(RasterEncoder& target, Raster& src, ImageFilter9& filter)
{
Size sz = src.GetSize();
target.Create(sz, src);
if(sz.cy < 1)
return;
RasterLine l[3];
if(sz.cy == 1) {
l[0] = src[0];
l[1] = src[0];
l[2] = src[0];
sLine(target, sz.cx, l, filter);
return;
}
l[0] = src[0];
l[1] = src[0];
l[2] = src[1];
sLine(target, sz.cx, l, filter);
target.WriteLine();
for(int y = 1; y < sz.cy - 1; y++) {
l[0] = l[1];
l[1] = l[2];
l[2] = src[y + 1];
sLine(target, sz.cx, l, filter);
target.WriteLine();
}
l[0] = l[1];
l[1] = l[2];
l[2] = src[sz.cy - 1];
sLine(target, sz.cx, l, filter);
target.WriteLine();
}

Image Filter(const Image& img, ImageFilter9& filter)
{
ImageEncoder tgt;
ImageRaster src(img);
Filter(tgt, src, filter);
return tgt;
}

struct RGBAI {
int r, g, b, a;

RGBAI() { r = g = b = a= 0; }
};

static void sGetS(RGBA q, RGBAI& p, int mul)
{
p.r += mul * q.r;
p.g += mul * q.g;
p.b += mul * q.b;
p.a += mul * q.a;
}

struct sSharpenFilter : ImageFilter9 {
int amount;

virtual RGBA operator()(const RGBA **mx);
};

RGBA sSharpenFilter::operator()(const RGBA **mx)
{
RGBAI q;
sGetS(mx[0][0], q, 7);
sGetS(mx[0][1], q, 9);
sGetS(mx[0][2], q, 7);
sGetS(mx[1][0], q, 9);
sGetS(mx[1][2], q, 9);
sGetS(mx[2][0], q, 7);
sGetS(mx[2][1], q, 9);
sGetS(mx[2][2], q, 7);
const RGBA& s = mx[1][1];
RGBA t;
int na = 256 + amount;
t.b = Saturate255((na * (s.b << 6) - amount * q.b) >> 14);
t.g = Saturate255((na * (s.g << 6) - amount * q.g) >> 14);
t.r = Saturate255((na * (s.r << 6) - amount * q.r) >> 14);
t.a = Saturate255((na * (s.a << 6) - amount * q.a) >> 14);
return t;
}

void Sharpen(RasterEncoder& target, Raster& src, int amount)
{
Size sz = src.GetSize();
target.Create(sz, src);
sSharpenFilter f;
f.amount = amount;
Filter(target, src, f);
}

Image Sharpen(const Image& img, int amount)
{
ImageEncoder tgt;
ImageRaster src(img);
Sharpen(tgt, src, amount);
return tgt;
}

struct sEtchFilter : ImageFilter9 {
virtual RGBA operator()(const RGBA **mx);
};

RGBA sEtchFilter::operator()(const RGBA **mx)
{
RGBA t;
RGBA s = mx[1][1];
if(s.a > 0x80 && s.r + s.g + s.b < 500) {
t.r = t.g = t.b = 128;
t.a = s.a;
return t;
}
s = mx[0][0];
if(s.a > 0x80 && s.r + s.g + s.b < 500) {
t.r = t.g = t.b = 255;
t.a = s.a;
return t;
}
Zero(t);
return t;
}

Image Etched(const Image& img)
{
sEtchFilter ef;
return Premultiply(Filter(Unmultiply(img), ef));
}

Image SetColorKeepAlpha(const Image& img, Color c)
{
RGBA rgba = c;
const RGBA *s = ~img;
const RGBA *e = s + img.GetLength();
ImageBuffer w(img.GetSize());
RGBA *t = w;
while(s < e) {
*t = rgba;
(t++)->a = (s++)->a;
}
Premultiply(w);
w.SetHotSpots(img);
return w;
}

Image CreateHorzFadeOut(Size sz, Color color)
{
ImageBuffer ib(sz);
RGBA c = color;
for(int q = 0; q < sz.cx; q++) {
c.a = q * 255 / sz.cx;
RGBA *t = ~ib + q;
for(int n = sz.cy; n > 0; n--) {
*t = c;
t += sz.cx;
}
}
Premultiply(ib);
return ib;
}

struct FadeOutMaker : ImageMaker {
Size sz;
Color color;

virtual String Key() const {
char h[sizeof(Size) + sizeof(Color)];
memcpy(h, &sz, sizeof(sz));
memcpy(h + sizeof(Size), &color, sizeof(Color));
return String(h, sizeof(h));
}

virtual Image Make() const {
return CreateHorzFadeOut(sz, color);
}
};

Image HorzFadeOut(Size sz, Color color)
{
FadeOutMaker m;
m.sz = sz;
m.color = color;
return MakeImage(m);
}

Image HorzFadeOut(int cx, int cy, Color color)
{
return HorzFadeOut(Size(cx, cy), color);
}

void SetNormalizedHotSpots(ImageBuffer& ib, int x1, int y1, int x2, int y2)
{
Rect r(x1, y1, x2, y2);
r.Normalize();
ib.SetHotSpot(r.TopLeft());
ib.Set2ndSpot(r.BottomRight());
}

Image RotateClockwise(const Image& img)
{
Size sz = img.GetSize();
ImageBuffer ib(sz.cy, sz.cx);
for(int x = 0; x < sz.cx; x++)
for(int y = 0; y < sz.cy; y++)
ib[x][y] = img[sz.cy - y - 1][x];
Point p1 = img.GetHotSpot();
Point p2 = img.Get2ndSpot();
SetNormalizedHotSpots(ib, sz.cy - p1.y - 1, p1.x, sz.cy - p2.y - 1, p2.x);
return ib;
}

Image RotateAntiClockwise(const Image& img)
{
Size sz = img.GetSize();
ImageBuffer ib(sz.cy, sz.cx);
for(int x = 0; x < sz.cx; x++)
for(int y = 0; y < sz.cy; y++)
ib[x][y] = img[y][sz.cx - x - 1];

Point p1 = img.GetHotSpot();
Point p2 = img.Get2ndSpot();
SetNormalizedHotSpots(ib, p1.y, sz.cx - p1.x - 1, p2.y, sz.cx - p2.x - 1);
return ib;
}

Image Rotate180(const Image& orig)
{
Size sz = orig.GetSize();
ImageBuffer dest(sz);
for(int rw = 0; rw < sz.cy; rw++)
for(int cl = 0; cl < sz.cx; cl++)
dest[rw][cl] = orig[sz.cy - rw - 1][sz.cx - cl - 1];
Point p1 = orig.GetHotSpot();
Point p2 = orig.Get2ndSpot();
SetNormalizedHotSpots(dest, sz.cy - p1.y - 1, sz.cx - p1.x - 1, sz.cy - p2.y - 1, sz.cx - p2.x - 1);
return dest;
}

Image MirrorHorz(const Image& img)
{
Size sz = img.GetSize();
Image h = img;
ImageBuffer ib(h);
for(int y = 0; y < sz.cy; y++) {
RGBA *b = ib[y] + 0;
RGBA *e = b + sz.cx - 1;
while(b < e) {
Swap(*b, *e);
b++;
e--;
}
}
Point p1 = img.GetHotSpot();
Point p2 = img.Get2ndSpot();
SetNormalizedHotSpots(ib, sz.cx - p1.x - 1, p1.y, sz.cx - p2.x - 1, p2.y);
return ib;
}

Image MirrorVert(const Image& img)
{
Size sz = img.GetSize();
Image h = img;
ImageBuffer ib(h);

for(int y = 0; y < sz.cy / 2; y++) {
RGBA *b = ib[y];
RGBA *e = ib[sz.cy - y - 1];
for(int x = 0; x < sz.cx; x++) {
Swap(*b, *e);
b++;
e++;
}
}
Point p1 = img.GetHotSpot();
Point p2 = img.Get2ndSpot();
SetNormalizedHotSpots(ib, p1.x, sz.cy - p1.y - 1, p2.x, sz.cy - p2.y - 1);
return ib;
}

Image Magnify(const Image& img, int nx, int ny)
{
if(nx == 1 && ny == 1)
return img;
if(nx == 0 || ny == 0)
return Image();
Size sz = img.GetSize();
bool xdown = nx < 0;
nx = abs(nx);
int ncx = xdown ? sz.cx / nx : sz.cx * nx;
ImageBuffer b(ncx, sz.cy * ny);
const RGBA *s = ~img;
const RGBA *e = s + img.GetLength();
RGBA *t = ~b;
while(s < e) {
RGBA *q = t;
const RGBA *le = s + sz.cx;
while(s < le) {
Fill(q, *s, nx);
q += nx;
s++;
}
for(int n = ny - 1; n--;) {
memcpy(q, t, ncx * sizeof(RGBA));
q += ncx;
}
t = q;
}
return b;
}

static Pointf Cvp(double x, double y, double sina, double cosa)
{
return Pointf(x * cosa + y * sina, -x * sina + y * cosa);
}

Image Rotate(const Image& m, int angle)
{
Size isz = m.GetSize();
Pointf centerf = Pointf(Point(isz)) / 2.0;
double sina, cosa;
Draw::SinCos(-angle, sina, cosa);
Pointf p1 = Cvp(-centerf.x, -centerf.y, sina, cosa);
Pointf p2 = Cvp(centerf.x, -centerf.y, sina, cosa);
Size sz2 = Size(2 * (int)max(tabs(p1.x), tabs(p2.x)),
2 * (int)max(tabs(p1.y), tabs(p2.y)));
ImageBuffer ib(sz2);
Fill(~ib, RGBAZero(), ib.GetLength());
RGBA *t = ~ib;
Draw::SinCos(angle, sina, cosa);
int sini = int(sina * 128);
int cosi = int(cosa * 128);
Buffer<int> xmx(sz2.cx);
Buffer<int> xmy(sz2.cx);
for(int x = 0; x < sz2.cx; x++) {
int xx = x + x - sz2.cx;
xmx[x] = int(xx * cosi);
xmy[x] = -int(xx * sini);
}
for(int y = 0; y < sz2.cy; y++) {
int yy = y + y - sz2.cy;
int ymx = int(yy * sini) + (isz.cx << 7);
int ymy = int(yy * cosi) + (isz.cy << 7);
for(int x = 0; x < sz2.cx; x++) {
int xs = (xmx[x] + ymx) >> 8;
int ys = (xmy[x] + ymy) >> 8;
*t++ = xs >= 0 && xs < isz.cx && ys >= 0 && ys < isz.cy ? m[ys][xs] : RGBAZero();
}
}
return ib;
}

END_UPP_NAMESPACE

Change log

r4457 by cxl on Jan 21, 2012   Diff
*uppsrc: Fixed many GCC warnings
Go to: 
Project members, sign in to write a code review

Older revisions

r3904 by cxl on Sep 24, 2011   Diff
*Draw: Hotspots in mirror/rotate
operations are now normalized (to
represent 'resize' chameleon
information)
r3896 by cxl on Sep 20, 2011   Diff
Draw: Rotate*(Image) and Mirror(Image)
now correctly set moved hotspots
r3887 by cxl on Sep 19, 2011   Diff
CtrlLib, Draw: Improved support for
dark visual themes (corrected text
color, icon inversion for toolbar /
menubar)
All revisions of this file

File info

Size: 15742 bytes, 746 lines
Powered by Google Project Hosting