InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ImageDataTypes.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Ashish Jain
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change $
14 // ___________________
15 //
16 // ADOBE CONFIDENTIAL
17 //
18 // Copyright 2020 Adobe
19 // All Rights Reserved.
20 //
21 // NOTICE: All information contained herein is, and remains
22 // the property of Adobe and its suppliers,
23 // if any. The intellectual and technical concepts contained
24 // herein are proprietary to Adobe and its
25 // suppliers and are protected by all applicable intellectual property
26 // laws, including trade secret and copyright laws.
27 // Dissemination of this information or reproduction of this material
28 // is strictly forbidden unless prior written permission is obtained
29 // from Adobe .
30 //
31 // A Generic class that contains Raw Image Data Structure and its Pointers which can
32 // be used anywhere for image processing.
33 //
34 //========================================================================================
35 
36 #ifndef __ImageDataTypes__
37 #define __ImageDataTypes__
38 
39 
40 namespace ImagingTypes
41 {
42 
43  typedef std::shared_ptr<char> ImageBufferPtr;
44 
45  // Data Structures that can be used while handling Image data.
46  // This DataStructure can be used to do some processing on the image buffer easily.
47  struct ImageData
48  {
49  size_t fLength;
50  ImageBufferPtr fBufferPtr;
51  ImageData() : fLength(0), fBufferPtr(nil) {}
52 
53  //Creating ImageData from a std::string
54  ImageData(const std::string& bufferString)
55  {
56  fLength = bufferString.length();
57  char* buffer = new char[fLength];
58  fBufferPtr.reset(buffer);
59  std::copy(bufferString.begin(), bufferString.end(), buffer);
60  }
61 
62  //Creating ImageData from a buffer ptr
63  ImageData(ImageBufferPtr bufferPtr, size_t len)
64  {
65  fLength = len;
66  fBufferPtr = bufferPtr;
67  }
68  };
69 
70  // shared_ptr for handling ImageData for a single image
71  typedef std::shared_ptr<ImageData> ImageDataPtr;
72 
73  // std::vector for handling ImageData for multiple images
74  typedef std::vector<ImageDataPtr> ImageDataPtrList;
75 
76  typedef std::shared_ptr<ImageDataPtrList> ImageDataPtrListPtr;
77 }
78 
79 #endif