Rev 536 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 536 | Rev 550 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /* |
1 | /* |
2 | This file is part of "Filter Foundry", a filter plugin for Adobe Photoshop |
2 | This file is part of "Filter Foundry", a filter plugin for Adobe Photoshop |
3 | Copyright (C) 2003-2009 Toby Thain, toby@telegraphics.net |
3 | Copyright (C) 2003-2009 Toby Thain, toby@telegraphics.net |
4 | Copyright (C) 2018-2022 Daniel Marschall, ViaThinkSoft |
4 | Copyright (C) 2018-2023 Daniel Marschall, ViaThinkSoft |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify |
6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by |
7 | it under the terms of the GNU General Public License as published by |
8 | the Free Software Foundation; either version 2 of the License, or |
8 | the Free Software Foundation; either version 2 of the License, or |
9 | (at your option) any later version. |
9 | (at your option) any later version. |
Line 251... | Line 251... | ||
251 | 25874, 25919, 25964, 26008, 26053, 26098, 26142, 26187, 26232, 26277, 26322, 26366, 26411, 26456, 26501, |
251 | 25874, 25919, 25964, 26008, 26053, 26098, 26142, 26187, 26232, 26277, 26322, 26366, 26411, 26456, 26501, |
252 | 26546, 26591, 26636, 26681, 26726, 26771, 26816, 26861, 26906, 26951, 26997, 27042, 27087, 27132 }; |
252 | 26546, 26591, 26636, 26681, 26726, 26771, 26816, 26861, 26906, 26951, 26997, 27042, 27087, 27132 }; |
253 | 253 | ||
254 | // ------------------------------------------------------------------------------------------- |
254 | // ------------------------------------------------------------------------------------------- |
255 | 255 | ||
256 | extern uint8_t slider[]; |
- | |
257 | extern value_type cell[], var[]; |
256 | extern value_type cell[], var[]; |
258 | extern unsigned char* image_ptr; |
257 | extern unsigned char* image_ptr; |
259 | 258 | ||
260 | // ------------------------------------------------------------------------------------------- |
259 | // ------------------------------------------------------------------------------------------- |
261 | 260 | ||
Line 485... | Line 484... | ||
485 | /* ctl(i) Value of slider i, where i is an integer between 0 and 7, inclusive */ |
484 | /* ctl(i) Value of slider i, where i is an integer between 0 and 7, inclusive */ |
486 | value_type ff_ctl(value_type i) { |
485 | value_type ff_ctl(value_type i) { |
487 | #ifdef PARSERTEST |
486 | #ifdef PARSERTEST |
488 | return 0; |
487 | return 0; |
489 | #else |
488 | #else |
490 | return i >= 0 && i <= 7 ? slider[i] : 0; |
489 | return i >= 0 && i <= 7 ? gdata->parm.val[i] : 0; |
491 | #endif |
490 | #endif |
492 | } |
491 | } |
493 | 492 | ||
494 | // ------------------------------------------------------------------------------------------- |
493 | // ------------------------------------------------------------------------------------------- |
495 | 494 | ||
Line 498... | Line 497... | ||
498 | value_type val_factory(value_type i, value_type a, value_type b) { |
497 | value_type val_factory(value_type i, value_type a, value_type b) { |
499 | #ifdef PARSERTEST |
498 | #ifdef PARSERTEST |
500 | return 0; |
499 | return 0; |
501 | #else |
500 | #else |
502 | if (i < 0 || i > 7) return 0; |
501 | if (i < 0 || i > 7) return 0; |
503 | return ((long)slider[i] * (b - a)) / 255 + a; |
502 | return ((long)(gdata->parm.val[i]) * (b - a)) / 255 + a; |
504 | #endif |
503 | #endif |
505 | } |
504 | } |
506 | 505 | ||
507 | value_type val_foundry(value_type i, value_type a, value_type b) { |
506 | value_type val_foundry(value_type i, value_type a, value_type b) { |
508 | #ifdef PARSERTEST |
507 | #ifdef PARSERTEST |
Line 534... | Line 533... | ||
534 | const int i2 = i << 1; |
533 | const int i2 = i << 1; |
535 | 534 | ||
536 | // This is how Filter Factory for Windows implements it: |
535 | // This is how Filter Factory for Windows implements it: |
537 | if (i < 0) return 0; |
536 | if (i < 0) return 0; |
538 | if (i > 3) return 0; |
537 | if (i > 3) return 0; |
539 | H = slider[i2]; // ctl(2i) |
538 | H = gdata->parm.val[i2]; // ctl(2i) |
540 | L = slider[i2 + 1]; // ctl(2i+1) |
539 | L = gdata->parm.val[i2 + 1]; // ctl(2i+1) |
541 | if (n < 0) n = 0; |
540 | if (n < 0) n = 0; |
542 | if (n > 255) n = 255; // Note: MacFF probably does "return 255" if n>255 (see testcases/map1_factory_win.png) |
541 | if (n > 255) n = 255; // Note: MacFF probably does "return 255" if n>255 (see testcases/map1_factory_win.png) |
543 | 542 | ||
544 | if (H == L) { |
543 | if (H == L) { |
545 | // This is undocumented in Filter Factory! (Taken from Windows implementation) |
544 | // This is undocumented in Filter Factory! (Taken from Windows implementation) |