HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
IMG_RasterSpan.h
Go to the documentation of this file.
1 #ifndef __IMG_RasterSpan__
2 #define __IMG_RasterSpan__
3 
4 #include "IMG_API.h"
5 #include <UT/UT_NonCopyable.h>
6 
7 //
8 // This class a takes raster and creates a "span" data structure that holds
9 // all spans where alpha is 0.
10 //
11 // The access methods will take an arbitrary pixel and then return the
12 // closest pixel which has an alpha value of 0.
13 //
14 // The class could be expanded to create spans based upon different criteria.
15 //
16 
17 #include <stdio.h>
18 
19 class IMG_Raster;
20 class IMG_Bucket;
21 
23 {
24 public:
25  IMG_RasterSpan(IMG_Raster *, unsigned long min = 0,
26  unsigned long max = 0);
27  ~IMG_RasterSpan();
28 
30 
31  int getClosest(
32  int scan_line,
33  int pixel,
34  int &x);
35  int getClosest(
36  int x,
37  int y,
38  float max,
39  int &tx,
40  int &ty,
41  float &dist,
42  float min = -1);
43 
44  void print(FILE *);
45 
46 private:
47  void buildSpan(IMG_Raster *);
48  void cleanBuckets();
49  void addBuckets(int num_buckets);
50 
51  IMG_Bucket *myBuckets;
52  int myBucketCount;
53 
54  float *myDist;
55  int myDistDim;
56  unsigned long myMin;
57  unsigned long myMax;
58 };
59 
60 #endif // __IMG_Span__
GA_API const UT_StringHolder dist
ImageBuf OIIO_API min(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
GLint y
Definition: glcorearb.h:103
#define IMG_API
Definition: IMG_API.h:10
#define UT_NON_COPYABLE(CLASS)
Define deleted copy constructor and assignment operator inside a class.
GLint GLenum GLint x
Definition: glcorearb.h:409
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
FMT_INLINE void print(format_string< T...> fmt, T &&...args)
Definition: core.h:2976