| 1 | #ifndef _INCLUDED_BITMAP_LCDR |
|---|
| 2 | #define _INCLUDED_BITMAP_LCDR |
|---|
| 3 | |
|---|
| 4 | UT_STATIC_API void ut_CopyLCDR(UT_IMAGE* image, UT_DATA* data) |
|---|
| 5 | { |
|---|
| 6 | int x, y, xx, yy; |
|---|
| 7 | // int s_bSize = ut_BSIZE8(image->bbox.sy); |
|---|
| 8 | int ox = data->bbox.ox - image->bbox.ox; |
|---|
| 9 | int oy = data->bbox.oy - image->bbox.oy; |
|---|
| 10 | unsigned char* s = data->p.u8; |
|---|
| 11 | unsigned char* d = image->data; |
|---|
| 12 | UT_TRACE1("ut_CopyLCDR()"); |
|---|
| 13 | UT_TRACE_TAB_INC(); |
|---|
| 14 | for (x=0,xx=ox; x<data->bbox.sx; x++,xx++) |
|---|
| 15 | { |
|---|
| 16 | for (y=0,yy=oy; y<data->bbox.sy; y++,yy++) |
|---|
| 17 | { |
|---|
| 18 | if (s[(y>>3)*data->bbox.sx+x] & (0x80 >> (y&7))) |
|---|
| 19 | d[(yy>>3)*image->bbox.sx+xx] |= 0x80 >> (yy&7); |
|---|
| 20 | } |
|---|
| 21 | } |
|---|
| 22 | UT_TRACE_TAB_DEC(); |
|---|
| 23 | } |
|---|
| 24 | |
|---|
| 25 | UT_STATIC_API UT_BOOL ut_PrepareRasterBitmapGlyphLCDR(UT_FC* fc, UT_IMAGE* image) |
|---|
| 26 | { |
|---|
| 27 | UT_TRACE1("ut_PrepareRasterBitmapGlyphLCDR()"); |
|---|
| 28 | UT_TRACE_TAB_INC(); |
|---|
| 29 | image->type = _UT_IMAGE_TYPE_LCD_R; |
|---|
| 30 | if (fc->task->glyph->count == 1) |
|---|
| 31 | { |
|---|
| 32 | UT_TRACE1("if (fc->task->glyph->count == 1)"); |
|---|
| 33 | ut_PrepareRasterBitmapHasFixedBbox(fc, image, ut_BSIZE8(fc->task->glyph->data->bbox.sy), fc->task->glyph->data->bbox.sx); |
|---|
| 34 | } |
|---|
| 35 | else if (fc->task->glyph->cmap->glyphBBoxType == _UT_GLYPH_BBOX_FIXED) |
|---|
| 36 | { |
|---|
| 37 | UT_TRACE1("if (fc->task->glyph->cmap->glyphBBoxType == _UT_GLYPH_BBOX_FIXED)"); |
|---|
| 38 | ut_PrepareRasterBitmapHasFixedBbox(fc, image, ut_BSIZE8(fc->task->glyph->data->bbox.sy), fc->task->glyph->data->bbox.sx); |
|---|
| 39 | } |
|---|
| 40 | else |
|---|
| 41 | { |
|---|
| 42 | UT_TRACE1("else"); |
|---|
| 43 | ut_GetImageBbox(fc, image); |
|---|
| 44 | image->bSize = ut_BSIZE8(image->bbox.sy); |
|---|
| 45 | image->lSize = image->bSize * image->bbox.sx; |
|---|
| 46 | } |
|---|
| 47 | UT_TRACE2("image->bbox.ox = %d", image->bbox.ox); |
|---|
| 48 | UT_TRACE2("image->bbox.oy = %d", image->bbox.oy); |
|---|
| 49 | UT_TRACE2("image->bbox.sx = %d", image->bbox.sx); |
|---|
| 50 | UT_TRACE2("image->bbox.sy = %d", image->bbox.sy); |
|---|
| 51 | UT_TRACE2("image->bSize = %d", image->bSize); |
|---|
| 52 | UT_TRACE2("image->lSize = %d", image->lSize); |
|---|
| 53 | UT_TRACE_TAB_DEC(); |
|---|
| 54 | return _UT_TRUE; |
|---|
| 55 | } |
|---|
| 56 | |
|---|
| 57 | UT_STATIC_API UT_BOOL ut_MakeRasterBitmapGlyphLCDR(UT_FC* fc, UT_IMAGE* image) |
|---|
| 58 | { |
|---|
| 59 | UT_TRACE1("ut_MakeRasterBitmapGlyphLCDR()"); |
|---|
| 60 | UT_TRACE_TAB_INC(); |
|---|
| 61 | if (fc->task->glyph->count == 1) |
|---|
| 62 | { |
|---|
| 63 | UT_TRACE1("if (fc->task->glyph->count == 1)"); |
|---|
| 64 | ut_MakeRasterBitmapHasOneGlyph(fc, image); |
|---|
| 65 | } |
|---|
| 66 | else if (fc->task->glyph->cmap->glyphBBoxType == _UT_GLYPH_BBOX_FIXED) |
|---|
| 67 | { |
|---|
| 68 | UT_TRACE1("if (fc->task->glyph->cmap->glyphBBoxType == _UT_GLYPH_BBOX_FIXED)"); |
|---|
| 69 | ut_MakeRasterBitmapHasFixedBbox(fc, image); |
|---|
| 70 | } |
|---|
| 71 | else |
|---|
| 72 | { |
|---|
| 73 | int i = fc->task->glyph->count; |
|---|
| 74 | UT_DATA* data = fc->task->glyph->data; |
|---|
| 75 | UT_TRACE1("else"); |
|---|
| 76 | ut_AllocScanBuffer(fc->task, image, 0); |
|---|
| 77 | UT_MEMSET(image->data, 0, image->lSize); |
|---|
| 78 | for (; i; i--,data++) ut_CopyLCDR(image, data); |
|---|
| 79 | } |
|---|
| 80 | UT_TRACE_TAB_DEC(); |
|---|
| 81 | return _UT_TRUE; |
|---|
| 82 | } |
|---|
| 83 | |
|---|
| 84 | #endif /*#ifndef _INCLUDED_BITMAP_LCDR*/ |
|---|