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 to save image to
24 /// @param data - blob pointer to save image to
25 /// @param image - image to be saved (not empty, 1 or 3 channels)
26 /// @param quality - quality for saved image
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 
45 class Jpg
46 {
47 public:
48 
49  ///@{
50  /// Save image to JPEG file/blob
51  /// @param path - file path to save image to
52  /// @param data - blob pointer to save image to
53  /// @param image - image to be saved (not empty, 1 or 3 channels)
54  /// @param quality - quality for saved image
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_
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)
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
Definition: BaseSdkDefines.h:7
static ErrorCode save(const wchar_t *path, const IImage *image, int quality=100)
Definition: JpgIO.h:55