29 Commits

Author SHA1 Message Date
Thomas Bernard
49eae75a94
op_c.c/.h: doxygen 2019-12-26 23:55:04 +01:00
Thomas Bernard
d44f972c11
test Convert_24b_bitmap_to_256() 2019-11-19 22:26:03 +01:00
Thomas Bernard
291e9469c5
fix unused variable warning 2019-07-25 00:06:59 +02:00
Nic Soudée
228e651b4f Correct some spelling mistakes
Automaticaly --> Automatically
Invalide --> Invalid
Strech --> Stretch
allows to --> allows one to
attachement --> attachment
contraints --> constraints
inconsistant --> inconsistent
occured --> occurred
occurences --> occurrences
permits to --> permits one to
postion --> position
regularily --> regularly
transfered --> transferred
2019-01-24 08:32:58 -05:00
Thomas Bernard
92facef46d Convert comments to UTF-8
most were encoded in Latin1 / CP1252
but a few lines in op_c.c were using IBM437/850 !
2018-06-26 11:37:19 +02:00
Thomas Bernard
71a72d2fae GS_Generate(): remove Warning
diff is int, abs is "int abs(int);"
current->data.pal.h is byte but ds->gradients[id].hue is float.
So cast to int before the substraction
2018-03-20 21:58:22 +01:00
Thomas Bernard
6f48d7fefe Add MSVC 2010 project file and a make the project compile 2018-02-20 15:45:45 +01:00
Thomas Bernard
ee11079b86 Count colors when loading True color pictures
If the count is <= 256 there is no need to execute the expensive
color quantization process
2018-01-16 16:27:30 +01:00
Thomas Bernard
fb197cc0d9 op_c.c: handle memory allocation errors in CS_Set() 2017-12-25 16:08:29 +01:00
Thomas Bernard
d7179f7cba fix Optimize_palette() for precisions different than 8 8 8
do the right shifts instead of 16 / 8
2017-12-25 15:55:14 +01:00
Thomas Bernard
4b0878c079 Quantization: use population split 2017-12-25 15:46:31 +01:00
Thomas Bernard
b9bdf68ee6 Quantization : sort clusters by diagonal and not volume
There is a #define which enables to return to the previous algorithm
2017-12-23 14:53:50 +01:00
Thomas Bernard
5d47a76a50 introduce GRAFX2_QUANTIZE_CLUSTER_POPULATION_SPLIT macro to change cluster splitting method 2017-12-23 14:26:08 +01:00
Thomas Bernard
9ec4adae80 Color quantization : use another cluster spliting (by volume instead of population)
see http://pulkomandy.tk/projects/GrafX2/ticket/26
2017-12-23 04:36:28 +01:00
Adrien Destugues
0c7d17304a Fix remaining doxygen warnings.
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@2128 416bcca6-2ee7-4201-b75f-2eb2f807beb1
2015-10-03 06:28:26 +00:00
Yves Rizoud
a630a84822 Removed all usage of __attribute__((unused)), replaced by void cast which is supported both on GCC and VBCC
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1984 416bcca6-2ee7-4201-b75f-2eb2f807beb1
2012-08-11 16:19:07 +00:00
Adrien Destugues
6e8d18baed Fix error in volume computation that led to weird results. Fixes all problems reported by DawnBringer :).
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1885 416bcca6-2ee7-4201-b75f-2eb2f807beb1
2012-01-01 12:13:12 +00:00
Adrien Destugues
ee6ddf139b * Fix issue with the color reduction: the node index was off by one, leading to a write out of the allocated memory, and, of course, strange crashes because of it.
* Add some const in function parameters, just to make sure.
 * Cleanup the comments, because I got lost in my own code...

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1881 416bcca6-2ee7-4201-b75f-2eb2f807beb1
2011-12-30 23:12:14 +00:00
Adrien Destugues
0236d5342a Rework the color reduction algorithm:
* Split clusters according to their volume (narrow covering) instead of occurence count. This ensures clusters representating a lot 
of colors are split; and a lot of pixels with near colors are grouped together, which is what we want for low-color work.
 * Rework memory management of clusters. Some of them were not malloc'ed but put on the stack, and then inserted in the list. Also 
