Artec 3D Scanning SDK  2.0
JpgIO.h
Go to the documentation of this file.
1 /********************************************************************
2 *
3 * Project Artec 3D Scanning SDK
4 *
5 * Purpose: Jpeg file format support
6 *
7 * Copyright: Artec Group
8 *
9 ********************************************************************/
10 
11 #ifndef _JPGIO_H_
12 #define _JPGIO_H_
13 
15 #include <artec/sdk/base/IImage.h>
16 
17 namespace artec { namespace sdk { namespace base { namespace io {
18 
19 extern "C" {
20 
21 ///@{
22 /// Save image to JPEG file/blob
23 /// @param path - file path where to save image
24 /// @param data - blob pointer where to save image
25 /// @param image - image to save (not empty, 1 or 3 channels)
26 /// @param quality - saved image quality
28  saveJpgImageToFile(const wchar_t* path, const IImage* image, int quality = 100);
30  saveJpgImageToBlob(IBlob** data, const IImage* image, int quality = 100);
31 ///@}
32 
33 ///@{
34 /// Load image from JPEG file/blob
35 /// @param image - loaded image
36 /// @param path - file path to load image from
37 /// @param data - blob to load image from
39  loadJpgImageFromFile(IImage** image, const wchar_t* path);
41  loadJpgImageFromBlob(IImage** image, const IBlob* data);
42 ///@}
43 }
44 /// Class to save/load JPG files
45 class Jpg
46 {
47 public:
48 
49  ///@{
50  /// Save image to JPEG file/blob
51  /// @param path - file path where to save image
52  /// @param data - blob pointer where to save image
53  /// @param image - image to save (not empty, 1 or 3 channels)
54  /// @param quality - saved image quality
55  static ErrorCode save(const wchar_t* path, const IImage* image, int quality = 100)
56  {
57  return saveJpgImageToFile(path, image, quality);
58  }
59 
60  static ErrorCode save(IBlob** data, const IImage* image, int quality = 100)
61  {
62  return saveJpgImageToBlob(data, image, quality);
63  }
64  ///@}
65 
66  ///@{
67  /// Load image from JPEG file/blob
68  /// @param image - loaded image
69  /// @param path - file path to load image from
70  /// @param data - blob to load image from
71  static ErrorCode load(IImage** image, const wchar_t* path)
72  {
73  return loadJpgImageFromFile(image, path);
74  }
75 
76  static ErrorCode load(IImage** image, const IBlob* data)
77  {
78  return loadJpgImageFromBlob(image, data);
79  }
80  ///@}
81 };
82 
83 } } } } // namespace artec::sdk::base::io
84 
85 #endif // _JPGIO_H_
Interface for common raster image objects.
Definition: IImage.h:126
Class to save/load JPG files.
Definition: JpgIO.h:45
ErrorCode ABASESDK_LINK_SPEC loadJpgImageFromFile(IImage **image, const wchar_t *path)
static ErrorCode load(IImage **image, const IBlob *data)
Definition: JpgIO.h:76
static ErrorCode save(IBlob **data, const IImage *image, int quality=100)
Definition: JpgIO.h:60
ErrorCode ABASESDK_LINK_SPEC saveJpgImageToFile(const wchar_t *path, const IImage *image, int quality=100)
Interface for Binary Large Object (memory chunk) with smart reference counting.
Definition: IBlob.h:35
static ErrorCode load(IImage **image, const wchar_t *path)
Definition: JpgIO.h:71
ErrorCode ABASESDK_LINK_SPEC saveJpgImageToBlob(IBlob **data, const IImage *image, int quality=100)
ErrorCode ABASESDK_LINK_SPEC loadJpgImageFromBlob(IImage **image, const IBlob *data)
#define ABASESDK_LINK_SPEC
static ErrorCode save(const wchar_t *path, const IImage *image, int quality=100)
Definition: JpgIO.h:55