*/}}

ourpaint.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  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. #define OUR_PIX_MAX 255
  121. #else
  122. #define OUR_PIX_COMPACT uint16_t
  123. #define OUR_PIX_MAX 65535
  124. #endif
  125. STRUCTURE(OurTexTile){
  126. tnsTexture* Texture;
  127. OUR_PIX_COMPACT* Data;
  128. int l,r,u,b;
  129. OUR_PIX_COMPACT* FullData;
  130. OUR_PIX_COMPACT* CopyBuffer;
  131. int cl,cr,cu,cb;
  132. };
  133. #define OUR_BLEND_NORMAL 0
  134. #define OUR_BLEND_ADD 1
  135. #define OUR_BLEND_MULTIPLY 2
  136. typedef struct OurLayerImageSegmented{
  137. uint32_t Sizes[32];
  138. int H[32];
  139. int Count; int Width,Height;
  140. }OurLayerImageSegmented;
  141. STRUCTURE(OurLayer){
  142. laListItem Item;
  143. laSafeString* Name;
  144. int OffsetX,OffsetY;
  145. real Transparency;
  146. int Lock;
  147. int Hide;
  148. int BlendMode;
  149. int AsSketch;
  150. OurTexTile** TexTiles[OUR_TILES_PER_ROW];
  151. OurLayerImageSegmented ReadSegmented;
  152. };
  153. STRUCTURE(OurLayerWrite){
  154. unsigned char* data;
  155. size_t NextData, MaxData;
  156. };
  157. STRUCTURE(OurLayerRead){
  158. unsigned char* data;
  159. size_t NextData;
  160. };
  161. STRUCTURE(OurBrushSettingsNode){
  162. laBaseNode Base;
  163. laNodeOutSocket* CanvasScale; real rCanvasScale;
  164. laNodeOutSocket* Size; real rSize;
  165. laNodeOutSocket* Transparency; real rTransparency;
  166. laNodeOutSocket* Hardness; real rHardness;
  167. laNodeOutSocket* Smudge; real rSmudge;
  168. laNodeOutSocket* DabsPerSize; real rDabsPerSize;
  169. laNodeOutSocket* SmudgeLength; real rSmudgeLength;
  170. laNodeOutSocket* SmudgeLifting;real rSmudgeLifting;
  171. laNodeOutSocket* Slender; real rSlender;
  172. laNodeOutSocket* Angle; real rAngle;
  173. laNodeOutSocket* Gunkyness; real rGunkyness;
  174. laNodeOutSocket* Accumulation; real rAccumulation;
  175. laNodeOutSocket* DepletionSpeed;real rDepletionSpeed;
  176. laNodeOutSocket* Force; real rForce;
  177. laNodeOutSocket* Color;
  178. laNodeOutSocket* Iteration; int rIteration;
  179. laNodeOutSocket* Custom1; real rCustom1;
  180. laNodeOutSocket* Custom2; real rCustom2;
  181. };
  182. STRUCTURE(OurBrushOutputsNode){
  183. laBaseNode Base;
  184. laNodeInSocket* Offset;
  185. laNodeInSocket* Size;
  186. laNodeInSocket* Transparency;
  187. laNodeInSocket* Hardness;
  188. laNodeInSocket* Smudge;
  189. laNodeInSocket* DabsPerSize;
  190. laNodeInSocket* SmudgeLength;
  191. laNodeInSocket* SmudgeLifting;
  192. laNodeInSocket* Slender;
  193. laNodeInSocket* Angle;
  194. laNodeInSocket* Color;
  195. laNodeInSocket* Gunkyness;
  196. laNodeInSocket* Accumulation;
  197. laNodeInSocket* DepletionSpeed;
  198. laNodeInSocket* Force;
  199. laNodeInSocket* Repeats;
  200. laNodeInSocket* Discard;
  201. };
  202. STRUCTURE(OurBrushDeviceNode){
  203. laBaseNode Base;
  204. laNodeOutSocket* Pressure; real rPressure;
  205. laNodeOutSocket* Position; real rPosition[2];
  206. laNodeOutSocket* Tilt; real rTilt[2];
  207. laNodeOutSocket* Twist; real rTwist;
  208. laNodeOutSocket* IsEraser; int rIsEraser;
  209. laNodeOutSocket* Speed; real rSpeed;
  210. laNodeOutSocket* Angle; real rAngle;
  211. laNodeOutSocket* Length; real rLength;
  212. laNodeOutSocket* LengthAccum; real rLengthAccum;
  213. laNodeOutSocket* PigmentLoading; real rPigmentLoading;
  214. };
  215. STRUCTURE(OurBrush){
  216. laListItem Item;
  217. laSafeString* Name; int Version;
  218. real SizeOffset;
  219. real DabsPerSize;
  220. real Hardness;
  221. real Transparency;
  222. real Smudge,SmudgeLifting;
  223. real SmudgeResampleLength; real SmudgeAccum; int SmudgeRestart; real BrushRemainingDist;
  224. real Slender;
  225. real Angle;
  226. real Force, Gunkyness;
  227. real Smoothness;
  228. real MaxStrokeLength;
  229. real Custom1,Custom2; laSafeString *Custom1Name,*Custom2Name;
  230. real Accumulation;
  231. real DepletionSpeed;
  232. int Iteration;
  233. int PressureSize,PressureHardness,PressureTransparency,PressureSmudge,PressureForce,
  234. TwistAngle,PressureDepletion,PressureAccumulation; // the simple way
  235. int Binding,DefaultAsEraser;
  236. int ShowInPages;
  237. real VisualOffset;
  238. real VisualOffsetAngle;
  239. int16_t OffsetFollowPenTilt;
  240. int16_t UseNodes; // the flexible way
  241. laRackPage* Rack;
  242. real LastX,LastY,LastAngle;
  243. real EvalColor[3];
  244. real EvalOffset[2];
  245. real EvalSize;
  246. real EvalDabsPerSize;
  247. real EvalHardness;
  248. real EvalTransparency;
  249. real EvalSmudge;
  250. real EvalSmudgeLength;
  251. real EvalSmudgeLifting;
  252. real EvalSlender;
  253. real EvalAngle;
  254. real EvalForce, EvalGunkyness;
  255. real EvalAccumulation;
  256. real EvalDepletionSpeed, PigmentLoading;
  257. real EvalSpeed;
  258. real EvalStrokeLength;
  259. real EvalStrokeLengthAccum;
  260. real EvalPressure;
  261. real EvalPosition[2];
  262. real EvalTilt[2];
  263. real EvalTwist;
  264. real EvalStrokeAngle;
  265. int EvalIsEraser;
  266. int EvalRepeats;
  267. int EvalDiscard;
  268. };
  269. STRUCTURE(OurDab){
  270. float X,Y;
  271. float Size;
  272. float Hardness;
  273. float Smudge, SmudgeLifting; int ResampleSmudge;
  274. float Color[4];
  275. float Slender;
  276. float Angle;
  277. float Direction[2];
  278. float Force;
  279. float Gunkyness;
  280. float Recentness;
  281. float Accumulation;
  282. };
  283. STRUCTURE(OurPigmentData){
  284. real Reflectance[16];
  285. real Absorption[16];
  286. real PreviewColor[3][4];
  287. };
  288. STRUCTURE(OurBrushData140){
  289. float Reflectance[64];
  290. float Absorption[64];
  291. };
  292. STRUCTURE(OurPigmentData140){
  293. float Reflectance[64];
  294. float Absorption[64];
  295. float PaperReflectance[64];
  296. float PaperAbsorption[64];
  297. };
  298. STRUCTURE(OurPigment){
  299. laListItem Item;
  300. laSafeString* Name;
  301. OurPigmentData Pigment;
  302. };
  303. STRUCTURE(OurLight){
  304. laListItem Item;
  305. laSafeString* Name;
  306. OurPigmentData Emission;
  307. };
  308. STRUCTURE(OurCanvasSurface){
  309. laListItem Item;
  310. laSafeString* Name;
  311. OurPigmentData Reflectance;
  312. };
  313. NEED_STRUCTURE(OurColorPalette);
  314. STRUCTURE(OurColorItem){
  315. laListItem Item;
  316. OurPigmentData Pigment;
  317. int IsPigment;
  318. OurColorPalette* Parent;
  319. };
  320. STRUCTURE(OurColorPalette){
  321. laListItem Item;
  322. laSafeString* Name;
  323. laListHandle Colors;
  324. };
  325. STRUCTURE(OurUndoTile){
  326. laListItem Item;
  327. int col,row;
  328. OUR_PIX_COMPACT* CopyData;
  329. int l,r,u,b;
  330. };
  331. STRUCTURE(OurUndo){
  332. OurLayer* Layer;
  333. laListHandle Tiles;
  334. };
  335. STRUCTURE(OurMoveUndo){
  336. OurLayer* Layer;
  337. int dx,dy;
  338. };
  339. #define OUR_TOOL_PAINT 0
  340. #define OUR_TOOL_CROP 1
  341. #define OUR_TOOL_MOVE 2
  342. #define OUR_PNG_READ_INPUT_FLAT 0
  343. #define OUR_PNG_READ_INPUT_ICC 1
  344. #define OUR_PNG_READ_INPUT_SRGB 2
  345. #define OUR_PNG_READ_INPUT_LINEAR_SRGB 3
  346. #define OUR_PNG_READ_INPUT_CLAY 4
  347. #define OUR_PNG_READ_INPUT_LINEAR_CLAY 5
  348. #define OUR_PNG_READ_INPUT_D65_P3 6
  349. #define OUR_PNG_READ_INPUT_LINEAR_D65_P3 7
  350. #define OUR_PNG_READ_OUTPUT_CANVAS 0
  351. #define OUR_PNG_READ_OUTPUT_LINEAR_SRGB OUR_PNG_READ_INPUT_LINEAR_SRGB
  352. #define OUR_PNG_READ_OUTPUT_LINEAR_CLAY OUR_PNG_READ_INPUT_LINEAR_CLAY
  353. #define OUR_PNG_READ_OUTPUT_LINEAR_D65_P3 OUR_PNG_READ_INPUT_LINEAR_D65_P3
  354. #define OUR_CANVAS_INTERPRETATION_SRGB 0
  355. #define OUR_CANVAS_INTERPRETATION_CLAY 1
  356. #define OUR_CANVAS_INTERPRETATION_D65_P3 2
  357. #define OUR_EXPORT_BIT_DEPTH_8 0
  358. #define OUR_EXPORT_BIT_DEPTH_16 1
  359. #define OUR_EXPORT_COLOR_MODE_SRGB OUR_CANVAS_INTERPRETATION_SRGB
  360. #define OUR_EXPORT_COLOR_MODE_CLAY OUR_CANVAS_INTERPRETATION_CLAY
  361. #define OUR_EXPORT_COLOR_MODE_D65_P3 OUR_CANVAS_INTERPRETATION_D65_P3
  362. #define OUR_EXPORT_COLOR_MODE_FLAT (OUR_CANVAS_INTERPRETATION_D65_P3+1)
  363. #define OUR_BRUSH_PAGE_LIST 128
  364. STRUCTURE(OurPNGReadExtra){
  365. int Confirming;
  366. laSafeString* FilePath;
  367. laSafeString* iccName;
  368. int HassRGB;
  369. int HasProfile;
  370. int InputMode;
  371. int OutputMode;
  372. int Offsets[2];
  373. };
  374. STRUCTURE(OurPNGWriteExtra){
  375. int Confirming;
  376. laSafeString* FilePath;
  377. int BitDepth;
  378. int ColorProfile;
  379. int Transparent;
  380. int PigmentConversionMethod;
  381. int CropX,CropY,CropW,CropH;
  382. };
  383. STRUCTURE(OurThreadExportPNGData){
  384. uint32_t* r_sizes;
  385. void** pointers;
  386. int i;
  387. int segy,h;
  388. int fail;
  389. };
  390. typedef void (*our_XYZ2RGBFunc)(tnsVector3d xyz, tnsVector3d rgb);
  391. typedef void (*our_2LogRGBFunc)(tnsVector3d rgb);
  392. typedef real (*our_Pigment2FinalFunc)(real* rgb, OurPigmentData* pd, void* buffer, int64_t index);
  393. STRUCTURE(OurPigmentConversionData){
  394. int RowStart,RowCount;
  395. int cols;
  396. uint16_t *ImageConversionBuffer;
  397. uint16_t *TextureTileData;
  398. our_XYZ2RGBFunc XYZ2RGB;
  399. our_Pigment2FinalFunc Pigment2Final;
  400. OurPigmentData* canvas;
  401. real** coeff;
  402. int SX,SY;
  403. real alpha;
  404. };
  405. NEED_STRUCTURE(OurThreadImportPNGDataMain);
  406. STRUCTURE(OurThreadImportPNGData){
  407. OurThreadImportPNGDataMain* main;
  408. void* data;
  409. OurLayer* l;
  410. int starty;
  411. };
  412. STRUCTURE(OurThreadImportPNGDataMain){
  413. OurThreadImportPNGData* data;
  414. int next,max;
  415. SYSLOCK lock;
  416. };
  417. STRUCTURE(OurUsePigment){
  418. laListItem Item;
  419. OurPigment* pigment;
  420. };
  421. STRUCTURE(BrushUniforms){
  422. GLint uCanvasType;
  423. GLint uCanvasRandom;
  424. GLint uCanvasFactor;
  425. GLint uImageOffset;
  426. GLint uBrushCorner;
  427. GLint uBrushCenter;
  428. GLint uBrushSize;
  429. GLint uBrushHardness;
  430. GLint uBrushSmudge;
  431. GLint uBrushRecentness;
  432. GLint uBrushColor;
  433. GLint uBrushSlender;
  434. GLint uBrushAngle;
  435. GLint uBrushDirection;
  436. GLint uBrushForce;
  437. GLint uBrushGunkyness;
  438. GLint uBrushRoutineSelection;
  439. GLint uBrushRoutineSelectionES;
  440. GLint uMixRoutineSelection;
  441. GLint uMixRoutineSelectionES;
  442. GLint uBrushErasing;
  443. GLint uBrushMix;
  444. GLint uBrushSmudgeLifting;
  445. GLint RoutineDoDabs;
  446. GLint RoutineDoSample;
  447. GLint RoutineDoMixNormal;
  448. GLint RoutineDoMixSpectral;
  449. GLint uBlendMode;
  450. GLint uAlphaTop;
  451. GLint uAlphaBottom;
  452. GLsizei SubroutineUniformLocations;
  453. GLint uMixingTop;
  454. };
  455. STRUCTURE(OurRecentFile){
  456. laListItem Item;
  457. laSafeString* Name;
  458. laSafeString* Path;
  459. };
  460. STRUCTURE(OurPaint){
  461. real pad;
  462. laListHandle CanvasSaverDummyList;
  463. laProp* CanvasSaverDummyProp;
  464. laListHandle RecentFiles;
  465. OurRecentFile* PendingRecentFile;
  466. laListHandle BadEvents;
  467. tnsImage* SplashImage;
  468. tnsImage* SplashImageHigh;
  469. laListHandle Palettes;
  470. OurColorPalette* CurrentPalette;
  471. laListHandle Layers;
  472. OurLayer* CurrentLayer;
  473. laListHandle Brushes;
  474. OurBrush* CurrentBrush;
  475. laListHandle Pigments;
  476. OurPigment* CurrentPigment;
  477. laListHandle Lights;
  478. laListHandle CanvasSurfaces;
  479. real SaveBrushSize,SaveEraserSize;
  480. OurDab* Dabs; int NextDab,MaxDab;
  481. float LastBrushCenter[2];
  482. int CanvasVersion;
  483. int MaxRecentFiles;
  484. laSafeString* Notes;
  485. real Smoothness,Hardness;
  486. real MixingSpeed;
  487. real LastX, LastY;
  488. real CurrentScale;
  489. real DefaultScale;
  490. int BrushNumber;
  491. real BrushBaseSize;
  492. real BrushSize;
  493. int BrushPage;
  494. int Tool,ActiveTool,Erasing,EventErasing,BrushMix;
  495. int LockBackground;
  496. int BackgroundType;
  497. int BackgroundRandom;
  498. real BackgroundFactor;
  499. OurBrush* PenBrush,*EraserBrush; real LastPigmentLoading;
  500. int X,Y,W,H; //border
  501. real BorderFadeWidth;
  502. int ColorInterpretation;
  503. int ShowBorder,UseBorder;
  504. int ShowTiles;
  505. int BrushCircleTiltMode;
  506. int AllowNonPressure,PaintProcessedEvents;
  507. int BadEventsLimit,BadEventCount,BadEventsGiveUp;
  508. int EnableBrushCircle,ShowBrushName,ShowBrushNumber;
  509. int EventHasTwist; real EventTwistAngle; real EventTiltOrientation;
  510. int DefaultBitDepth;
  511. int DefaultColorProfile;
  512. int PaintUndoLimit;
  513. int SpectralMode;
  514. int PigmentMode;
  515. int BrushNumbersOnHeader;
  516. int MixModeOnHeader;
  517. int ToolsOnHeader;
  518. int UndoOnHeader;
  519. int LightsOnHeader;
  520. int SketchMode;
  521. int SegmentedWrite;
  522. int PigmentDisplayMethod;
  523. int PaletteInColorsPanel;
  524. int DefaultCanvasType;
  525. int ToolUndo;
  526. tnsTexture* SmudgeTexture;
  527. GLuint CanvasShader; GLuint CanvasProgram;
  528. GLuint CanvasStraightShader; GLuint CanvasStraightProgram;
  529. GLuint CanvasPigmentShader; GLuint CanvasPigmentProgram;
  530. GLuint CompositionShader; GLuint CompositionProgram;
  531. GLuint CompositionStraightShader; GLuint CompositionStraightProgram;
  532. GLuint LayerShader; GLuint LayerProgram;
  533. GLuint DisplayShader; GLuint DisplayProgram;
  534. GLuint PigmentCompositionShader; GLuint PigmentCompositionProgram;
  535. GLuint PigmentLayeringShader; tnsShader* PigmentLayeringProgramT;
  536. GLuint PigmentDisplayShader; tnsShader* PigmentDisplayProgramT;
  537. GLuint uPigmentFragOffset,uPigmentTextureScale,uPigmentDisplayMode;
  538. GLint uboBrushPigment,uboBrushPigmentLocation;
  539. GLint uboCanvasPigment,uboCanvasPigmentLocation;
  540. BrushUniforms *u,uRGBA,uRGBStraightA,uPigment;
  541. int AlphaMode;
  542. int ReorderPigmnets;
  543. OurCanvasSurface *CanvasSurface; // not ptr to list
  544. OurLight *CanvasLight;
  545. OurPigmentData PickedPigment;
  546. OurPigmentData MixedPigment;
  547. laListHandle UsePigments;
  548. OurPigment* UseWhite;
  549. OurPigment* UseBlack;
  550. int ExposureCompensation;
  551. real CurrentColor[3];
  552. real BackgroundColor[3];
  553. uint16_t BColorU16[4];
  554. uint8_t BColorU8[4];
  555. real BorderAlpha;
  556. int ShowStripes;
  557. int ShowGrid;
  558. int ShowRef;
  559. int RefSize;
  560. int RefCategory;
  561. int RefOrientation;
  562. int RefCutHalf;
  563. real RefMargins[3],RefPaddings[2];
  564. int RefBiases[2];
  565. real RefAlpha;
  566. real xmin,xmax,ymin,ymax; // stroke bbox for undo region
  567. int ResetBrush;
  568. int SaveFailed;
  569. int FileRegistered;
  570. uint16_t *ImageBuffer;
  571. int ImageW,ImageH,ImageX,ImageY,LoadX,LoadY,TempLoadX,TempLoadY;
  572. uint8_t* ThumbnailBuffer;
  573. void* icc_LinearsRGB; int iccsize_LinearsRGB;
  574. void* icc_LinearClay; int iccsize_LinearClay;
  575. void* icc_LinearD65P3; int iccsize_LinearD65P3;
  576. void* icc_sRGB; int iccsize_sRGB;
  577. void* icc_Clay; int iccsize_Clay;
  578. void* icc_D65P3; int iccsize_D65P3;
  579. void* ProofTablesRGB, *ProofTableClay, *ProofTableD65;
  580. };
  581. void ourreset_Canvas(OurPaint* op);
  582. int ourProcessInitArgs(int argc, char* argv[]);
  583. int ourInit();
  584. void ourFinalize(int anyload);
  585. void ourRegisterNodes();
  586. int ourRebuildBrushEval();
  587. int ourEvalBrush();
  588. void ourMakeTranslations_zh_hans();
  589. void ourMakeTranslations_es_ES();
  590. void our_EnableSplashPanel();