HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RAY_PixelFilter.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: RAY_PixelFilter.h ( RAY Library, C++)
7  *
8  * COMMENTS: A pixel filter takes a sample buffer and filters the samples
9  * into a pixel buffer.
10  */
11 
12 #ifndef __RAY_PixelFilter__
13 #define __RAY_PixelFilter__
14 
15 #include "RAY_API.h"
16 #include "RAY_SpecialChannel.h"
17 #include <SYS/SYS_Types.h>
18 #include <SYS/SYS_Visibility.h>
19 
20 class RAY_Imager;
21 class RAY_SampleBuffer;
22 class RAY_PixelFilter;
23 
24 extern "C" {
25  /// When a pixel filter is defined as a dynamic object, allocPixelFilter()
26  /// is called to build a new instance of the filter. The name passed
27  /// in will be the name defined by the table entry. This can be used for:
28  ///
29  /// a) Error checking -- you can verify that you're name is what you
30  /// expect. However, this isn't mandatory.
31  /// b) To have more than one pixel filter defined per dynamic object.
32  /// Using the name, you can create pixel filters of different types.
34  allocPixelFilter(const char *name);
35 }
36 
38 public:
40  virtual ~RAY_PixelFilter() {}
41 
42  static RAY_PixelFilter *getPixelFilter(const char *name);
43  static RAY_PixelFilter *getSubPixelFilter();
44 
45  typedef RAY_PixelFilter*(*Constructor)(const char *name);
46  static void registerPixelFilter(
47  const char *name,
48  Constructor constructor);
49 
50  virtual void setArgs(int argc, const char *const argv[]) = 0;
51  virtual RAY_PixelFilter *clone() const = 0;
52 
53  /// Create any imager planes required by this pixel filter
54  virtual void addNeededSpecialChannels(RAY_Imager &imager) {}
55 
56  /// Indicate that the specified special channel must be added for this filter.
57  static void addSpecialChannel(RAY_Imager &imager, RAY_SpecialChannel channel);
58 
59  /// Get the channel index of the specified special channel
60  static int getSpecialChannelIdx(const RAY_Imager &imager, RAY_SpecialChannel channel);
61 
62  /// Returns -1 if no channel with the specified name exists
63  static int getChannelIdxByName(const RAY_Imager &imager, const char *name);
64 
65  /// Returns -1 if no channel with the specified channel index exists
66  static int getChannelVectorSize(const RAY_Imager &imager, int channel);
67 
68  /// Get the data for the channel with the specified index
69  static const float *getSampleData(const RAY_SampleBuffer &source, int channel);
70 
71  /// Prepare for filtering a tile.
72  /// sxres = samples per pixel in x direction
73  /// syres = samples per pixel in y direction
74  virtual void prepFilter(int sxres, int syres) = 0;
75 
76  /// Query the filter width. A filter width of 1 means that the samples
77  /// filtered will map exactly to the corresponding pixels in the output
78  /// image (i.e. no sampling outside the bounds)
79  virtual void getFilterWidth(float &x, float &y) const = 0;
80 
81  /// Perform the filtering
82  ///
83  /// Read data from source.getSampleData(channel), which is sourcewidth
84  /// by sourceheight, and has vectorsize floats per value, (1, 3, or 4).
85  ///
86  /// Write data to destination, which is destwidth by destheight, has
87  /// the same vectorsize, and whose unfiltered (ubox) source data would
88  /// have started at (destxoffsetinsource, destyoffsetinsource). The
89  /// number of pixel samples in each pixel's unfiltered data was already
90  /// passed into prepFilter, and should have been saved, if needed. For
91  /// each destination pixel, the all of the data that pixel depends upon
92  /// should be present in source.
93  ///
94  /// imager is provided in case any special channels are needed for this
95  /// channel's filtering or if addition information about this channel
96  /// is needed.
97  virtual void filter(
98  float *destination,
99  int vectorsize,
100  const RAY_SampleBuffer &source,
101  int channel,
102  int sourcewidth,
103  int sourceheight,
104  int destwidth,
105  int destheight,
106  int destxoffsetinsource,
107  int destyoffsetinsource,
108  const RAY_Imager &imager) const = 0;
109 };
110 
111 #endif
#define SYS_VISIBILITY_EXPORT
RAY_SpecialChannel
GLint y
Definition: glcorearb.h:103
virtual void addNeededSpecialChannels(RAY_Imager &imager)
Create any imager planes required by this pixel filter.
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:803
GLuint const GLchar * name
Definition: glcorearb.h:786
GLint GLenum GLint x
Definition: glcorearb.h:409
#define RAY_API
Definition: RAY_API.h:12
virtual ~RAY_PixelFilter()
SYS_VISIBILITY_EXPORT RAY_PixelFilter * allocPixelFilter(const char *name)
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glcorearb.h:1297