InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IEdgeDetection.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: dstephen
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
16 //
17 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
18 // with the terms of the Adobe license agreement accompanying it. If you have received
19 // this file from a source other than Adobe, then your use, modification, or
20 // distribution of it requires the prior written permission of Adobe.
21 //
22 //
23 // Purpose:
24 // Perform edge detection on an image to create a clipping path. The image is
25 // converted to grayscale first, then to black and white using the threshold value,
26 // and then edges are created at every transition from white to black and black to white.
27 // These transitions form a polygon which are then smoothed into a bezier using the
28 // tolerance argument.
29 //
30 //========================================================================================
31 
32 #ifndef __IEdgeDetection__
33 #define __IEdgeDetection__
34 
35 #include "IPMUnknown.h"
36 #include "ImageDataTypes.h"
37 
38 class IPathGeometry;
39 class PMReal;
40 
41 const uint8 kEdgeDetection_default_threshold = 25;
42 
50 {
51 public:
52  virtual bool8 EdgeDetectionDo(const PMString& message, const PMReal& percentDone ) = 0;
53 };
54 
56 
63 class IEdgeDetection : public IPMUnknown
64 {
65 public:
66 
69  enum {
72  kAllowHoles = 1 << 0,
78  kDisplayMask = 1 << 2,
81  kForceHighRes = 1 << 3,
84  kForceProxy = 1 << 4
85  } ;
86 
102  virtual ErrorCode MaskToPolygon
103  (
104  const UIDRef& itemRef, // The image
105  IPathGeometry *pNew, // resulting paths
106  int16 channelIndex, // 0 = Composite, n = alpha channel number n-1.
107  int32 resolution, // The desired resolution of the path. Pass zero to indicate source resolution.
108  uint32 flags,
109  uint8 threshold, // Gray threshold between 0 and 255
110  PMReal tolerance, // How sloppy can we be. 0 will produce unsmoothed polygonal path
111  PMReal minPathSize, // Delete all paths with bounding box smaller than this size
112  EdgeDetectionProcPtr progressPtr,
113  ImagingTypes::ImageDataPtr imageMaskDataPtr = nullptr // The image mask
114  ) const = 0;
115 
116 };
117 #endif