-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathDrawRegion.cpp
117 lines (104 loc) · 2.31 KB
/
DrawRegion.cpp
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
// CGDraw.cpp
//
// CGDraw Class
// Copyright (c) 2015 by Kronosaur Productions, LLC. All Rights Reserved.
#include "PreComp.h"
#include "DrawRegionImpl.h"
void CGDraw::Region (CG32bitImage &Dest, int x, int y, const CGRegion &Region, CG32bitPixel rgbColor, EBlendModes iMode)
// Region
//
// Fills a region using the given color and blend mode
{
switch (iMode)
{
case blendNormal:
{
if (rgbColor.GetAlpha() == 0xff)
{
TFillRegionSolid<CGBlendCopy> Painter(rgbColor);
Painter.Draw(Dest, x, y, Region);
}
else
{
TFillRegionSolid<CGBlendBlend> Painter(rgbColor);
Painter.Draw(Dest, x, y, Region);
}
break;
}
case blendHardLight:
{
TFillRegionSolid<CGBlendHardLight> Painter(rgbColor);
Painter.Draw(Dest, x, y, Region);
break;
}
case blendScreen:
{
TFillRegionSolid<CGBlendScreen> Painter(rgbColor);
Painter.Draw(Dest, x, y, Region);
break;
}
case blendCompositeNormal:
{
if (rgbColor.GetAlpha() == 0xff)
{
TFillRegionSolid<CGBlendCompositeCopy> Painter(rgbColor);
Painter.Draw(Dest, x, y, Region);
}
else
{
TFillRegionSolid<CGBlendComposite> Painter(rgbColor);
Painter.Draw(Dest, x, y, Region);
}
break;
}
}
}
void CGDraw::Region (CG32bitImage &Dest, int x, int y, const CG16bitBinaryRegion &Region, CG32bitPixel rgbColor, EBlendModes iMode)
// Region
//
// Fills a region using the given color and blend mode
{
switch (iMode)
{
case blendNormal:
{
if (rgbColor.GetAlpha() == 0xff)
{
TFillRegionSolid<CGBlendCopy> Painter(rgbColor);
Painter.Draw(Dest, x, y, Region);
}
else
{
TFillRegionSolid<CGBlendBlend> Painter(rgbColor);
Painter.Draw(Dest, x, y, Region);
}
break;
}
case blendHardLight:
{
TFillRegionSolid<CGBlendHardLight> Painter(rgbColor);
Painter.Draw(Dest, x, y, Region);
break;
}
case blendScreen:
{
TFillRegionSolid<CGBlendScreen> Painter(rgbColor);
Painter.Draw(Dest, x, y, Region);
break;
}
case blendCompositeNormal:
{
if (rgbColor.GetAlpha() == 0xff)
{
TFillRegionSolid<CGBlendCompositeCopy> Painter(rgbColor);
Painter.Draw(Dest, x, y, Region);
}
else
{
TFillRegionSolid<CGBlendComposite> Painter(rgbColor);
Painter.Draw(Dest, x, y, Region);
}
break;
}
}
}