blob: dd11de8bb22c099a49413591228aa294a867cd70 (
plain)
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
|
/*
* $Id$
* Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
* For details on use and redistribution please refer to the
* LICENSE file included with these sources.
*/
package org.apache.fop.pdf;
import java.io.IOException;
public class BitmapImage implements PDFImage {
int m_height;
int m_width;
int m_bitsPerPixel;
PDFColorSpace m_colorSpace;
byte[] m_bitmaps;
String maskRef;
PDFColor transparent = null;
String key;
public BitmapImage(String k, int width, int height, byte[] result,
String mask) {
this.key = k;
this.m_height = height;
this.m_width = width;
this.m_bitsPerPixel = 8;
this.m_colorSpace = new PDFColorSpace(PDFColorSpace.DEVICE_RGB);
this.m_bitmaps = result;
maskRef = mask;
}
public void setup(PDFDocument doc) {
}
public String getKey() {
return key;
}
// image size
public int getWidth() {
return m_width;
}
public int getHeight() {
return m_height;
}
public void setColorSpace(PDFColorSpace cs) {
m_colorSpace = cs;
}
// DeviceGray, DeviceRGB, or DeviceCMYK
public PDFColorSpace getColorSpace() {
return m_colorSpace;
}
// bits per pixel
public int getBitsPerPixel() {
return m_bitsPerPixel;
}
public void setTransparent(PDFColor t) {
transparent = t;
}
// For transparent images
public boolean isTransparent() {
return transparent != null;
}
public PDFColor getTransparentColor() {
return transparent;
}
public String getMask() {
return null;
}
public String getSoftMask() {
return maskRef;
}
public PDFStream getDataStream() throws IOException {
// delegate the stream work to PDFStream
PDFStream imgStream = new PDFStream(0);
imgStream.setData(m_bitmaps);
imgStream.addDefaultFilters();
return imgStream;
}
public PDFICCStream getICCStream() {
return null;
}
public boolean isPS() {
return false;
}
}
|