*/}}

ourpaint.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  1. /*
  2. * Our Paint: A light weight GPU powered painting program.
  3. * Copyright (C) 2022-2023 Wu Yiming
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. #include "la_5.h"
  19. #ifndef OURPAINT_GIT_BRANCH
  20. #define OURPAINT_GIT_BRANCH "Release 1"
  21. #endif
  22. // No need to show hash when not compiled from git repo.
  23. //#ifndef OURPAINT_GIT_HASH
  24. //#define OURPAINT_GIT_HASH "?"
  25. //#endif
  26. extern unsigned char DATA_SPLASH[];
  27. extern unsigned char DATA_SPLASH_HIGHDPI[];
  28. #ifdef __cplusplus
  29. extern "C" {
  30. #endif
  31. extern const char OUR_SHADER_VERSION_430[];
  32. extern const char OUR_SHADER_VERSION_320ES[];
  33. extern const char OUR_CANVAS_SHADER[];
  34. extern const char OUR_COMPOSITION_SHADER[];
  35. extern const char OUR_SHADER_COMMON[];
  36. extern const char OUR_MIME[];
  37. extern const char OUR_THUMBNAILER[];
  38. extern const char OUR_DESKTOP[];
  39. extern const char OUR_PIGMENT_TEXTURE_MIX_SHADER[];
  40. extern const char OUR_PIGMENT_COMPOSITION_SHADER[];
  41. extern const char OUR_PIGMENT_TEXTURE_DISPLAY_SHADER[];
  42. extern const char OUR_PIGMENT_COMMON[];
  43. #ifdef __cplusplus
  44. } // extern "C"
  45. #endif
  46. #define OUR_AT_CROP_CENTER 0
  47. #define OUR_AT_CROP_L 1
  48. #define OUR_AT_CROP_R 2
  49. #define OUR_AT_CROP_U 3
  50. #define OUR_AT_CROP_B 4
  51. #define OUR_AT_CROP_UL 5
  52. #define OUR_AT_CROP_UR 6
  53. #define OUR_AT_CROP_BL 7
  54. #define OUR_AT_CROP_BR 8
  55. #define OUR_VERSION_MAJOR 0
  56. #define OUR_VERSION_MINOR 5
  57. #define OUR_VERSION_SUB 0
  58. #define OUR_PAINT_NAME_STRING "Our Paint v0.5"
  59. #define OUR_SIGNAL_PICK 1
  60. #define OUR_SIGNAL_MOVE 2
  61. #define OUR_SIGNAL_PICK 3
  62. #define OUR_SIGNAL_TOGGLE_ERASING 4
  63. #define OUR_SIGNAL_ZOOM_IN 5
  64. #define OUR_SIGNAL_ZOOM_OUT 6
  65. #define OUR_SIGNAL_BRUSH_BIGGER 7
  66. #define OUR_SIGNAL_BRUSH_SMALLER 8
  67. #define OUR_SIGNAL_TOGGLE_SKETCH 9
  68. #define OUR_SIGNAL_SELECT_BRUSH_SIZE_0 10
  69. #define OUR_SIGNAL_SELECT_BRUSH_SIZE_1 11
  70. #define OUR_SIGNAL_SELECT_BRUSH_SIZE_2 12
  71. #define OUR_SIGNAL_SELECT_BRUSH_SIZE_3 13
  72. #define OUR_SIGNAL_SELECT_BRUSH_SIZE_4 14
  73. #define OUR_SIGNAL_SELECT_BRUSH_SIZE_5 15
  74. #define OUR_SIGNAL_SELECT_BRUSH_SIZE_6 16
  75. #define OUR_SIGNAL_SELECT_BRUSH_SIZE_7 17
  76. #define OUR_SIGNAL_SELECT_BRUSH_SIZE_8 18
  77. #define OUR_SIGNAL_SELECT_BRUSH_SIZE_9 19
  78. #define OUR_SIGNAL_SELECT_BRUSH_SIZE_FREE 20
  79. #define OUR_SIGNAL_ADJUST 21
  80. #define OUR_SIGNAL_SELECT_BRUSH_ID_0 22
  81. #define OUR_SIGNAL_SELECT_BRUSH_ID_1 23
  82. #define OUR_SIGNAL_SELECT_BRUSH_ID_2 24
  83. #define OUR_SIGNAL_SELECT_BRUSH_ID_3 25
  84. #define OUR_SIGNAL_SELECT_BRUSH_ID_4 26
  85. #define OUR_SIGNAL_SELECT_BRUSH_ID_5 27
  86. #define OUR_SIGNAL_SELECT_BRUSH_ID_6 28
  87. #define OUR_SIGNAL_SELECT_BRUSH_ID_7 29
  88. #define OUR_SIGNAL_SELECT_BRUSH_ID_8 30
  89. #define OUR_SIGNAL_SELECT_BRUSH_ID_9 31
  90. extern laWidget* OUR_WIDGET_PIGMENT;
  91. extern laUiType* _OUR_UI_PIGMENT;
  92. #define OUR_COLOR_PAD_PIGMENT_DATA LA_UI_FLAGS_KNOB
  93. #define OURU Our->u
  94. STRUCTURE(OurCanvasDraw){
  95. laCanvasExtra Base;
  96. tnsOffscreen *OffScrSave;
  97. int HideBrushCircle;
  98. int AtCrop;
  99. real CanvasLastX,CanvasLastY;
  100. real CanvasDownX,CanvasDownY;
  101. real PointerX,PointerY,DownTilt;
  102. real LastPressure;
  103. real LastTilt[2];
  104. real LastTwist;
  105. real LastSize;
  106. int LastNumber;
  107. int MovedX,MovedY;
  108. };
  109. #define OUR_DPC (600*0.3937007874)
  110. #define OUR_SPECTRAL_SLICES 14
  111. #define OUR_MIXING_SPEED (Our->MixingSpeed/10.0f)
  112. #define OUR_TILE_W 1024
  113. #define OUR_TILES_PER_ROW 100
  114. #define OUR_TILE_CTR (OUR_TILES_PER_ROW/2)
  115. #define OUR_TILE_SEAM 12
  116. #define OUR_TILE_W_USE (OUR_TILE_W-OUR_TILE_SEAM*2)
  117. #define OUR_BRUSH_ACTUAL_SIZE(b) (Our->BrushNumber?Our->BrushBaseSize*pow(2,(real)Our->BrushNumber/2+(b?b->SizeOffset:0)):pow(2,Our->BrushSize+(b?b->SizeOffset:0)))
  118. #ifdef LA_USE_GLES
  119. #define OUR_PIX_COMPACT uint8_t
  120. #else
  121. #define OUR_PIX_COMPACT uint16_t
  122. #endif
  123. STRUCTURE(OurTexTile){
  124. tnsTexture* Texture;
  125. OUR_PIX_COMPACT* Data;
  126. int l,r,u,b;
  127. OUR_PIX_COMPACT* FullData;
  128. OUR_PIX_COMPACT* CopyBuffer;
  129. int cl,cr,cu,cb;
  130. };
  131. #define OUR_BLEND_NORMAL 0
  132. #define OUR_BLEND_ADD 1
  133. typedef struct OurLayerImageSegmented{
  134. uint32_t Sizes[32];
  135. int H[32];
  136. int Count; int Width,Height;
  137. }OurLayerImageSegmented;
  138. STRUCTURE(OurLayer){
  139. laListItem Item;
  140. laSafeString* Name;
  141. int OffsetX,OffsetY;
  142. real Transparency;
  143. int Lock;
  144. int Hide;
  145. int BlendMode;
  146. int AsSketch;
  147. OurTexTile** TexTiles[OUR_TILES_PER_ROW];
  148. OurLayerImageSegmented ReadSegmented;
  149. };
  150. STRUCTURE(OurLayerWrite){
  151. unsigned char* data;
  152. size_t NextData, MaxData;
  153. };
  154. STRUCTURE(OurLayerRead){
  155. unsigned char* data;
  156. size_t NextData;
  157. };
  158. STRUCTURE(OurBrushSettingsNode){
  159. laBaseNode Base;
  160. laNodeOutSocket* CanvasScale; real rCanvasScale;
  161. laNodeOutSocket* Size; real rSize;
  162. laNodeOutSocket* Transparency; real rTransparency;
  163. laNodeOutSocket* Hardness; real rHardness;
  164. laNodeOutSocket* Smudge; real rSmudge;
  165. laNodeOutSocket* DabsPerSize; real rDabsPerSize;
  166. laNodeOutSocket* SmudgeLength; real rSmudgeLength;
  167. laNodeOutSocket* SmudgeLifting;real rSmudgeLifting;
  168. laNodeOutSocket* Slender; real rSlender;
  169. laNodeOutSocket* Angle; real rAngle;
  170. laNodeOutSocket* Gunkyness; real rGunkyness;
  171. laNodeOutSocket* Accumulation; real rAccumulation;
  172. laNodeOutSocket* DepletionSpeed;real rDepletionSpeed;
  173. laNodeOutSocket* Force; real rForce;
  174. laNodeOutSocket* Color;
  175. laNodeOutSocket* Iteration; int rIteration;
  176. laNodeOutSocket* Custom1; real rCustom1;
  177. laNodeOutSocket* Custom2; real rCustom2;
  178. };
  179. STRUCTURE(OurBrushOutputsNode){
  180. laBaseNode Base;
  181. laNodeInSocket* Offset;
  182. laNodeInSocket* Size;
  183. laNodeInSocket* Transparency;
  184. laNodeInSocket* Hardness;
  185. laNodeInSocket* Smudge;
  186. laNodeInSocket* DabsPerSize;
  187. laNodeInSocket* SmudgeLength;
  188. laNodeInSocket* SmudgeLifting;
  189. laNodeInSocket* Slender;
  190. laNodeInSocket* Angle;
  191. laNodeInSocket* Color;
  192. laNodeInSocket* Gunkyness;
  193. laNodeInSocket* Accumulation;
  194. laNodeInSocket* DepletionSpeed;
  195. laNodeInSocket* Force;
  196. laNodeInSocket* Repeats;
  197. laNodeInSocket* Discard;
  198. };
  199. STRUCTURE(OurBrushDeviceNode){
  200. laBaseNode Base;
  201. laNodeOutSocket* Pressure; real rPressure;
  202. laNodeOutSocket* Position; real rPosition[2];
  203. laNodeOutSocket* Tilt; real rTilt[2];
  204. laNodeOutSocket* Twist; real rTwist;
  205. laNodeOutSocket* IsEraser; int rIsEraser;
  206. laNodeOutSocket* Speed; real rSpeed;
  207. laNodeOutSocket* Angle; real rAngle;
  208. laNodeOutSocket* Length; real rLength;
  209. laNodeOutSocket* LengthAccum; real rLengthAccum;
  210. laNodeOutSocket* PigmentLoading; real rPigmentLoading;
  211. };
  212. STRUCTURE(OurBrush){
  213. laListItem Item;
  214. laSafeString* Name; int Version;
  215. real SizeOffset;
  216. real DabsPerSize;
  217. real Hardness;
  218. real Transparency;
  219. real Smudge,SmudgeLifting;
  220. real SmudgeResampleLength; real SmudgeAccum; int SmudgeRestart; real BrushRemainingDist;
  221. real Slender;
  222. real Angle;
  223. real Force, Gunkyness;
  224. real Smoothness;
  225. real MaxStrokeLength;
  226. real Custom1,Custom2; laSafeString *Custom1Name,*Custom2Name;
  227. real Accumulation;
  228. real DepletionSpeed;
  229. int Iteration;
  230. int PressureSize,PressureHardness,PressureTransparency,PressureSmudge,PressureForce,
  231. TwistAngle,PressureDepletion,PressureAccumulation; // the simple way
  232. int Binding,DefaultAsEraser;
  233. int ShowInPages;
  234. real VisualOffset;
  235. real VisualOffsetAngle;
  236. int16_t OffsetFollowPenTilt;
  237. int16_t UseNodes; // the flexible way
  238. laRackPage* Rack;
  239. real LastX,LastY,LastAngle;
  240. real EvalColor[3];
  241. real EvalOffset[2];
  242. real EvalSize;
  243. real EvalDabsPerSize;
  244. real EvalHardness;
  245. real EvalTransparency;
  246. real EvalSmudge;
  247. real EvalSmudgeLength;
  248. real EvalSmudgeLifting;
  249. real EvalSlender;
  250. real EvalAngle;
  251. real EvalForce, EvalGunkyness;
  252. real EvalAccumulation;
  253. real EvalDepletionSpeed, PigmentLoading;
  254. real EvalSpeed;
  255. real EvalStrokeLength;
  256. real EvalStrokeLengthAccum;
  257. real EvalPressure;
  258. real EvalPosition[2];
  259. real EvalTilt[2];
  260. real EvalTwist;
  261. real EvalStrokeAngle;
  262. int EvalIsEraser;
  263. int EvalRepeats;
  264. int EvalDiscard;
  265. };
  266. STRUCTURE(OurDab){
  267. float X,Y;
  268. float Size;
  269. float Hardness;
  270. float Smudge, SmudgeLifting; int ResampleSmudge;
  271. float Color[4];
  272. float Slender;
  273. float Angle;
  274. float Direction[2];
  275. float Force;
  276. float Gunkyness;
  277. float Recentness;
  278. float Accumulation;
  279. };
  280. STRUCTURE(OurPigmentData){
  281. real Reflectance[16];
  282. real Absorption[16];
  283. real PreviewColor[3][4];
  284. };
  285. STRUCTURE(OurBrushData140){
  286. float Reflectance[64];
  287. float Absorption[64];
  288. };
  289. STRUCTURE(OurPigmentData140){
  290. float Reflectance[64];
  291. float Absorption[64];
  292. float PaperReflectance[64];
  293. float PaperAbsorption[64];
  294. };
  295. STRUCTURE(OurPigment){
  296. laListItem Item;
  297. laSafeString* Name;
  298. OurPigmentData Pigment;
  299. };
  300. STRUCTURE(OurLight){
  301. laListItem Item;
  302. laSafeString* Name;
  303. OurPigmentData Emission;
  304. };
  305. STRUCTURE(OurCanvasSurface){
  306. laListItem Item;
  307. laSafeString* Name;
  308. OurPigmentData Reflectance;
  309. };
  310. NEED_STRUCTURE(OurColorPalette);
  311. STRUCTURE(OurColorItem){
  312. laListItem Item;
  313. OurPigmentData Pigment;
  314. int IsPigment;
  315. OurColorPalette* Parent;
  316. };
  317. STRUCTURE(OurColorPalette){
  318. laListItem Item;
  319. laSafeString* Name;
  320. laListHandle Colors;
  321. };
  322. STRUCTURE(OurUndoTile){
  323. laListItem Item;
  324. int col,row;
  325. OUR_PIX_COMPACT* CopyData;
  326. int l,r,u,b;
  327. };
  328. STRUCTURE(OurUndo){
  329. OurLayer* Layer;
  330. laListHandle Tiles;
  331. };
  332. STRUCTURE(OurMoveUndo){
  333. OurLayer* Layer;
  334. int dx,dy;
  335. };
  336. #define OUR_TOOL_PAINT 0
  337. #define OUR_TOOL_CROP 1
  338. #define OUR_TOOL_MOVE 2
  339. #define OUR_PNG_READ_INPUT_FLAT 0
  340. #define OUR_PNG_READ_INPUT_ICC 1
  341. #define OUR_PNG_READ_INPUT_SRGB 2
  342. #define OUR_PNG_READ_INPUT_LINEAR_SRGB 3
  343. #define OUR_PNG_READ_INPUT_CLAY 4
  344. #define OUR_PNG_READ_INPUT_LINEAR_CLAY 5
  345. #define OUR_PNG_READ_INPUT_D65_P3 6
  346. #define OUR_PNG_READ_INPUT_LINEAR_D65_P3 7
  347. #define OUR_PNG_READ_OUTPUT_CANVAS 0
  348. #define OUR_PNG_READ_OUTPUT_LINEAR_SRGB OUR_PNG_READ_INPUT_LINEAR_SRGB
  349. #define OUR_PNG_READ_OUTPUT_LINEAR_CLAY OUR_PNG_READ_INPUT_LINEAR_CLAY
  350. #define OUR_PNG_READ_OUTPUT_LINEAR_D65_P3 OUR_PNG_READ_INPUT_LINEAR_D65_P3
  351. #define OUR_CANVAS_INTERPRETATION_SRGB 0
  352. #define OUR_CANVAS_INTERPRETATION_CLAY 1
  353. #define OUR_CANVAS_INTERPRETATION_D65_P3 2
  354. #define OUR_EXPORT_BIT_DEPTH_8 0
  355. #define OUR_EXPORT_BIT_DEPTH_16 1
  356. #define OUR_EXPORT_COLOR_MODE_SRGB 0
  357. #define OUR_EXPORT_COLOR_MODE_CLAY 1
  358. #define OUR_EXPORT_COLOR_MODE_FLAT 2
  359. #define OUR_EXPORT_COLOR_MODE_D65_P3 3
  360. #define OUR_BRUSH_PAGE_LIST 128
  361. STRUCTURE(OurPNGReadExtra){
  362. int Confirming;
  363. laSafeString* FilePath;
  364. laSafeString* iccName;
  365. int HassRGB;
  366. int HasProfile;
  367. int InputMode;
  368. int OutputMode;
  369. int Offsets[2];
  370. };
  371. STRUCTURE(OurPNGWriteExtra){
  372. int Confirming;
  373. laSafeString* FilePath;
  374. int BitDepth;
  375. int ColorProfile;
  376. int Transparent;
  377. int PigmentConversionMethod;
  378. int CropX,CropY,CropW,CropH;
  379. };
  380. STRUCTURE(OurThreadExportPNGData){
  381. uint32_t* r_sizes;
  382. void** pointers;
  383. int i;
  384. int segy,h;
  385. int fail;
  386. };
  387. typedef void (*our_XYZ2RGBFunc)(tnsVector3d xyz, tnsVector3d rgb);
  388. typedef void (*our_2LogRGBFunc)(tnsVector3d rgb);
  389. STRUCTURE(OurPigmentConversionData){
  390. int RowStart,RowCount;
  391. int cols;
  392. uint16_t *ImageConversionBuffer;
  393. our_XYZ2RGBFunc XYZ2RGB;
  394. };
  395. NEED_STRUCTURE(OurThreadImportPNGDataMain);
  396. STRUCTURE(OurThreadImportPNGData){
  397. OurThreadImportPNGDataMain* main;
  398. void* data;
  399. OurLayer* l;
  400. int starty;
  401. };
  402. STRUCTURE(OurThreadImportPNGDataMain){
  403. OurThreadImportPNGData* data;
  404. int next,max;
  405. SYSLOCK lock;
  406. };
  407. STRUCTURE(OurUsePigment){
  408. laListItem Item;
  409. OurPigment* pigment;
  410. };
  411. STRUCTURE(BrushUniforms){
  412. GLint uCanvasType;
  413. GLint uCanvasRandom;
  414. GLint uCanvasFactor;
  415. GLint uImageOffset;
  416. GLint uBrushCorner;
  417. GLint uBrushCenter;
  418. GLint uBrushSize;
  419. GLint uBrushHardness;
  420. GLint uBrushSmudge;
  421. GLint uBrushRecentness;
  422. GLint uBrushColor;
  423. GLint uBrushSlender;
  424. GLint uBrushAngle;
  425. GLint uBrushDirection;
  426. GLint uBrushForce;
  427. GLint uBrushGunkyness;
  428. GLint uBrushRoutineSelection;
  429. GLint uBrushRoutineSelectionES;
  430. GLint uMixRoutineSelection;
  431. GLint uMixRoutineSelectionES;
  432. GLint uBrushErasing;
  433. GLint uBrushMix;
  434. GLint uBrushSmudgeLifting;
  435. GLint RoutineDoDabs;
  436. GLint RoutineDoSample;
  437. GLint RoutineDoMixNormal;
  438. GLint RoutineDoMixSpectral;
  439. GLint uBlendMode;
  440. GLint uAlphaTop;
  441. GLint uAlphaBottom;
  442. GLsizei SubroutineUniformLocations;
  443. GLint uMixingTop;
  444. };
  445. STRUCTURE(OurPaint){
  446. real pad;
  447. laListHandle CanvasSaverDummyList;
  448. laProp* CanvasSaverDummyProp;
  449. laListHandle BadEvents;
  450. tnsImage* SplashImage;
  451. tnsImage* SplashImageHigh;
  452. laListHandle Palettes;
  453. OurColorPalette* CurrentPalette;
  454. laListHandle Layers;
  455. OurLayer* CurrentLayer;
  456. laListHandle Brushes;
  457. OurBrush* CurrentBrush;
  458. laListHandle Pigments;
  459. OurPigment* CurrentPigment;
  460. laListHandle Lights;
  461. laListHandle CanvasSurfaces;
  462. real SaveBrushSize,SaveEraserSize;
  463. OurDab* Dabs; int NextDab,MaxDab;
  464. float LastBrushCenter[2];
  465. int CanvasVersion;
  466. laSafeString* Notes;
  467. real Smoothness,Hardness;
  468. real MixingSpeed;
  469. real LastX, LastY;
  470. real CurrentScale;
  471. real DefaultScale;
  472. int BrushNumber;
  473. real BrushBaseSize;
  474. real BrushSize;
  475. int BrushPage;
  476. int Tool,ActiveTool,Erasing,EventErasing,BrushMix;
  477. int LockBackground;
  478. int BackgroundType;
  479. int BackgroundRandom;
  480. real BackgroundFactor;
  481. int PenID,EraserID;
  482. int X,Y,W,H; //border
  483. real BorderFadeWidth;
  484. int ColorInterpretation;
  485. int ShowBorder,UseBorder;
  486. int ShowTiles;
  487. int BrushCircleTiltMode;
  488. int AllowNonPressure,PaintProcessedEvents;
  489. int BadEventsLimit,BadEventCount,BadEventsGiveUp;
  490. int EnableBrushCircle,ShowBrushName,ShowBrushNumber;
  491. int EventHasTwist; real EventTwistAngle; real EventTiltOrientation;
  492. int DefaultBitDepth;
  493. int DefaultColorProfile;
  494. int PaintUndoLimit;
  495. int SpectralMode;
  496. int PigmentMode;
  497. int BrushNumbersOnHeader;
  498. int MixModeOnHeader;
  499. int ToolsOnHeader;
  500. int UndoOnHeader;
  501. int LightsOnHeader;
  502. int SketchMode;
  503. int SegmentedWrite;
  504. int PigmentDisplayMethod;
  505. int PaletteInColorsPanel;
  506. int DefaultCanvasType;
  507. int ToolUndo;
  508. tnsTexture* SmudgeTexture;
  509. GLuint CanvasShader; GLuint CanvasProgram;
  510. GLuint CanvasStraightShader; GLuint CanvasStraightProgram;
  511. GLuint CanvasPigmentShader; GLuint CanvasPigmentProgram;
  512. GLuint CompositionShader; GLuint CompositionProgram;
  513. GLuint CompositionStraightShader; GLuint CompositionStraightProgram;
  514. GLuint LayerShader; GLuint LayerProgram;
  515. GLuint DisplayShader; GLuint DisplayProgram;
  516. GLuint PigmentCompositionShader; GLuint PigmentCompositionProgram;
  517. GLuint PigmentLayeringShader; tnsShader* PigmentLayeringProgramT;
  518. GLuint PigmentDisplayShader; tnsShader* PigmentDisplayProgramT;
  519. GLuint uPigmentFragOffset,uPigmentTextureScale,uPigmentDisplayMode;
  520. GLint uboBrushPigment,uboBrushPigmentLocation;
  521. GLint uboCanvasPigment,uboCanvasPigmentLocation;
  522. BrushUniforms *u,uRGBA,uRGBStraightA,uPigment;
  523. int AlphaMode;
  524. int ReorderPigmnets;
  525. OurCanvasSurface *CanvasSurface; // not ptr to list
  526. OurLight *CanvasLight;
  527. OurPigmentData PickedPigment;
  528. OurPigmentData MixedPigment;
  529. laListHandle UsePigments;
  530. OurPigment* UseWhite;
  531. OurPigment* UseBlack;
  532. real CurrentColor[3];
  533. real BackgroundColor[3];
  534. uint16_t BColorU16[4];
  535. uint8_t BColorU8[4];
  536. real BorderAlpha;
  537. int ShowStripes;
  538. int ShowGrid;
  539. int ShowRef;
  540. int RefSize;
  541. int RefCategory;
  542. int RefOrientation;
  543. int RefCutHalf;
  544. real RefMargins[3],RefPaddings[2];
  545. int RefBiases[2];
  546. real RefAlpha;
  547. real xmin,xmax,ymin,ymax; // stroke bbox for undo region
  548. int ResetBrush;
  549. int SaveFailed;
  550. int FileRegistered;
  551. uint16_t *ImageBuffer;
  552. int ImageW,ImageH,ImageX,ImageY,LoadX,LoadY,TempLoadX,TempLoadY;
  553. uint8_t* ThumbnailBuffer;
  554. void* icc_LinearsRGB; int iccsize_LinearsRGB;
  555. void* icc_LinearClay; int iccsize_LinearClay;
  556. void* icc_LinearD65P3; int iccsize_LinearD65P3;
  557. void* icc_sRGB; int iccsize_sRGB;
  558. void* icc_Clay; int iccsize_Clay;
  559. void* icc_D65P3; int iccsize_D65P3;
  560. void* ProofTablesRGB, *ProofTableClay, *ProofTableD65;
  561. };
  562. int ourProcessInitArgs(int argc, char* argv[]);
  563. int ourInit();
  564. void ourFinalize();
  565. void ourRegisterNodes();
  566. int ourRebuildBrushEval();
  567. int ourEvalBrush();
  568. void ourMakeTranslations_zh_hans();
  569. void ourMakeTranslations_es_ES();
  570. void our_EnableSplashPanel();