OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkDevice.h" | 9 #include "SkDevice.h" |
10 #include "SkGraphics.h" | 10 #include "SkGraphics.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 T** data); | 69 T** data); |
70 | 70 |
71 class SkPdfObject; | 71 class SkPdfObject; |
72 bool ObjectFromDictionary(const PdfMemDocument* pdfDoc, | 72 bool ObjectFromDictionary(const PdfMemDocument* pdfDoc, |
73 const PdfDictionary& dict, | 73 const PdfDictionary& dict, |
74 const char* key, | 74 const char* key, |
75 const char* abr, | 75 const char* abr, |
76 SkPdfObject** data); | 76 SkPdfObject** data); |
77 | 77 |
78 | 78 |
| 79 struct SkPdfFileSpec {}; |
| 80 class SkPdfArray; |
| 81 struct SkPdfStream {}; |
| 82 struct SkPdfDate {}; |
| 83 struct SkPdfTree {}; |
| 84 struct SkPdfFunction {}; |
| 85 |
| 86 bool ArrayFromDictionary(const PdfMemDocument* pdfDoc, |
| 87 const PdfDictionary& dict, |
| 88 const char* key, |
| 89 const char* abr, |
| 90 SkPdfArray* data); |
| 91 |
| 92 |
| 93 bool FileSpecFromDictionary(const PdfMemDocument* pdfDoc, |
| 94 const PdfDictionary& dict, |
| 95 const char* key, |
| 96 const char* abr, |
| 97 SkPdfFileSpec* data); |
| 98 |
| 99 |
| 100 bool StreamFromDictionary(const PdfMemDocument* pdfDoc, |
| 101 const PdfDictionary& dict, |
| 102 const char* key, |
| 103 const char* abr, |
| 104 SkPdfStream* data); |
| 105 |
| 106 bool TreeFromDictionary(const PdfMemDocument* pdfDoc, |
| 107 const PdfDictionary& dict, |
| 108 const char* key, |
| 109 const char* abr, |
| 110 SkPdfTree** data); |
| 111 |
| 112 bool DateFromDictionary(const PdfMemDocument* pdfDoc, |
| 113 const PdfDictionary& dict, |
| 114 const char* key, |
| 115 const char* abr, |
| 116 SkPdfDate* data); |
| 117 |
| 118 bool SkRectFromDictionary(const PdfMemDocument* pdfDoc, |
| 119 const PdfDictionary& dict, |
| 120 const char* key, |
| 121 const char* abr, |
| 122 SkRect* data); |
| 123 |
| 124 bool FunctionFromDictionary(const PdfMemDocument* pdfDoc, |
| 125 const PdfDictionary& dict, |
| 126 const char* key, |
| 127 const char* abr, |
| 128 SkPdfFunction* data); |
| 129 |
| 130 |
79 #include "pdf_auto_gen.h" | 131 #include "pdf_auto_gen.h" |
80 | 132 |
| 133 bool ArrayFromDictionary(const PdfMemDocument* pdfDoc, |
| 134 const PdfDictionary& dict, |
| 135 const char* key, |
| 136 const char* abr, |
| 137 SkPdfArray* data) {return false;} |
| 138 |
| 139 bool FileSpecFromDictionary(const PdfMemDocument* pdfDoc, |
| 140 const PdfDictionary& dict, |
| 141 const char* key, |
| 142 const char* abr, |
| 143 SkPdfFileSpec* data) {return false;} |
| 144 |
| 145 bool StreamFromDictionary(const PdfMemDocument* pdfDoc, |
| 146 const PdfDictionary& dict, |
| 147 const char* key, |
| 148 const char* abr, |
| 149 SkPdfStream* data) {return false;} |
| 150 |
| 151 bool TreeFromDictionary(const PdfMemDocument* pdfDoc, |
| 152 const PdfDictionary& dict, |
| 153 const char* key, |
| 154 const char* abr, |
| 155 SkPdfTree** data) {return false;} |
| 156 |
| 157 bool DateFromDictionary(const PdfMemDocument* pdfDoc, |
| 158 const PdfDictionary& dict, |
| 159 const char* key, |
| 160 const char* abr, |
| 161 SkPdfDate* data) {return false;} |
| 162 |
| 163 bool SkRectFromDictionary(const PdfMemDocument* pdfDoc, |
| 164 const PdfDictionary& dict, |
| 165 const char* key, |
| 166 const char* abr, |
| 167 SkRect* data) {return false;} |
| 168 |
| 169 bool FunctionFromDictionary(const PdfMemDocument* pdfDoc, |
| 170 const PdfDictionary& dict, |
| 171 const char* key, |
| 172 const char* abr, |
| 173 SkPdfFunction* data) {return false;} |
| 174 |
| 175 |
| 176 |
81 /* | 177 /* |
82 * TODO(edisonn): | 178 * TODO(edisonn): |
83 * - encapsulate podofo in the pdf api so the skpdf does not know anything about
podofo | 179 * - encapsulate podofo in the pdf api so the skpdf does not know anything about
podofo |
84 * - ASAP so skp -> pdf -> png looks great | 180 * - ASAP so skp -> pdf -> png looks great |
85 * - load gs/ especially smask and already known prop (skp) | 181 * - load gs/ especially smask and already known prop (skp) |
86 * - use transparency (I think ca and CA ops) (skp) | 182 * - use transparency (I think ca and CA ops) (skp) |
87 * - all font types | 183 * - all font types |
88 * - word spacing | 184 * - word spacing |
89 * - load font for baidu.pdf | 185 * - load font for baidu.pdf |
90 * - load font for youtube.pdf | 186 * - load font for youtube.pdf |
(...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1127 // &value->GetArray()[0]); | 1223 // &value->GetArray()[0]); |
1128 // } | 1224 // } |
1129 // if (value && value->IsName() && value->GetName().GetName() == "DCTDecode")
{ | 1225 // if (value && value->IsName() && value->GetName().GetName() == "DCTDecode")
{ |
1130 // SkStream stream = SkStream:: | 1226 // SkStream stream = SkStream:: |
1131 // SkImageDecoder::Factory() | 1227 // SkImageDecoder::Factory() |
1132 // } | 1228 // } |
1133 | 1229 |
1134 long bpc = image->BitsPerComponent(); | 1230 long bpc = image->BitsPerComponent(); |
1135 long width = image->Width(); | 1231 long width = image->Width(); |
1136 long height = image->Height(); | 1232 long height = image->Height(); |
1137 SkPdfObject* colorSpaceDict = image->ColorSpace(); | |
1138 std::string colorSpace = "DeviceRGB"; | 1233 std::string colorSpace = "DeviceRGB"; |
1139 // TODO(edisonn): for multiple type fileds, generate code, like, isName(), i
sArray(), ...and fields like colorSpace_name(), colorSpace_array() | 1234 |
1140 // so we do nto go to podofo anywhere in our cpp file | 1235 // TODO(edisonn): color space can be an array too! |
1141 if (colorSpaceDict && colorSpaceDict->podofo() && colorSpaceDict->podofo()->
IsName()) { | 1236 if (image->isColorSpaceAName()) { |
1142 colorSpace = colorSpaceDict->podofo()->GetName().GetName(); | 1237 colorSpace = image->getColorSpaceAsName(); |
1143 } | 1238 } |
1144 | 1239 |
1145 /* | 1240 /* |
1146 bool imageMask = image->imageMask(); | 1241 bool imageMask = image->imageMask(); |
1147 | 1242 |
1148 if (imageMask) { | 1243 if (imageMask) { |
1149 if (bpc != 0 && bpc != 1) { | 1244 if (bpc != 0 && bpc != 1) { |
1150 // TODO(edisonn): report warning to be used in testing. | 1245 // TODO(edisonn): report warning to be used in testing. |
1151 return SkBitmap(); | 1246 return SkBitmap(); |
1152 } | 1247 } |
(...skipping 1811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2964 } | 3059 } |
2965 | 3060 |
2966 return 0; | 3061 return 0; |
2967 } | 3062 } |
2968 | 3063 |
2969 #if !defined SK_BUILD_FOR_IOS | 3064 #if !defined SK_BUILD_FOR_IOS |
2970 int main(int argc, char * const argv[]) { | 3065 int main(int argc, char * const argv[]) { |
2971 return tool_main(argc, (char**) argv); | 3066 return tool_main(argc, (char**) argv); |
2972 } | 3067 } |
2973 #endif | 3068 #endif |
OLD | NEW |