InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
IDVPlatformOffscreen.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Deepak Gupta
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 // Core interface around Platform offscreen drawing environments
24 //
25 //========================================================================================
26 
27 #ifndef __IDVPlatformOffscreen__
28 #define __IDVPlatformOffscreen__
29 
30 #include "GRRefCountedObj.h"
31 #include "InterfacePtr.h"
32 
33 #ifdef WASM
34 #include "WasmDrawbot.h"
35 #else
36 #include "DVAForwardDeclarations.h"
37 #endif
38 
44 #ifndef WASM
45 typedef boost::intrusive_ptr<dvaui::drawbot::ImageInterface> ImageInterfaceP;
46 #endif
47 
60 {
61 public:
65  virtual dvaui::drawbot::Drawbot* GetOffscreenDrawbot() const = 0;
66 
71  virtual void GetOrigin(int32* x, int32* y) const = 0;
72 
77  virtual void SetOrigin(int32 x, int32 y) = 0;
78 
79 
86 // virtual void CopyBitsIntoOffscreen(const dvaui::drawbot::Drawbot* srcDrawbot, const Int32Rect &srcBounds, const Int32Rect &dstBounds, const SysRgn clipRgn = nil) = 0;
87 
94  virtual void CopyBitsFromOffscreen(dvaui::drawbot::Drawbot* dstDrawbot, const Int32Rect &srcBounds, const Int32Rect &dstBounds, const PMMatrix& clip2destMatrix = PMMatrix(), const SysRgn clipRgn = nil,
95  int debug_cookie = 0, const char* debug_string = 0, void* debug_address = 0 //Ichabod temporary debugging code
96  ) = 0;
97 
98 
105 // virtual void CopyBitsIntoOffscreen(IDVPlatformOffscreen* srcDVPlatformOffscreen, const Int32Rect &srcBounds, const Int32Rect &dstBounds, const SysRgn clipRgn = nil) = 0;
106 
113  virtual void CopyBitsFromOffscreen(IDVPlatformOffscreen* dstDVPlatformOffscreen, const Int32Rect &srcBounds, const Int32Rect &dstBounds, const PMMatrix& clip2destMatrix = PMMatrix(), const SysRgn clipRgn = nil,
114  int debug_cookie = 0, const char* debug_string = 0, void* debug_address = 0 //Ichabod temporary debugging code
115  ) = 0;
116 
117 
121  virtual const Int32Rect& GetBounds() = 0;
122 
129  virtual void GetPlatformBitmapInfo(void** baseAddr, uint32* rowBytes, Int32Rect* portRect, uint32* bitsPerPixel = nil) = 0;
130 
134  virtual int32 OffscreenError() = 0;
135 
145  virtual bool16 UpdateBitmap(const Int32Rect& bounds, PMReal uiScaleFactor = 1.0) = 0;
146 
153  virtual bool16 UpdateBitmapIfDifferent(const Int32Rect& bounds, PMReal uiScaleFactor = 1.0) = 0;
154 
158  virtual PMReal GetCurrentUIScaleFactorReal() = 0;
159 
167  virtual void CopyBitsFromOffscreen(dvaui::drawbot::Drawbot* dstDrawbot, const Int32Rect &srcBounds, const PMRect &dstBounds,
168  const PMMatrix& clip2destMatrix, const dvaui::drawbot::PathP path,
169  int debug_cookie = 0, const char* debug_string = 0, void* debug_address = 0 //Ichabod temporary debugging code
170  ) = 0;
171 };
172 
173 
178 template <>
180 {
181 public:
187  : fFace(pFace) {}
188 
191  {
192  if (fFace != nil){
193  //const_cast<IDVPlatformOffscreen *>(unknown)->Release();
194  fFace->Release();
195  }
196  }
197 
198  operator IDVPlatformOffscreen*() const
199  { return fFace; }
200  // We allow the cast operator to return a nil pointer
201  // since it is valid to test against nil and may be valid
202  // to pass a nil pointer to some methods.
203 
204 
206  {
207  #ifdef DEBUG
208  ASSERT_MSG(fFace != nil,"About to use nil interface ptr!");
209  #endif
210  return fFace;
211  }
212 
213 private:
214  IDVPlatformOffscreen * fFace;
215 
216  // If you feel you need one of these, let me know. Thx. - Zak
217  // For the sake of clarity and simplicity, they're currently not supported.
218 
219  InterfacePtr(void);
220  InterfacePtr(const InterfacePtr<IDVPlatformOffscreen>& IDVPlatformOffscreenPtr);
221  InterfacePtr<IDVPlatformOffscreen>& operator=(const InterfacePtr<IDVPlatformOffscreen>& IDVPlatformOffscreenPtr);
223 
224 };
225 
226 #endif