00001
00002
00003
00004
00005
00006 #ifndef H_CPPPDFImage
00007 #define H_CPPPDFImage
00008
00009 #include <PDF/GState.h>
00010 #include <C/PDF/TRN_Image.h>
00011
00012
00013 namespace pdftron {
00014 namespace PDF {
00015
00023 class Image
00024 {
00025 public:
00026
00083 static Image Create(SDF::SDFDoc& doc, const UString& filename, SDF::Obj encoder_hints = 0);
00084
00108 static Image Create(SDF::SDFDoc& doc,
00109 const char* image_data,
00110 ULong image_data_size,
00111 int width,
00112 int height,
00113 int bpc,
00114 ColorSpace color_space,
00115 SDF::Obj encoder_hints = 0);
00116
00122 static Image Create(SDF::SDFDoc& doc,
00123 Filters::FilterReader& image_data,
00124 int width,
00125 int height,
00126 int bpc,
00127 ColorSpace color_space,
00128 SDF::Obj encoder_hints = 0);
00129
00143 #if defined(_WIN32) && !defined(WINCE)
00144 static Image Create(SDF::SDFDoc& doc, Gdiplus::Bitmap* bmp, SDF::Obj encoder_hints = 0);
00145 #endif
00146
00168 static Image CreateImageMask(SDF::SDFDoc& doc,
00169 const char* image_data,
00170 ULong image_data_size,
00171 int width,
00172 int height,
00173 SDF::Obj encoder_hints = 0);
00174
00179 static Image CreateImageMask(SDF::SDFDoc& doc,
00180 Filters::FilterReader& image_data,
00181 int width,
00182 int height,
00183 SDF::Obj encoder_hints = 0);
00184
00208 static Image CreateSoftMask(SDF::SDFDoc& doc,
00209 const char* image_data,
00210 ULong image_data_size,
00211 int width,
00212 int height,
00213 int bpc,
00214 SDF::Obj encoder_hints = 0);
00215
00221 static Image CreateSoftMask(SDF::SDFDoc& doc,
00222 Filters::FilterReader& image_data,
00223 int width,
00224 int height,
00225 int bpc,
00226 SDF::Obj encoder_hints = 0);
00227
00228
00229
00230 enum InputFilter
00231 {
00232 e_none,
00233 e_jpeg,
00234 e_jp2,
00235 e_flate,
00236 e_g3,
00237 e_g4,
00238 e_ascii_hex
00239 };
00240
00261 static Image Create(SDF::SDFDoc& doc,
00262 const char* image_data,
00263 ULong image_data_size,
00264 int width,
00265 int height,
00266 int bpc,
00267 ColorSpace color_space,
00268 InputFilter input_format);
00269
00270
00275 static Image Create(SDF::SDFDoc& doc,
00276 Filters::FilterReader& image_data,
00277 int width,
00278 int height,
00279 int bpc,
00280 ColorSpace color_space,
00281 InputFilter input_format);
00282
00289 Image(SDF::Obj image_xobject = 0);
00290
00291 Image(const Image&);
00292 Image& operator=(const Image&);
00293
00297 SDF::Obj GetSDFObj ();
00298
00304 bool IsValid() const;
00305
00309 Filters::Filter GetImageData();
00310
00314 int GetImageDataSize();
00315
00327 #if defined(_WIN32) && !defined(WINCE)
00328 Gdiplus::Bitmap* GetBitmap();
00329 #endif
00330
00339 SDF::Obj GetImageColorSpace();
00340
00344 int GetImageWidth();
00345
00349 int GetImageHeight();
00350
00359 SDF::Obj GetDecodeArray();
00360
00366 int GetBitsPerComponent();
00367
00371 int GetComponentNum();
00372
00376 bool IsImageMask();
00377
00381 bool IsImageInterpolate();
00382
00390 SDF::Obj GetMask();
00391
00407 void SetMask(Image& image_mask);
00408
00420 void SetMask(SDF::Obj mask);
00421
00427 SDF::Obj GetSoftMask();
00428
00438 void SetSoftMask(Image& soft_mask);
00439
00443 GState::RenderingIntent GetImageRenderingIntent();
00444
00464 int Export(const UString& filename);
00465
00478 int Export(Filters::FilterWriter& writer);
00479
00486 void ExportAsTiff(const UString& filename);
00487
00493 void ExportAsTiff(Filters::FilterWriter& writer);
00494
00501 void ExportAsPng(const UString& filename);
00502
00508 void ExportAsPng(Filters::FilterWriter& writer);
00509
00510
00512 Image(TRN_Image impl);
00513 TRN_Image mp_image;
00515 };
00516
00517
00518
00519 #include <Impl/Image.inl>
00520
00521 };
00522 };
00523
00524 #endif
00525