Open Reality Reference Guide
fbimage.h
Go to the documentation of this file.
1 #ifndef __FBIMAGE_H__
2 #define __FBIMAGE_H__
3 /**************************************************************************
4  Copyright (c) 1994 - 2009 Autodesk, Inc. and/or its licensors.
5  All Rights Reserved.
6 
7  The coded instructions, statements, computer programs, and/or related
8  material (collectively the "Data") in these files contain unpublished
9  information proprietary to Autodesk, Inc. and/or its licensors, which is
10  protected by Canada and United States of America federal copyright law
11  and by international treaties.
12 
13  The Data may not be disclosed or distributed to third parties, in whole
14  or in part, without the prior written consent of Autodesk, Inc.
15  ("Autodesk").
16 
17  THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY.
18  ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO
19  WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR
20  ARISING BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES
21  OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR
22  PURPOSE OR USE. WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT
23  WARRANT THAT THE OPERATION OF THE DATA WILL BE UNINTERRUPTED OR ERROR
24  FREE.
25 
26  IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS
27  OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR
28  EXPENSES OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE
29  DAMAGES OR OTHER SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS
30  OF PROFITS, REVENUE OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR
31  DAMAGES OF ANY KIND), HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF
32  LIABILITY, WHETHER DERIVED FROM CONTRACT, TORT (INCLUDING, BUT NOT
33  LIMITED TO, NEGLIGENCE), OR OTHERWISE, ARISING OUT OF OR RELATING TO THE
34  DATA OR ITS USE OR ANY OTHER PERFORMANCE, WHETHER OR NOT AUTODESK HAS
35  BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE.
36 
37 **************************************************************************/
38 
43 #include <kaydaradef.h>
44 #ifndef FBSDK_DLL
45 
48  #define FBSDK_DLL K_DLLIMPORT
49 #endif
50 
51 #include <fbsdk/fbcomponent.h>
52 
53 #ifdef FBSDKUseNamespace
54  namespace FBSDKNamespace {
55 #endif
56 
59 
62  kFBImageFormatRGBA32,
63  kFBImageFormatRGB24,
64  kFBImageFormatBGRA32,
65  kFBImageFormatBGR24,
66  kFBImageFormatBGR16,
67  kFBImageFormatABGR32,
68  kFBImageFormatARGB32,
69  kFBImageFormatUnknown
70 };
71 
74  kFBImageTypeFrame,
75  kFBImageTypeField
76 };
77 
80  kFBImageInterleaveTypeFullFrame,
81  kFBImageInterleaveTypeOdd,
82  kFBImageInterleaveTypeEven,
83  kFBImageInterleaveTypeAverage
84 };
85 
88  kFBImageInterpolationTypeNone,
89  kFBImageInterpolationTypeDuplicate,
90  kFBImageInterpolationTypeLinear
91 };
92 
93 FB_DEFINE_ENUM(FBSDK_DLL, ImageFormat);
94 FB_DEFINE_ENUM(FBSDK_DLL, ImageType);
95 FB_DEFINE_ENUM(FBSDK_DLL, ImageInterleaveType);
96 FB_DEFINE_ENUM(FBSDK_DLL, ImageInterpolationType);
97 
99 // FBImage
101 
105 {
106  //--- Open Reality declaration.
108 
109 public:
114  FBImage(const char* pFileName, HIObject pObject=NULL);
115 
118  virtual void FBDelete() override;
119 
122  void Cleanup();
123 
124 
131  bool Init(FBImageFormat pFormat, int pWidth, int pHeight);
132 
133 
137  unsigned char* GetBufferAddress();
138 
143  bool ConvertFormat(FBImageFormat pNewFormat);
144 
150  bool ConvertSize(int pWidth, int pHeight);
151 
154  void VerticalFlip();
155 
162  bool WriteToTif(const char* pFileName, const char* pComments, bool pCompressed);
163 
168  bool IsCompressedTif(const char* pFileName);
169 
173  FBPropertyImageFormat Format;
174  FBPropertyImageType Type;
175  FBPropertyImageInterleaveType InterleaveType;
176  FBPropertyImageInterpolationType InterpolationType;
177 };
179 
180 #ifdef FBSDKUseNamespace
181  }
182 #endif
183 
184 #endif /* this must be the last line of this file */
FB_DEFINE_ENUM
#define FB_DEFINE_ENUM(DllTag, Type)
Define an enum and give it the ability to be a property.
Definition: fbproperties.h:150
FBImage::FBImage
FBImage(const char *pFileName, HIObject pObject=NULL)
Constructor.
FBImage::ConvertFormat
bool ConvertFormat(FBImageFormat pNewFormat)
Convert the image data format to another format.
FBPropertyInt
class K_DLLIMPORT FBPropertyBase< int, kFBPT_int > FBPropertyInt
Property: int
Definition: fbproperties.h:1331
FBImageType
FBImageType
Image types.
Definition: fbimage.h:73
FBImage::Height
FBPropertyInt Height
Read Write Property: Height of the image in pixels.
Definition: fbimage.h:171
FBImage::Init
bool Init(FBImageFormat pFormat, int pWidth, int pHeight)
Init.
FBImage::WriteToTif
bool WriteToTif(const char *pFileName, const char *pComments, bool pCompressed)
Write image data to a TIF file on disk.
FBSDK_DLL
#define FBSDK_DLL
Be sure that FBSDK_DLL is defined only once...
Definition: fbimage.h:48
FBImage::ConvertSize
bool ConvertSize(int pWidth, int pHeight)
Convert the image size.
FBImageInterleaveType
FBImageInterleaveType
Image field interleave types.
Definition: fbimage.h:79
__FBClassDeclare
#define __FBClassDeclare(Name, Parent)
For internal use only.
Definition: fbcomponent.h:131
__FB_FORWARD
#define __FB_FORWARD(ClassName)
Forwarding of class and typedef declaration.
Definition: fbtypes.h:68
FBImage::Type
FBPropertyImageType Type
Read Only Property: Image type, refering to either frame or field.
Definition: fbimage.h:174
FBImage::InterpolationType
FBPropertyImageInterpolationType InterpolationType
Read Only Property: Image interpolation type.
Definition: fbimage.h:176
FBImage::Width
FBPropertyInt Width
Read Write Property: Width of the image in pixels.
Definition: fbimage.h:170
FBImage::Format
FBPropertyImageFormat Format
Read Write Property: Image data format.
Definition: fbimage.h:173
fbcomponent.h
Basic class definitions.
FBImageFormat
FBImageFormat
Image formats.
Definition: fbimage.h:61
FBImage::Depth
FBPropertyInt Depth
Read Write Property: Color depth of the image.
Definition: fbimage.h:172
FBImage::FBDelete
virtual void FBDelete() override
Virtual FBDelete function.
FB_DEFINE_COMPONENT
FB_DEFINE_COMPONENT(K_DLLIMPORT, AnimationNode)
Animation node class.
FBImage::GetBufferAddress
unsigned char * GetBufferAddress()
Access image data buffer, allow modifications.
FBImage::IsCompressedTif
bool IsCompressedTif(const char *pFileName)
Query TIF file about its compressed status.
FBImage
Image class.
Definition: fbimage.h:105
FBComponent
MotionBuilder SDK base class.
Definition: fbcomponent.h:651
FBImage::VerticalFlip
void VerticalFlip()
Flip the image vertically.
FBImage::InterleaveType
FBPropertyImageInterleaveType InterleaveType
Read Only Property: Image interleave type. Only meaningful if image type is field.
Definition: fbimage.h:175
FBImageInterpolationType
FBImageInterpolationType
Image interpolation types.
Definition: fbimage.h:87
FBImage::Cleanup
void Cleanup()
Cleanup image data, making it black.