source: svn/newcon3bcm2_21bu/dst/dmw/src/grp/jungle_font/_utfBitmapScale.cxx

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 7.8 KB
Line 
1#ifndef _INCLUDED_BITMAP_SCALE
2#define _INCLUDED_BITMAP_SCALE
3
4static void ut_ScaleImage(UT_IMAGE* s_image, UT_IMAGE* d_image, UT_FC* fc)
5{
6        int dd = 0;
7#ifdef _UT_USE_BITMAP_EFFECT
8        if (fc->task->emulOutline) dd += 1;
9        else if (fc->task->emulEdge)
10                if (fc->task->emulEdge == _UT_EDGE_TYPE_BORDER)
11                        dd += ut_GetExtraSizeEdge(fc->ySize) << 2;
12                else
13                        dd += ut_GetExtraSizeEdge(fc->ySize) << 1;
14        if (fc->task->emulSmooth && !fc->task->emulEdge) dd += 1;
15#endif
16        if (fc->bitmapScaleType == _UT_BITMAP_SCALE_ND)
17        {
18                int x, y;
19                unsigned char* s = s_image->data;
20                unsigned char* d1 = d_image->data;
21                unsigned char* d2 = d_image->data;
22                d_image->type = s_image->type;
23                d_image->width   = s_image->width;
24                d_image->height  = s_image->height * 2;
25                if (d_image->type == _UT_IMAGE_TYPE_NULL) return;
26                d_image->bbox.ox = s_image->bbox.ox;
27                d_image->bbox.oy = s_image->bbox.oy * 2;
28                d_image->bbox.sx = s_image->bbox.sx;
29                d_image->bbox.sy = s_image->bbox.sy * 2;
30                d_image->bbox.ox -= dd;
31                d_image->bbox.oy -= dd;
32                d_image->bbox.sx += dd+dd;
33                d_image->bbox.sy += dd+dd;
34                d_image->bSize = ut_BALIGN(d_image->bbox.sx);
35                d_image->lSize = d_image->bSize * d_image->bbox.sy;
36                UT_MEMSET(d_image->data, 0, d_image->lSize);
37                d1 += d_image->bSize * dd;
38                d2 += d_image->bSize * dd;
39                d2 += d_image->bSize;
40                for (y=0; y<s_image->bbox.sy; y++)
41                {
42                        for (x=0; x<s_image->bbox.sx; x++)
43                        {
44                                d1[x+dd] = s[x];
45                                d2[x+dd] = s[x];
46                        }
47                        s += s_image->bSize;
48                        d1 += d_image->bSize + d_image->bSize;
49                        d2 += d_image->bSize + d_image->bSize;
50                }
51                return;
52        }
53        if (fc->bitmapScaleType == _UT_BITMAP_SCALE_DN)
54        {
55                int x, y, x2;
56                unsigned char* s = s_image->data;
57                unsigned char* d = d_image->data;
58                d_image->type = s_image->type;
59                d_image->width   = s_image->width * 2;
60                d_image->height  = s_image->height;
61                if (d_image->type == _UT_IMAGE_TYPE_NULL) return;
62                d_image->bbox.ox = s_image->bbox.ox * 2;
63                d_image->bbox.oy = s_image->bbox.oy;
64                d_image->bbox.sx = s_image->bbox.sx * 2;
65                d_image->bbox.sy = s_image->bbox.sy;
66                d_image->bbox.ox -= dd;
67                d_image->bbox.oy -= dd;
68                d_image->bbox.sx += dd+dd;
69                d_image->bbox.sy += dd+dd;
70                d_image->bSize = ut_BALIGN(d_image->bbox.sx);
71                d_image->lSize = d_image->bSize * d_image->bbox.sy;
72                UT_MEMSET(d_image->data, 0, d_image->lSize);
73                d += d_image->bSize * dd;
74                for (y=0; y<s_image->bbox.sy; y++)
75                {
76                        for (x=0,x2=0; x<s_image->bbox.sx; x++,x2+=2)
77                        {
78                                d[x2+dd+0] = s[x];
79                                d[x2+dd+1] = s[x];
80                        }
81                        s += s_image->bSize;
82                        d += d_image->bSize;
83                }
84                return;
85        }
86        if (fc->bitmapScaleType == _UT_BITMAP_SCALE_DD)
87        {
88                int x, y, x2;
89                unsigned char* s = s_image->data;
90                unsigned char* d1 = d_image->data;
91                unsigned char* d2 = d_image->data;
92                d_image->type = s_image->type;
93                d_image->width   = s_image->width * 2;
94                d_image->height  = s_image->height * 2;
95                if (d_image->type == _UT_IMAGE_TYPE_NULL) return;
96                d_image->bbox.ox = s_image->bbox.ox * 2;
97                d_image->bbox.oy = s_image->bbox.oy * 2;
98                d_image->bbox.sx = s_image->bbox.sx * 2;
99                d_image->bbox.sy = s_image->bbox.sy * 2;
100                d_image->bbox.ox -= dd;
101                d_image->bbox.oy -= dd;
102                d_image->bbox.sx += dd+dd;
103                d_image->bbox.sy += dd+dd;
104                d_image->bSize = ut_BALIGN(d_image->bbox.sx);
105                d_image->lSize = d_image->bSize * d_image->bbox.sy;
106                UT_MEMSET(d_image->data, 0, d_image->lSize);
107                d2 += d_image->bSize;
108                d1 += d_image->bSize * dd;
109                d2 += d_image->bSize * dd;
110                for (y=0; y<s_image->bbox.sy; y++)
111                {
112                        for (x=0,x2=0; x<s_image->bbox.sx; x++,x2+=2)
113                        {
114                                d1[x2+dd+0] = s[x];
115                                d1[x2+dd+1] = s[x];
116                                d2[x2+dd+0] = s[x];
117                                d2[x2+dd+1] = s[x];
118                        }
119                        s += s_image->bSize;
120                        d1 += d_image->bSize + d_image->bSize;
121                        d2 += d_image->bSize + d_image->bSize;
122                }
123                return;
124        }
125        if (fc->bitmapScaleType == _UT_BITMAP_SCALE_HN)
126        {
127                int x, y, x2;
128                unsigned char* s = s_image->data;
129                unsigned char* d = d_image->data;
130                d_image->type = s_image->type;
131                d_image->width   = (s_image->width   < 0) ?  (s_image->width   - 1) / 2: (s_image->width   + 1) / 2;
132                d_image->height  = s_image->height;
133                if (d_image->type == _UT_IMAGE_TYPE_NULL) return;
134                d_image->bbox.ox = (s_image->bbox.ox < 0) ?  (s_image->bbox.ox - 1) / 2: (s_image->bbox.ox + 1) / 2;
135                d_image->bbox.oy = s_image->bbox.oy;
136                d_image->bbox.sx = (s_image->bbox.sx + 1) / 2;
137                d_image->bbox.sy = s_image->bbox.sy;
138                d_image->bbox.ox -= dd;
139                d_image->bbox.oy -= dd;
140                d_image->bbox.sx += dd+dd;
141                d_image->bbox.sy += dd+dd;
142                d_image->bSize = ut_BALIGN(d_image->bbox.sx);
143                d_image->lSize = d_image->bSize * d_image->bbox.sy;
144                UT_MEMSET(d_image->data, 0, d_image->lSize);
145                d += d_image->bSize * dd;
146                for (y=0; y<s_image->bbox.sy; y++)
147                {
148                        for (x=0,x2=0; x2<s_image->bbox.sx; x++,x2+=2)
149                        {
150                                if (s[x2+0] || s[x2+1]) d[x+dd] = _UT_IMAGE_TYPE_BITMAP_65_COLOR;
151                                else d[x+dd] = _UT_IMAGE_TYPE_BITMAP_65_BACKGROUND_COLOR;
152                        }
153                        s += s_image->bSize;
154                        d += d_image->bSize;
155                }
156                return;
157        }
158        if (fc->bitmapScaleType == _UT_BITMAP_SCALE_HH)
159        {
160                int x, y, x2;
161                unsigned char* s1 = s_image->data;
162                unsigned char* s2 = s_image->data;
163                unsigned char* d = d_image->data;
164                d_image->type = s_image->type;
165                d_image->width   = (s_image->width   < 0) ?  (s_image->width   - 1) / 2: (s_image->width   + 1) / 2;
166                d_image->height  = (s_image->height  < 0) ?  (s_image->height  - 1) / 2: (s_image->height  + 1) / 2;
167                if (d_image->type == _UT_IMAGE_TYPE_NULL) return;
168                d_image->bbox.ox = (s_image->bbox.ox < 0) ?  (s_image->bbox.ox - 1) / 2: (s_image->bbox.ox + 1) / 2;
169                d_image->bbox.oy = (s_image->bbox.oy < 0) ?  (s_image->bbox.oy - 1) / 2: (s_image->bbox.oy + 1) / 2;
170                d_image->bbox.sx = (s_image->bbox.sx + 1) / 2;
171                d_image->bbox.sy = (s_image->bbox.sy + 1) / 2;
172                d_image->bbox.ox -= dd;
173                d_image->bbox.oy -= dd;
174                d_image->bbox.sx += dd+dd;
175                d_image->bbox.sy += dd+dd;
176                d_image->bSize = ut_BALIGN(d_image->bbox.sx);
177                d_image->lSize = d_image->bSize * d_image->bbox.sy;
178                UT_MEMSET(d_image->data, 0, d_image->lSize);
179                s2 += s_image->bSize;
180                d += d_image->bSize * dd;
181                for (y=0; y<s_image->bbox.sy; y+=2)
182                {
183                        for (x=0,x2=0; x2<s_image->bbox.sx; x++,x2+=2)
184                        {
185                                int l = (s1[x2+0]>0) + (s1[x2+1]>0) + (s2[x2+0]>0) + (s2[x2+1]>0);
186                                if (l >= 1) d[x+dd] = _UT_IMAGE_TYPE_BITMAP_65_COLOR;
187                                else d[x+dd] = _UT_IMAGE_TYPE_BITMAP_65_BACKGROUND_COLOR;
188                        }
189                        s1 += s_image->bSize + s_image->bSize;
190                        s2 += s_image->bSize + s_image->bSize;
191                        d += d_image->bSize;
192                }
193                return;
194        }
195        if (fc->bitmapScaleType == _UT_BITMAP_SCALE_NH)
196        {
197                int x, y;
198                unsigned char* s1 = s_image->data;
199                unsigned char* s2 = s_image->data;
200                unsigned char* d = d_image->data;
201                d_image->type = s_image->type;
202                d_image->width   = s_image->width;
203                d_image->height  = (s_image->height  < 0) ?  (s_image->height  - 1) / 2: (s_image->height  + 1) / 2;
204                if (d_image->type == _UT_IMAGE_TYPE_NULL) return;
205                d_image->bbox.ox = s_image->bbox.ox;
206                d_image->bbox.oy = (s_image->bbox.oy < 0) ?  (s_image->bbox.oy - 1) / 2: (s_image->bbox.oy + 1) / 2;
207                d_image->bbox.sx = s_image->bbox.sx;
208                d_image->bbox.sy = (s_image->bbox.sy + 1) / 2;
209                d_image->bbox.ox -= dd;
210                d_image->bbox.oy -= dd;
211                d_image->bbox.sx += dd+dd;
212                d_image->bbox.sy += dd+dd;
213                d_image->bSize = ut_BALIGN(d_image->bbox.sx);
214                d_image->lSize = d_image->bSize * d_image->bbox.sy;
215                UT_MEMSET(d_image->data, 0, d_image->lSize);
216                s2 += s_image->bSize;
217                d += d_image->bSize * dd;
218                for (y=0; y<s_image->bbox.sy; y+=2)
219                {
220                        for (x=0; x<s_image->bbox.sx; x++)
221                        {
222                                if (s1[x] || s2[x]) d[x+dd] = _UT_IMAGE_TYPE_BITMAP_65_COLOR;
223                                else d[x+dd] = _UT_IMAGE_TYPE_BITMAP_65_BACKGROUND_COLOR;
224                        }
225                        s1 += s_image->bSize + s_image->bSize;
226                        s2 += s_image->bSize + s_image->bSize;
227                        d += d_image->bSize;
228                }
229                return;
230        }
231}
232
233#endif /*#ifndef _INCLUDED_BITMAP_SCALE*/
Note: See TracBrowser for help on using the repository browser.