Rupert
044fa148ed
bmp-write: remove duplicate code
2025-05-30 22:22:24 +02:00
Rupert
b9244c0766
embrace C11 VLA syntax
2025-05-30 17:01:10 +02:00
Rupert
84a0f0f49d
struct Bmpread - reorder some fields wrt alignment
2025-05-30 16:50:16 +02:00
Rupert
1b67440d29
docs: add section numbering
2025-05-27 15:08:47 +02:00
Rupert
5166bdb1e7
bmplib.h: some houskeeping and preparation for OS/2 icon/pointers
2025-05-14 23:36:08 +02:00
Rupert
c02804cdbf
asserts
...
- use static_assert macro instead of _Static_assert
- make assertion in bmpwrite_set_iccprofile static
2025-05-09 08:12:07 +02:00
Rupert
fd8583d568
unit tests: add libreoffice spreadsheet to help construct test data
2025-05-08 15:14:32 +02:00
Rupert
845223bf62
add unit test for s_imgrgb_to_outbytes()
2025-05-08 13:20:47 +02:00
Rupert
952c10324f
bmp-write: update float_to_s2_13() to version from bmp-read
...
should obviously eventually go into a header file instead of
duplicating it.
2025-05-07 20:56:56 +02:00
Rupert
668cc352e3
add unit tests for write_<xnn>_le() functions
2025-05-07 17:55:07 +02:00
Rupert
1bba98e395
refactor cm_align4size() macro
2025-05-03 18:41:08 +02:00
Rupert
0815eb3a7b
remove unused function cm_align2padding()
2025-05-03 14:55:40 +02:00
Rupert
94dceb5812
read_u<nn>_le(): eliminate implementation defined behavior
...
relatively pointless but fun ;o)
- while not making any assumptions about the host's bit representation
or the implementation defined behavior of assigning an unsigned int
> INT_MAX to a signed int, the lack of range (INT_MIN) would
still break it on non-two's complement unless larger int types were
used.
- both gcc and clang recognize the pattern and generate the same code as
for the simple assignment, so doing it this way doesn't cost any
performance.
2025-05-03 13:25:21 +02:00
Rupert
c733595aed
add unit test for read_s32_le()
2025-05-03 11:40:31 +02:00
Rupert
920ba8ea7e
add unit test for read_u32_le()
2025-05-03 11:32:51 +02:00
Rupert
0882f1796a
add unit test for read_s16_le()
2025-05-03 11:32:51 +02:00
Rupert
da95bcb0ae
add unit test for read_u16_le()
2025-05-03 11:32:51 +02:00
Rupert
e5584c3b0f
s_buffer32_bits(): make assert more precise
2025-05-01 12:13:32 +02:00
Rupert
3af484b238
update copyright notice dates
2025-05-01 12:11:32 +02:00
Rupert
6c33d975b5
add unit test for s_read_rgb_pixel()
2025-05-01 12:04:27 +02:00
Rupert
0ab592c357
add unit test for s_buffer_32_bits()
2025-04-30 13:23:55 +02:00
Rupert
e9b047b857
add unit test for s_buffer32_fill()
2025-04-30 13:23:55 +02:00
Rupert
71b3853327
s_buffer32_fill(): allow partial fill
...
this can make sense if the very last (padding) bytes of an indexed
file are truncated.
2025-04-30 13:23:55 +02:00
Rupert
5ce902ce1b
add unit test for s_int8_to_result_format()
2025-04-30 13:23:55 +02:00
Rupert
abf93c1a77
reafactor s_int_to_result_format()
...
the in-place conversion made me feel a bit queezy; also, it's only ever
called for rgb conversion of indexed images, meaning always with
8-bit integers.
- Changed the name to s_int8_to_result_format()
- made it 8-bit only
- source values are now supplied as separate int array 'frombits' and
stored into the result buffer 'px'.
2025-04-30 13:23:55 +02:00
Rupert
bc7dd1423c
add unit test for s_srgb_gamma_float(), rename test source file
2025-04-29 00:59:13 +02:00
Rupert
100715fe9d
add unit tests for s2.13 conversion
2025-04-28 22:59:12 +02:00
Rupert
e195d1d918
bmpread: use conversion functions
...
instead of manual conversions,
- use new s_float_to_s2_13()
- use s_int_to_float() in s_int_to_result_format()
2025-04-28 22:59:12 +02:00
Rupert
3989e07e05
fix rounding error in s2.13 conversion, eliminate impl.defined behavior
...
also eliminate some duplicate code while we're at it
2025-04-28 22:56:34 +02:00
Rupert
df8d9e44ca
read state, minor changes
2025-04-28 22:56:34 +02:00
Rupert
7d2ff7fca5
C23 doesn't define __bool_true_false_are_defined anymore
...
this is still very kludgy, but seems to work for any c std
2025-04-28 22:56:34 +02:00
Rupert
2ba0910acc
static assert of 32bit requirement
...
be more specific, requiring 32bits, not necessarily 4 bytes
2025-04-28 19:41:02 +02:00
Rupert
7494855af6
cleanup insane handling
...
- fix: setting a new insanity limit can cause previously ok result to
be insane
- refactor for simpler expressions / more symmetry
2025-04-19 19:23:46 +02:00
Rupert
1d9a3faad4
icc profile error handling, minor changes
2025-04-19 12:53:52 +02:00
Rupert
3d31aa93cd
minor fixes:
...
- require integer format when loading palette
- don't auto-load info in bmpread_is_64bit, as we cannot return result
2025-04-19 01:30:41 +02:00
Rupert
91d93cba9b
refactor read state
...
instead of several bools, have one enum to keep track of where in the
reading process we are
2025-04-19 01:27:22 +02:00
Rupert
b43fd940e6
bump version to 1.7.7
v1.7.7
2025-04-18 15:53:08 +02:00
Rupert
61a4caf6ef
fix line-by-line writing bug, refactor write state
...
bug introduced by 142427e17 : line-by-line writing of RLE files resulted
in corrupted files.
Found while refactoring write state
2025-04-18 15:51:09 +02:00
Rupert
4942795e14
don't require explicitly calling load_info() before reading ICC profile
2025-04-17 23:48:19 +02:00
Rupert
52801cd5d5
cleanup s_decide_outformat()
2025-04-17 23:47:24 +02:00
Rupert
0e4e611955
add semicolons in doc for consistent syntax highlighter
2025-04-16 23:50:00 +02:00
Rupert
58ebfc8dc7
doc update, bump version to v1.7.6
v1.7.6
2025-04-16 23:43:45 +02:00
Rupert
1e3f4abe16
add support for setting rendering intent
...
new function: bmpwrite_set_rendering_intent()
2025-04-16 23:08:14 +02:00
Rupert
be9882e04f
documentation update
...
- add documentation for ICC profile functions
- add 'c' to code snippets to enable syntax highlighting
- minor corrections
2025-04-16 13:11:37 +02:00
Rupert
3218cd6e65
small fix in RLE24 preconditions
2025-04-15 22:13:26 +02:00
Rupert
142427e179
add ICC profile writing support
...
new function bmpwrite_set_iccprofile()
2025-04-15 22:13:26 +02:00
Rupert
0580565bf3
add ICC profile reading support
...
- new functions:
- bmpread_iccprofile_size()
- bmpread_load_iccprofile()
- only pass on profile as is, profile is not interpreted or applied
2025-04-15 22:10:13 +02:00
Rupert
7523138fbb
bump version to 1.7.5
v1.7.5
2025-04-10 18:29:17 +02:00
Rupert
592605e06f
add sanitize meson option
2025-04-10 18:29:17 +02:00
Rupert
eeae2205c5
eliminate all -Wextra warnings
...
revert height back to int and make INT_MIN an invalid height. Having
a possible height value that's only valid for top-down but not bottom-up
BMPs just creates headaches down the way.
2025-04-10 18:29:17 +02:00