forked from coolwanglu/pdf2htmlEX
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimage.cc
More file actions
65 lines (47 loc) · 1.63 KB
/
Copy pathimage.cc
File metadata and controls
65 lines (47 loc) · 1.63 KB
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
/*
* image.cc
*
* Handling images
*
* by WangLu
* 2012.08.14
*/
#include "HTMLRenderer.h"
#include "util/namespace.h"
namespace pdf2htmlEX {
void HTMLRenderer::drawImage(GfxState * state, Object * ref, Stream * str, int width, int height, GfxImageColorMap * colorMap, GBool interpolate, int *maskColors, GBool inlineImg)
{
return OutputDev::drawImage(state,ref,str,width,height,colorMap,interpolate,maskColors,inlineImg);
#if 0
if(maskColors)
return;
rgb8_image_t img(width, height);
auto imgview = view(img);
auto loc = imgview.xy_at(0,0);
ImageStream * img_stream = new ImageStream(str, width, colorMap->getNumPixelComps(), colorMap->getBits());
img_stream->reset();
for(int i = 0; i < height; ++i)
{
auto p = img_stream->getLine();
for(int j = 0; j < width; ++j)
{
GfxRGB rgb;
colorMap->getRGB(p, &rgb);
*loc = rgb8_pixel_t(colToByte(rgb.r), colToByte(rgb.g), colToByte(rgb.b));
p += colorMap->getNumPixelComps();
++ loc.x();
}
loc = imgview.xy_at(0, i+1);
}
png_write_view((format("i%|1$x|.png")%image_count).str(), imgview);
img_stream->close();
delete img_stream;
close_line();
double ctm[6];
memcpy(ctm, state->getCTM(), sizeof(ctm));
ctm[4] = ctm[5] = 0.0;
html_fout << format("<img class=\"i t%2%\" style=\"left:%3%px;bottom:%4%px;width:%5%px;height:%6%px;\" src=\"i%|1$x|.png\" />") % image_count % install_transform_matrix(ctm) % state->getCurX() % state->getCurY() % width % height << endl;
++ image_count;
#endif
}
} // namespace pdf2htmlEX