@PanelImageEditor.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. /******************************************************************************/
  2. /******************************************************************************/
  3. class PanelImageEditor : PropWin
  4. {
  5. class Params : EditPanelImage
  6. {
  7. };
  8. class Change : Edit::_Undo::Change
  9. {
  10. EditPanelImage data;
  11. virtual void create(ptr user)override;
  12. virtual void apply(ptr user)override;
  13. };
  14. UID elm_id;
  15. Elm *elm;
  16. bool changed;
  17. flt props_w, prop_h, prop_x;
  18. Params params;
  19. PanelImage panel_image;
  20. Image soft, depth;
  21. Button undo, redo, locate, copy, paste, draw_depth, draw_lines;
  22. Region region;
  23. Tabs preview_mode;
  24. TextLine filter;
  25. ViewportSkin viewport;
  26. SyncEvent event;
  27. Thread thread;
  28. SyncLock lock;
  29. cptr force_undo_change_type;
  30. Edit::Undo<Change> undos; void undoVis();
  31. ~PanelImageEditor(); // delete thread before other members
  32. static void Preview(Viewport &viewport);
  33. void preview();
  34. void drawDepth(C Rect &rect);
  35. static bool Make(Thread &thread);
  36. bool make();
  37. static void Undo (PanelImageEditor &editor);
  38. static void Redo (PanelImageEditor &editor);
  39. static void Locate(PanelImageEditor &editor);
  40. static void Copy (PanelImageEditor &editor);
  41. static void Paste (PanelImageEditor &editor);
  42. C Rect& rect( )C; // set/get rectangle
  43. virtual PanelImageEditor& rect(C Rect &rect)override;
  44. static void PreChanged(C Property &prop);
  45. static void Changed(C Property &prop);
  46. static void SetCutLeft (Params &p, C Str &t);
  47. static void SetCutRight (Params &p, C Str &t);
  48. static void SetCutTop (Params &p, C Str &t);
  49. static void SetCutBottom(Params &p, C Str &t);
  50. static void SetCutCorner00(Params &p, C Str &t);
  51. static void SetCutCorner01(Params &p, C Str &t);
  52. static void SetCutCorner10(Params &p, C Str &t);
  53. static void SetCutCorner11(Params &p, C Str &t);
  54. static void SetCutCornerSlope (Params &p, C Str &t);
  55. static void SetCutCornerAmount(Params &p, C Str &t);
  56. static void SetForceUniformStretch0(Params &p, C Str &t);
  57. static void SetForceUniformStretch1(Params &p, C Str &t);
  58. static void SetCompressed (Params &p, C Str &t);
  59. static void SetMipMaps (Params &p, C Str &t);
  60. static void SetResolution (Params &p, C Str &t);
  61. static void SetWidth (Params &p, C Str &t);
  62. static void SetHeight (Params &p, C Str &t);
  63. static void SetRoundCorners (Params &p, C Str &t);
  64. static void SetLeftSlope (Params &p, C Str &t);
  65. static void SetRightSlope (Params &p, C Str &t);
  66. static void SetBorderSize (Params &p, C Str &t);
  67. static void SetMaxSideStretch(Params &p, C Str &t);
  68. static void SetExtend (Params &p, C Str &t);
  69. static void ExtendInnerPaddLR( Params &p, C Str &t);
  70. static Str ExtendInnerPaddLR(C Params &p );
  71. static void ExtendInnerPaddT ( Params &p, C Str &t);
  72. static Str ExtendInnerPaddT (C Params &p );
  73. static void ExtendInnerPaddB ( Params &p, C Str &t);
  74. static Str ExtendInnerPaddB (C Params &p );
  75. static void SetColor (Params &p, C Str &t);
  76. static void SetColorTop (Params &p, C Str &t);
  77. static void SetColorBottom(Params &p, C Str &t);
  78. static void SetColorLeft (Params &p, C Str &t);
  79. static void SetColorRight (Params &p, C Str &t);
  80. static void SetOuterGlowColor (Params &p, C Str &t);
  81. static void SetOuterGlowRadius(Params &p, C Str &t);
  82. static void SetOuterGlowSpread(Params &p, C Str &t);
  83. static void SetInnerGlowColor (Params &p, C Str &t);
  84. static void SetInnerGlowRadius(Params &p, C Str &t);
  85. static void SetDepth (Params &p, C Str &t);
  86. static void SetRoundDepth (Params &p, C Str &t);
  87. static void SetInnerDistance(Params &p, C Str &t);
  88. static void SetSmoothDepth (Params &p, C Str &t);
  89. static void SetShadowRadius (Params &p, C Str &t);
  90. static void SetShadowOpacity(Params &p, C Str &t);
  91. static void SetShadowSpread (Params &p, C Str &t);
  92. static Str SetTopImage(C Params &p );
  93. static void SetTopImage( Params &p, C Str &t);
  94. static Str SetBottomImage(C Params &p );
  95. static void SetBottomImage( Params &p, C Str &t);
  96. static Str SetCenterImage(C Params &p );
  97. static void SetCenterImage( Params &p, C Str &t);
  98. static Str SetLeftImage(C Params &p );
  99. static void SetLeftImage( Params &p, C Str &t);
  100. static Str SetRightImage(C Params &p );
  101. static void SetRightImage( Params &p, C Str &t);
  102. static Str SetTopLeftImage(C Params &p );
  103. static void SetTopLeftImage( Params &p, C Str &t);
  104. static Str SetTopRightImage(C Params &p );
  105. static void SetTopRightImage( Params &p, C Str &t);
  106. static Str SetBottomLeftImage(C Params &p );
  107. static void SetBottomLeftImage( Params &p, C Str &t);
  108. static Str SetBottomRightImage(C Params &p );
  109. static void SetBottomRightImage( Params &p, C Str &t);
  110. static void SetImagesSize (Params &p, C Str &t);
  111. static void SetTopHeight (Params &p, C Str &t);
  112. static void SetBottomHeight (Params &p, C Str &t);
  113. static void SetLeftRightWidth (Params &p, C Str &t);
  114. static void SetTopCornerWidth (Params &p, C Str &t);
  115. static void SetBottomCornerWidth(Params &p, C Str &t);
  116. static void SetAmbientLight(Params &p, C Str &t);
  117. template<int i> static void LightEnabled (Params &p, C Str &t);
  118. template<int i> static void LightAngle (Params &p, C Str &t);
  119. template<int i> static void LightIntensity (Params &p, C Str &t);
  120. template<int i> static void LightBack (Params &p, C Str &t);
  121. template<int i> static void LightHighlight (Params &p, C Str &t);
  122. template<int i> static void LightHighlightCut (Params &p, C Str &t);
  123. template<int i> static void LightSpecular (Params &p, C Str &t);
  124. template<int i> static void LightSpecularBack (Params &p, C Str &t);
  125. template<int i> static void LightSpecularExp (Params &p, C Str &t);
  126. template<int i> static void LightSpecularHighlight (Params &p, C Str &t);
  127. template<int i> static void LightSpecularHighlightCut(Params &p, C Str &t);
  128. template<int i> static void SectionSize (Params &p, C Str &t);
  129. template<int i> static void SectionTopOffset(Params &p, C Str &t);
  130. template<int i> static void SectionRoundDepth (Params &p, C Str &t);
  131. template<int i> static void SectionOuterDepth (Params &p, C Str &t);
  132. template<int i> static void SectionInnerDepth (Params &p, C Str &t);
  133. template<int i> static void SectionInnerDistance(Params &p, C Str &t);
  134. template<int i> static void SectionSmoothDepth (Params &p, C Str &t);
  135. template<int i> static void SectionSpecular (Params &p, C Str &t);
  136. template<int i> static void SectionColor (Params &p, C Str &t);
  137. template<int i> static void SectionOuterColor (Params &p, C Str &t);
  138. template<int i> static void SectionInnerColor (Params &p, C Str &t);
  139. template<int i> static void SectionColorTop (Params &p, C Str &t);
  140. template<int i> static void SectionColorBottom (Params &p, C Str &t);
  141. template<int i> static void SectionColorLeft (Params &p, C Str &t);
  142. template<int i> static void SectionColorRight (Params &p, C Str &t);
  143. template<int i> static void SectionOuterBorderColor(Params &p, C Str &t);
  144. template<int i> static void SectionInnerBorderColor(Params &p, C Str &t);
  145. template<int i> static void SectionPrevBorderColor (Params &p, C Str &t);
  146. template<int i> static Str SectionDepthOverlay (C Params &p );
  147. template<int i> static void SectionDepthOverlay (Params &p, C Str &t);
  148. template<int i> static void SectionDepthOverlayBlur (Params &p, C Str &t);
  149. template<int i> static void SectionDepthOverlayBlurClamp(Params &p, C Str &t);
  150. template<int i> static void SectionDepthOverlayUVScale (Params &p, C Str &t);
  151. template<int i> static void SectionDepthOverlayUVOffset (Params &p, C Str &t);
  152. template<int i> static void SectionDepthOverlayIntensity(Params &p, C Str &t);
  153. template<int i> static void SectionDepthOverlayMode (Params &p, C Str &t);
  154. template<int i> static void SectionDepthNoiseBlur (Params &p, C Str &t);
  155. template<int i> static void SectionDepthNoiseUVScale (Params &p, C Str &t);
  156. template<int i> static void SectionDepthNoiseIntensity(Params &p, C Str &t);
  157. template<int i> static void SectionDepthNoiseMode (Params &p, C Str &t);
  158. template<int i> static Str SectionColorOverlay (C Params &p );
  159. template<int i> static void SectionColorOverlay (Params &p, C Str &t);
  160. template<int i> static void SectionColorOverlayBlur (Params &p, C Str &t);
  161. template<int i> static void SectionColorOverlayBlurClamp(Params &p, C Str &t);
  162. template<int i> static void SectionColorOverlayUVScale (Params &p, C Str &t);
  163. template<int i> static void SectionColorOverlayUVOffset (Params &p, C Str &t);
  164. template<int i> static void SectionColorOverlayUVWarp (Params &p, C Str &t);
  165. template<int i> static void SectionColorOverlayIntensity(Params &p, C Str &t);
  166. template<int i> static void SectionColorOverlayMode (Params &p, C Str &t);
  167. template<int i> static void SectionColorNoiseBlur (Params &p, C Str &t);
  168. template<int i> static void SectionColorNoiseUVScale (Params &p, C Str &t);
  169. template<int i> static void SectionColorNoiseUVWarp (Params &p, C Str &t);
  170. template<int i> static void SectionColorNoiseIntensity(Params &p, C Str &t);
  171. template<int i> static void SectionColorNoiseMode (Params &p, C Str &t);
  172. template<int i> static Str SectionReflection (C Params &p );
  173. template<int i> static void SectionReflection (Params &p, C Str &t);
  174. template<int i> static void SectionReflectionIntensity(Params &p, C Str &t);
  175. static cchar8 *image_modes[]
  176. ; ASSERT(PanelImageParams::ImageParams::MULTIPLY==0 && PanelImageParams::ImageParams::SCALE==1 && PanelImageParams::ImageParams::ADD==2 && PanelImageParams::ImageParams::ADD_SIGNED==3 && PanelImageParams::ImageParams::BLEND==4);
  177. static void Filter(PanelImageEditor &editor);
  178. void create();
  179. void toGui();
  180. void stopThread();
  181. void refresh ();
  182. virtual PanelImageEditor& del () override;
  183. virtual PanelImageEditor& hide() override;
  184. virtual Rect sizeLimit()C override;
  185. void flush();
  186. void setChanged();
  187. void set(Elm *elm);
  188. void activate(Elm *elm);
  189. void toggle (Elm *elm);
  190. void elmChanged(C UID &panel_image_id);
  191. void erasing(C UID &elm_id);
  192. public:
  193. PanelImageEditor();
  194. };
  195. /******************************************************************************/
  196. /******************************************************************************/
  197. extern PanelImageEditor PanelImageEdit;
  198. /******************************************************************************/