avoid copying+deleting a cluster in CT_Get, return the original instead.
 * Use an union in the cluster struct to pack it a bit, since some data is used only in the color reduction phase, and some only in 
the palette lookup.

The result is maybe slower, but looks much, much better. Fixes issues 63 and 441.


git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1878 416bcca6-2ee7-4201-b75f-2eb2f807beb1
2011-11-28 22:31:06 +00:00
Adrien Destugues
4813314638 * Remove debug output
* Further optimization to the colortree, now allocated in one single chunk of 4090 bytes (2051 times better than original code!). 
Not doing all the malloc/frees should be slightly faster, and it also helps with cache locality (the whole tree can fit in the 
cache).
 * Remove the useless color "balancing" multipliers that did more harm than good.

We still need some improvements on the median cut, or maybe switch to a smarter algorithm; or add some cheats. See the JFIF quirks 
for an example.


git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1876 416bcca6-2ee7-4201-b75f-2eb2f807beb1
2011-11-23 21:26:43 +00:00
Yves Rizoud
58e8194f40 Compilation fix for dependencies
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1875 416bcca6-2ee7-4201-b75f-2eb2f807beb1
2011-11-23 19:05:12 +00:00
Adrien Destugues
d3a107bb7c Finished working on the new color lookup system.
There is room for optimization and maybe bugfixing.
The cluster table size is now:
511*15 = 7665bytes, this is 1094 times better than the color table.

Please test and report your results !


git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1874 416bcca6-2ee7-4201-b75f-2eb2f807beb1
2011-11-22 21:38:03 +00:00
Yves Rizoud
8cc20115d5 Fix systematic crash of 2.4wip.1790 when loading 24bit images.
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1794 416bcca6-2ee7-4201-b75f-2eb2f807beb1
2011-06-12 17:56:20 +00:00
Yves Rizoud
2d8c061e32 Improved brush rotation by adding 3 steps of scale2x. Result is not as good as I hoped, but for large flat surfaces, the edges are indeed much smoother than before.
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1789 416bcca6-2ee7-4201-b75f-2eb2f807beb1
2011-06-04 15:22:13 +00:00
Yves Rizoud
7a3ae5824a Merged the specifics of Caanoo 1.2 port by Pheel + Enabled TTF text on Caanoo
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1645 416bcca6-2ee7-4201-b75f-2eb2f807beb1
2010-11-05 01:03:11 +00:00
Yves Rizoud
b78bae876b Sped up fast 24bit color reduction (Caanoo specific)
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1635 416bcca6-2ee7-4201-b75f-2eb2f807beb1
2010-10-02 13:52:42 +00:00
Yves Rizoud
bd13dd93b1 Integrated the changes by PheeL for Caanoo support
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1629 416bcca6-2ee7-4201-b75f-2eb2f807beb1
2010-09-29 22:21:25 +00:00
Yves Rizoud
d5ecba7b6c Palette sort (on brightness) now uses a better formula, provided by DawnBringer. Text tool no longer crashes with some fonts. Added support for bitmap fonts from 'Bitmap Font Writer', such as those from http://www.zone38.net/font/bmpfont.html or http://www.matriaxweb.com/others.htm or http://www.genvid.com/moonstruck/downloads/fonts.html
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1530 416bcca6-2ee7-4201-b75f-2eb2f807beb1
2010-07-14 19:33:53 +00:00
Yves Rizoud
3ca5322379 Reorganized source code and directory tree.
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1375 416bcca6-2ee7-4201-b75f-2eb2f807beb1
2010-03-05 02:53:19 +00:00