Commit Graph

858 Commits

Author SHA1 Message Date
87a0396922 stb_image.h: 16 bit TGAs don't really have an alpha channel
I claimed that if the most significant bit of a 16bit pixel is set,
it should be opaque (as is suggested by some sources on the internet),
but implemented the opposite.
If implemented "correctly", lots of 16bit TGAs become invisible.. so I
guess 16bit TGAs aren't really supposed to have an alpha-channel, or at
least most 16bit TGAs (despite having set an "alpha-bit" in the "image
descriptor byte") in the wild don't seem to work like that.

So just assume 16bit non-greyscale TGAs are always STBI_rgb without
an alpha channel.
2015-12-06 05:47:47 +01:00
d235049322 stb_image.h: Fix TGA colormap support
* Calculate correct stb format (incl. proper 16bit support) also when
  using a colormap (palette)
* Create colormap with tga_comp, to correctly support 16bit RGB
  (instead of using tga_palette_bits/8 and just copying the data)
* For TGAs with colormap, the TGA bits per pixel field specifies the
  size of an index to the colormap - the "real" color depth
  of the image is saved in the color map specification's bits per pixel
  field. I think only 8 and 16bit indices make sense (16 should be
  supported, otherwise the colormap length could be u8 instead of u16),
  so I added support for both.
* Helper functions stbi__tga_get_comp() to calculate stb pixelformat and
  stbi__tga_read_rgb16() to read one 16bit pixel and convert it to
  24/32bit RGB(A) - for less duplicate code
2015-12-06 04:33:37 +01:00
57409c3d15 stb_image.h: Improve stbi__tga_info() and stbi__tga_test()
* for paletted images, .._info()'s comp should be based on the palette's
  bits per pixel, not the images bits per pixel (which describes the
  size of an index into the palette and is also checked now)
* make sure the color (map) type and the image type fields of the header
  are consistent (=> if TGA color type is 1 for paletted, the TGA image
  type must be 1 or 9)
* .._test() does some more checks and uses stbi__get16le() instead of
  stbi__get16be() - TGA is little endian.
* .._test() now always rewinds (sometimes it used to do only return 0;
  without rewinding)
* remove "error check" at the beginning of stbi__tga_load(), because
  all that is already tested in stbi__tga_test()
2015-12-06 04:33:30 +01:00
7453e1bfa4 stb_image.h: Support 15/16bit per pixel RGB(A) TGAs
stbi__tga_* assumed that 16bit TGAs were Grayscale + Alpha.
However, if the TGA imagetype is not one of the gray ones, it's 16Bit
RGB data, with 5 Bits per channel. If the TGA image descriptor field
has alpha bits (the 3 least significant ones) set, the pixel's most
significant bit is for alpha: 1 for opaque and 0 for translucent.
Furthermore people claim that TGAs can also pretend to have 15bpp,
which is the same as 16bpp but definitely without alpha.

So 15/16bpp TGAs are now decoded to STBI_rgb(_alpha).
2015-12-06 00:25:22 +01:00
64fa9a3d95 Update other_libs.md 2015-11-30 01:01:42 -08:00
2161d1e12a Update other_libs.md 2015-11-30 01:01:28 -08:00
657eda2155 Update other_libs.md 2015-11-21 03:29:15 -08:00
63849198b9 Update other_libs.md 2015-11-21 03:22:21 -08:00
5809508de3 Update other_libs.md 2015-11-12 06:12:24 -08:00
4e691f5917 Update other_libs.md 2015-11-12 06:12:06 -08:00
3f73dfd7ce Update other_libs.md 2015-11-05 06:49:02 -08:00
fa9a6e4e0a Update other_libs.md 2015-11-05 06:48:42 -08:00
d4cea6123a Update other_libs.md 2015-11-05 05:13:00 -08:00
20eea21e01 Update other_libs.md 2015-11-05 05:11:34 -08:00
a44e950d9a Update other_libs.md 2015-11-05 04:58:42 -08:00
b6602ab085 Update other_libs.md 2015-11-05 04:51:38 -08:00
450db24449 Update other_libs.md 2015-11-05 04:47:49 -08:00
76b8ff0051 Update other_libs.md 2015-11-05 04:47:36 -08:00
702c5bfee8 Update other_libs.md 2015-11-03 15:10:58 -08:00
06ae60645e Update other_libs.md 2015-10-31 11:17:02 -07:00
385927fb4b Update other_libs.md 2015-10-15 17:59:40 -07:00
c4082cfb89 Update other_libs.md 2015-10-09 15:31:50 -07:00
ff085b88f4 Update other_libs.md 2015-10-09 02:11:28 -07:00
6a9cdd1c83 other_libs: add a few libraries 2015-10-09 02:03:44 -07:00
3e404042c5 other_libs: added TweetNaCl 2015-10-07 21:53:40 -07:00
0b79b3bfe1 Update other_libs.md 2015-10-05 09:43:46 -07:00
cc3bb7c458 Update other_libs.md 2015-10-05 09:43:27 -07:00
bdcc1535d6 Update other_libs.md 2015-09-27 11:04:06 -07:00
dc92c6c4c4 Update other_libs.md 2015-09-27 08:30:16 -07:00
bbdb4f65ef Update other_libs.md 2015-09-27 08:23:56 -07:00
cd9c6d7b43 Update other_libs.md 2015-09-27 08:21:39 -07:00
8d0ae2d39f move other_libs list to its own file 2015-09-27 08:16:33 -07:00
2bd2e571a2 Update other_libs.md 2015-09-27 08:16:13 -07:00
f6d172d92b Update other_libs.md 2015-09-27 08:15:32 -07:00
4b587a409a Update other_libs.md 2015-09-27 08:14:48 -07:00
847fb2c230 put other_libs list in its own file 2015-09-27 08:13:09 -07:00
6464d059ab fix typo 2015-09-27 08:11:09 -07:00
37a493ae21 fix typo 2015-09-27 08:11:02 -07:00
b1160eb7e9 update other_libs 2015-09-27 08:09:25 -07:00
60e3ecac85 added ImGui to other_libs 2015-09-26 12:14:37 -07:00
3eb363c193 italicize more recent others' libs 2015-09-26 12:03:24 -07:00
616633b557 italicize most recent others' libs 2015-09-26 12:03:09 -07:00
6998a8e064 add gb_string.h 2015-09-26 11:51:23 -07:00
34d6c2ca87 update tinyexr's list position 2015-09-23 05:01:16 -07:00
5378a96536 clarify that olick's GIF also does animated 2015-09-14 07:07:20 -07:00
ac7daffc27 update readme 2015-09-14 05:58:09 -07:00
93b2b82996 get rid of unused return value from write callback 2015-09-14 05:57:42 -07:00
b4477803cb fix public function names;
fix internal names to be namspaced properly;
2015-09-14 05:48:24 -07:00
78fe0bfc24 handle fopen() failing 2015-09-14 05:40:12 -07:00
ad63a8d316 Merge branch 'master' of https://github.com/ejulien/stb into working
Conflicts:
	stb_image_write.h
2015-09-14 05:38:07 -07:00