Foxit PDF SDK
|
Public Types | |
enum | Type { e_Unknown = -1, e_None = 0, e_BMP = 1, e_JPG = 2, e_PNG = 3, e_GIF = 4, e_TIF = 5, e_JPX = 6, e_JBIG2 = 8 } |
Enumeration for image type. More... | |
Public Member Functions | |
Image () | |
Constructor. More... | |
Image (const char *path) | |
Constructor, from an existing image file path. More... | |
Image (const wchar_t *path) | |
Constructor, from an existing image file path. More... | |
Image (const void *buffer, size_t length) | |
Constructor, from a memory buffer. More... | |
Image (foxit::common::file::ReaderCallback *file_read) | |
Constructor, with a file read callback object. More... | |
Image (const Image &other) | |
Constructor, with another image object. More... | |
~Image () | |
Destructor. | |
bool | AddFrame (const Bitmap &bitmap) |
Add a bitmap as a frame. (Unsupported DIB formats: Bitmap::e_DIBRgb565 and Bitmap::e_DIB8bppMask) More... | |
Bitmap | GetFrameBitmap (int index) const |
Get a frame bitmap, specified by index. More... | |
int | GetFrameCount () const |
Get frame count. More... | |
int | GetHeight () const |
Get image height. More... | |
Type | GetType () const |
Get image type. More... | |
int | GetWidth () const |
Get image width. More... | |
int | GetXDPI () const |
Get DPI for X-axis. More... | |
int | GetYDPI () const |
Get DPI for Y-axis. More... | |
bool | IsEmpty () const |
Check whether current object is empty or not. More... | |
bool | operator != (const Image &other) const |
Not equal operator. More... | |
Image & | operator= (const Image &other) |
Assign operator. More... | |
bool | operator== (const Image &other) const |
Equal operator. More... | |
bool | SaveAs (const char *file_path) |
Save current image as an image file. More... | |
bool | SaveAs (const wchar_t *file_path) |
Save current image as an image file. More... | |
bool | SaveAs (foxit::common::file::StreamCallback *file, const wchar_t *file_extension) |
Save current image as an image file. More... | |
void | SetDPIs (int x_dpi, int y_dpi) |
Set DPI for X-axis and Y-axis. More... | |
![]() | |
FS_HANDLE | Handle () const |
Get the handle of current object. More... | |
Foxit PDF SDK offers following image types:
Enumeration for image type.
Values of this enumeration should be used alone.
Enumerator | |
---|---|
e_Unknown | Unknown image type. |
e_None | Not have image type yet.
|
e_BMP | Image type is BMP. |
e_JPG | Image type is JPG or JPeg. |
e_PNG | Image type is PNG. |
e_GIF | Image type is GIF. |
e_TIF | Image type is TIF or TIFF. |
e_JPX | Image type is JPX or JPeg-2000. |
e_JBIG2 | Image type is JBIG2.
|
foxit::common::Image::Image | ( | ) |
Constructor.
This constructor is to construct a new image object (without any data). The image type of this constructed image object would be Image::e_None.
|
explicit |
Constructor, from an existing image file path.
[in] | path | A full path of an existing image file. It should not be an empty string. |
|
explicit |
Constructor, from an existing image file path.
[in] | path | A full path of an existing image file. It should not be an empty string. |
|
explicit |
Constructor, from a memory buffer.
[in] | buffer | A memory buffer. The image file data should be fully loaded in this memory buffer. It should not be NULL. |
[in] | length | The size of memory buffer. It should be above 0. |
|
explicit |
Constructor, with a file read callback object.
[in] | file_read | A common::file::ReaderCallback object which is implemented by user to load an image file. It should not be NULL. |
foxit::common::Image::Image | ( | const Image & | other | ) |
Constructor, with another image object.
[in] | other | Another image object. |
bool foxit::common::Image::AddFrame | ( | const Bitmap & | bitmap | ) |
Add a bitmap as a frame. (Unsupported DIB formats: Bitmap::e_DIBRgb565 and Bitmap::e_DIB8bppMask)
Currently, this function does not support an image with type Image::e_JBIG2, or Image::e_Unknown .
For supporting image types:
[in] | bitmap | A valid bitmap as a frame to be added or set. |
Bitmap foxit::common::Image::GetFrameBitmap | ( | int | index | ) | const |
Get a frame bitmap, specified by index.
Currently, this function does not support an image with type Image::e_JBIG2. This function can only support to get a frame bitmap which is in following formats:
Bitmap::e_DIB8bppMask, Bitmap::e_DIB8bpp, Bitmap::e_DIBRgb, Bitmap::e_DIBRgb32, Bitmap::e_DIBArgb.
For other unsupported DIB format, this function will return a bitmap object which's function Bitmap::IsEmpty returns true.
[in] | index | Index of the frame. Valid range: from 0 to (count-1). count is returned by function Image::GetFrameCount. |
int foxit::common::Image::GetFrameCount | ( | ) | const |
Get frame count.
Currently, this function does not support an image with type Image::e_JBIG2.
int foxit::common::Image::GetHeight | ( | ) | const |
Get image height.
If the image has multiple frames, usually the first frame's size will be treated as the image size.
Type foxit::common::Image::GetType | ( | ) | const |
Get image type.
If current image is a new image (not constructed from any image file), its type would be Image::e_None.
int foxit::common::Image::GetWidth | ( | ) | const |
Get image width.
If the image has multiple frames, usually the first frame's size will be treated as the image size.
int foxit::common::Image::GetXDPI | ( | ) | const |
Get DPI for X-axis.
Currently, this function does not support an image with type Image::e_JPX, Image::e_GIF or Image::e_JBIG2.
For a new image (not constructed from any image file), the default DPI for X-axis is 96.
int foxit::common::Image::GetYDPI | ( | ) | const |
Get DPI for Y-axis.
Currently, this function does not support an image with type Image::e_JPX, Image::e_GIF or Image::e_JBIG2.
For a new image (not constructed from any image file), the default DPI for Y-axis is 96.
bool foxit::common::Image::IsEmpty | ( | ) | const |
Check whether current object is empty or not.
When the current object is empty, that means current object is useless.
bool foxit::common::Image::operator != | ( | const Image & | other | ) | const |
Not equal operator.
[in] | other | Another image object. This function will check if current object is not equal to this one. |
Assign operator.
[in] | other | Another image object, whose value would be assigned to current object. |
bool foxit::common::Image::operator== | ( | const Image & | other | ) | const |
Equal operator.
[in] | other | Another image object. This function will check if current object is equal to this one. |
bool foxit::common::Image::SaveAs | ( | const char * | file_path | ) |
Save current image as an image file.
If the type of current image is Image::e_TIF, Image::e_GIF or Image::e_None, and the saved image file type does not support multiply frames, only the first frame of current image will be saved to the image file.
For an image object (not constructed from any image file), please ensure to add at least one valid frame bitmap to the image object before using this function; otherwise this function will fail.
[in] | file_path | A full path of the saved image file. It should not be an empty string. Currently, this function supports following extension names: .bmp, .jpg, .jpeg, .png, .tif, .tiff, .jpx, .jp2. |
bool foxit::common::Image::SaveAs | ( | const wchar_t * | file_path | ) |
Save current image as an image file.
If the type of current image is Image::e_TIF, Image::e_GIF or Image::e_None, and the saved image file type does not support multiply frames, only the first frame of current image will be saved to the image file.
For an image object (not constructed from any image file), please ensure to add at least one valid frame bitmap to the image object before using this function; otherwise this function will fail.
[in] | file_path | A full path of the saved image file. It should not be an empty string. Currently, this function supports following extension names: .bmp, .jpg, .jpeg, .png, .tif, .tiff, .jpx, .jp2. |
bool foxit::common::Image::SaveAs | ( | foxit::common::file::StreamCallback * | file, |
const wchar_t * | file_extension | ||
) |
Save current image as an image file.
If the type of current image is Image::e_TIF, Image::e_GIF or Image::e_None, and the saved image file type does not support multiply frames, only the first frame of current image will be saved to the image file.
For an image object (not constructed from any image file), please ensure to add at least one valid frame bitmap to the image object before using this function; otherwise this function will fail.
[in] | file | A file::StreamCallback object which is implemented by user to save image file. |
[in] | file_extension | A full path of the saved image file. It should not be an empty string. Currently, this function supports following extension names: .bmp, .jpg, .jpeg, .png, .tif, .tiff, .jpx, .jp2. |
void foxit::common::Image::SetDPIs | ( | int | x_dpi, |
int | y_dpi | ||
) |
Set DPI for X-axis and Y-axis.
Currently, this function does not support an image with type Image::e_JPX, Image::e_GIF, or Image::e_JBIG2.
[in] | x_dpi | DPI for X-axis. It should be above 0. |
[in] | y_dpi | DPI for Y-axis. It should be above 0. |