acgs.h 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. //////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright 2015 Autodesk, Inc. All rights reserved.
  4. //
  5. // Use of this software is subject to the terms of the Autodesk license
  6. // agreement provided at the time of installation or download, or which
  7. // otherwise accompanies this software in either electronic or hard copy form.
  8. //
  9. //////////////////////////////////////////////////////////////////////////////
  10. //
  11. // DESCRIPTION: Header for Rx application definitions and C++
  12. // access to AutoCAD Graphics System.
  13. //
  14. //////////////////////////////////////////////////////////////////////////////
  15. #ifndef _ACGS_H
  16. #define _ACGS_H
  17. #include "adesk.h"
  18. #include "stdlib.h"
  19. #include "AdAChar.h"
  20. #include "acgitransient.h"
  21. #include "AcCoreDefs.h"
  22. #include "acgidefs.h"
  23. #pragma pack (push, 8)
  24. Adesk::Boolean acgsGetDisplayInfo (int & drawingWidth,
  25. int & drawingHeight,
  26. int & aspectWidth,
  27. int & aspectHeight);
  28. Adesk::Boolean acgsGetViewportInfo (int viewportNumber,
  29. int & left,
  30. int & bottom,
  31. int & right,
  32. int & top);
  33. class AcGiDrawable;
  34. // This class is returned to the user by acgsGetScreenShot, below.
  35. class AcGsScreenShot { // pure virtual, abstract
  36. public:
  37. virtual Adesk::Boolean getSize (int & width,
  38. int & height,
  39. int & depth) const = 0;
  40. virtual Adesk::Boolean getColorMap (int index,
  41. Adesk::UInt8 & red,
  42. Adesk::UInt8 & green,
  43. Adesk::UInt8 & blue) const = 0;
  44. virtual void const * getScanline (int offsetFromLeft,
  45. int offsetFromTop) const = 0;
  46. #ifdef new
  47. #define DISABLING_LEAK_CHECK
  48. #undef new
  49. #endif
  50. void * operator new (size_t size); // static
  51. // Be sure to delete your screen shot when you are through with it.
  52. void operator delete (void * p); // static
  53. #ifndef PRODUCTION
  54. void * operator new (size_t size, const char *, int) { return operator new(size); }
  55. #if _MSC_VER >= 1200
  56. // vc6 requires matching delete for each new
  57. void operator delete (void * p, const char *, int) { delete p; }
  58. #endif // vc6
  59. #endif // PRODUCTION
  60. #ifdef DISABLING_LEAK_CHECK
  61. #define new DEBUG_NEW
  62. #undef DISABLING_LEAK_CHECK
  63. #endif
  64. AcGsScreenShot();
  65. virtual ~AcGsScreenShot () = 0;
  66. };
  67. // Compatibility definition
  68. //
  69. #define ScreenShot AcGsScreenShot
  70. AcGsScreenShot * acgsGetScreenShot (int viewportNumber);
  71. void acgsSetViewportRenderFlag (int viewportNumber);
  72. Adesk::Boolean acgsDisplayImage (int viewportNumber,
  73. Adesk::Int32 originLeft,
  74. Adesk::Int32 originTop,
  75. int imageWidth,
  76. int imageHeight,
  77. void const * imageData,
  78. int hasTransparency);
  79. Adesk::Boolean acgsRemoveAnonymousGraphics (int viewportNumber);
  80. typedef void (*acgsCustomUpdateMethod) (void * pParm, int left, int right, int bottom, int top);
  81. Adesk::Boolean acgsSetCustomUpdateMethod (acgsCustomUpdateMethod custom_update_method, void * pParm);
  82. ACCORE_PORT void acgsRedrawShortTermGraphics (int minx, int miny, int maxx, int maxy);
  83. struct AcGs
  84. {
  85. enum LinePattern { eSolid = 0,
  86. eDashed = 1,
  87. eDotted = 2,
  88. eDashDot = 3,
  89. eShortDash = 4,
  90. eMediumDash = 5,
  91. eLongDash = 6,
  92. eDoubleShortDash = 7,
  93. eDoubleMediumDash = 8,
  94. eDoubleLongDash = 9,
  95. eMediumLongDash = 10,
  96. eMediumDashShortDashShortDash = 11,
  97. eLongDashShortDash = 12,
  98. eLongDashDotDot = 13,
  99. eLongDashDot = 14,
  100. eMediumDashDotShortDashDot = 15,
  101. eSparseDot = 16,
  102. eDefaultLinePattern = eDotted };
  103. };
  104. ACCORE_PORT void acgsSetHighlightColor (Adesk::UInt16 colorIndex);
  105. ACCORE_PORT Adesk::UInt16 acgsGetHighlightColor (void);
  106. ACCORE_PORT void acgsSetHighlightLinePattern (AcGs::LinePattern pattern);
  107. ACCORE_PORT AcGs::LinePattern acgsGetHighlightLinePattern (void);
  108. ACCORE_PORT void acgsSetHighlightLineWeight (Adesk::UInt16 weight);
  109. ACCORE_PORT Adesk::UInt16 acgsGetHighlightLineWeight (void);
  110. ACCORE_PORT void acgsSetHighlightStyle (AcGiHighlightStyle style);
  111. ACCORE_PORT AcGiHighlightStyle acgsGetHighlightStyle (void);
  112. class AcGsView;
  113. class AcGsModel;
  114. class AcGsManager;
  115. Adesk::Boolean acgsSetViewParameters (int viewportNumber, const AcGsView * pView,
  116. bool bRegenRequired, bool bRescaleRequired,
  117. bool bSyncRequired = false);
  118. Adesk::Boolean acgsGetViewParameters (int viewportNumber, AcGsView * pView);
  119. Adesk::Boolean acgsSetLensLength (int viewportNumber, const double & lensLength);
  120. Adesk::Boolean acgsGetLensLength (int viewportNumber, double & lensLength);
  121. void acgsWriteViewToUndoController (int viewportNumber);
  122. Adesk::Boolean acgsSetView2D (int viewportNumber);
  123. ACCORE_PORT AcGsView *acgsGetCurrentAcGsView(int vpNum); // return nullptr if none exists.
  124. ACCORE_PORT AcGsView *acgsGetCurrent3dAcGsView(int vpNum); // return nullptr if none exists.
  125. ACCORE_PORT AcGsView *acgsObtainAcGsView(int vpNum, const class AcGsKernelDescriptor &); // create if necessary.
  126. AcGsModel *acgsGetGsModel(AcGiTransientDrawingMode mode, int subDrawingMode, int viewportNumber);
  127. class CView;
  128. // Pass in NULL to get the AcGsManager associated with the current MDI Client Window;
  129. // otherwise, be sure that the passed in view is really an AutoCAD MDI Client window.
  130. AcGsManager * acgsGetGsManager (CView * pView = NULL);
  131. class AcGeVector3d;
  132. Adesk::Boolean acgsGetOrthoViewParameters (int viewportNumber,
  133. AcDb::OrthographicView view,
  134. AcGeVector3d * pViewDir,
  135. AcGeVector3d * pUpVector);
  136. // Use acgsCreate2DViewLimitManager and acgsDestroy2DViewLimitManager to
  137. // create and destroy instances of this pure virtual, abstract class
  138. class AcGs2DViewLimitManager
  139. {
  140. public:
  141. virtual ~AcGs2DViewLimitManager (void) { }
  142. virtual bool testView (AcGePoint3d const & target,
  143. double dFieldHeight) = 0;
  144. };
  145. AcGs2DViewLimitManager * acgsCreate2DViewLimitManager (int viewportNumber);
  146. void acgsDestroy2DViewLimitManager (AcGs2DViewLimitManager * pLimitManager);
  147. Adesk::Boolean acgsDrawableModified (AcGiDrawable *pDrawable,
  148. AcGiDrawable *pParentDrawable);
  149. Adesk::Boolean acgsDrawableErased (AcGiDrawable *pDrawable,
  150. AcGiDrawable *pParentDrawable);
  151. ACCORE_PORT Adesk::Boolean acgsDrawableCached (AcGiDrawable *pDrawable);
  152. #pragma pack (pop)
  153. #endif // _ACGS_H