gosu 0.12.1 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gosu/Audio.hpp +23 -25
- data/Gosu/Graphics.hpp +16 -12
- data/Gosu/Image.hpp +3 -0
- data/Gosu/Version.hpp +2 -2
- data/lib/gosu.rb +2 -2
- data/lib/gosu/compat.rb +1 -1
- data/lib/gosu/patches.rb +5 -0
- data/lib/gosu/swig_patches.rb +1 -1
- data/rdoc/gosu.rb +10 -10
- data/src/Audio.cpp +93 -228
- data/src/AudioImpl.cpp +94 -0
- data/src/AudioImpl.hpp +33 -0
- data/src/AudioToolboxFile.hpp +14 -18
- data/src/Bitmap.cpp +36 -30
- data/src/BitmapIO.cpp +14 -23
- data/src/BlockAllocator.cpp +7 -10
- data/src/BlockAllocator.hpp +2 -4
- data/src/Channel.cpp +89 -0
- data/src/Color.cpp +4 -9
- data/src/DirectoriesApple.cpp +13 -13
- data/src/DirectoriesUnix.cpp +8 -7
- data/src/DirectoriesWin.cpp +12 -11
- data/src/EmptyImageData.hpp +54 -0
- data/src/FileUnix.cpp +12 -9
- data/src/FileWin.cpp +8 -7
- data/src/Font.cpp +12 -13
- data/src/FormattedString.cpp +237 -0
- data/src/FormattedString.hpp +14 -265
- data/src/GosuViewController.cpp +2 -5
- data/src/Graphics.cpp +38 -39
- data/src/IO.cpp +11 -10
- data/src/Image.cpp +16 -9
- data/src/Input.cpp +16 -15
- data/src/InputUIKit.cpp +8 -7
- data/src/Macro.cpp +11 -11
- data/src/Math.cpp +9 -8
- data/src/RubyGosu.cxx +129 -99
- data/src/TextApple.cpp +19 -13
- data/src/TextInput.cpp +23 -22
- data/src/TextWin.cpp +17 -19
- data/src/Texture.cpp +15 -10
- data/src/Transform.cpp +13 -17
- data/src/Utility.cpp +3 -2
- data/src/UtilityApple.cpp +10 -11
- data/src/UtilityWin.cpp +2 -1
- data/src/Version.cpp +5 -4
- data/src/WinMain.cpp +3 -3
- data/src/WinUtility.cpp +7 -6
- data/src/Window.cpp +11 -10
- data/src/WindowUIKit.cpp +9 -8
- data/src/stb_image.h +782 -480
- data/src/stb_image_write.h +425 -15
- data/src/stb_vorbis.c +82 -32
- metadata +8 -4
- data/src/ALChannelManagement.hpp +0 -119
data/src/stb_image_write.h
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
/* stb_image_write - v1.
|
2
|
-
writes out PNG/BMP/TGA images to C stdio - Sean Barrett 2010-2015
|
1
|
+
/* stb_image_write - v1.07 - public domain - http://nothings.org/stb/stb_image_write.h
|
2
|
+
writes out PNG/BMP/TGA/JPEG/HDR images to C stdio - Sean Barrett 2010-2015
|
3
3
|
no warranty implied; use at your own risk
|
4
4
|
|
5
5
|
Before #including,
|
@@ -35,6 +35,7 @@ USAGE:
|
|
35
35
|
int stbi_write_bmp(char const *filename, int w, int h, int comp, const void *data);
|
36
36
|
int stbi_write_tga(char const *filename, int w, int h, int comp, const void *data);
|
37
37
|
int stbi_write_hdr(char const *filename, int w, int h, int comp, const float *data);
|
38
|
+
int stbi_write_jpg(char const *filename, int w, int h, int comp, const float *data);
|
38
39
|
|
39
40
|
There are also four equivalent functions that use an arbitrary write function. You are
|
40
41
|
expected to open/close your file-equivalent before and after calling these:
|
@@ -43,6 +44,7 @@ USAGE:
|
|
43
44
|
int stbi_write_bmp_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const void *data);
|
44
45
|
int stbi_write_tga_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const void *data);
|
45
46
|
int stbi_write_hdr_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const float *data);
|
47
|
+
int stbi_write_jpg_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data, int quality);
|
46
48
|
|
47
49
|
where the callback is:
|
48
50
|
void stbi_write_func(void *context, void *data, int size);
|
@@ -79,6 +81,10 @@ USAGE:
|
|
79
81
|
|
80
82
|
TGA supports RLE or non-RLE compressed data. To use non-RLE-compressed
|
81
83
|
data, set the global variable 'stbi_write_tga_with_rle' to 0.
|
84
|
+
|
85
|
+
JPEG does ignore alpha channels in input data; quality is between 1 and 100.
|
86
|
+
Higher quality looks better but results in a bigger image.
|
87
|
+
JPEG baseline (no JPEG progressive).
|
82
88
|
|
83
89
|
CREDITS:
|
84
90
|
|
@@ -94,6 +100,9 @@ CREDITS:
|
|
94
100
|
Alan Hickman
|
95
101
|
initial file IO callback implementation
|
96
102
|
Emmanuel Julien
|
103
|
+
JPEG
|
104
|
+
Jon Olick (original jo_jpeg.cpp code)
|
105
|
+
Daniel Gibson
|
97
106
|
bugfixes:
|
98
107
|
github:Chribba
|
99
108
|
Guillaume Chereau
|
@@ -103,12 +112,12 @@ CREDITS:
|
|
103
112
|
Jonas Karlsson
|
104
113
|
Filip Wasil
|
105
114
|
Thatcher Ulrich
|
115
|
+
github:poppolopoppo
|
116
|
+
Patrick Boettcher
|
106
117
|
|
107
118
|
LICENSE
|
108
119
|
|
109
|
-
|
110
|
-
license: you are granted a perpetual, irrevocable license to copy, modify,
|
111
|
-
publish, and distribute this file as you see fit.
|
120
|
+
See end of file for license information.
|
112
121
|
|
113
122
|
*/
|
114
123
|
|
@@ -131,6 +140,7 @@ STBIWDEF int stbi_write_png(char const *filename, int w, int h, int comp, const
|
|
131
140
|
STBIWDEF int stbi_write_bmp(char const *filename, int w, int h, int comp, const void *data);
|
132
141
|
STBIWDEF int stbi_write_tga(char const *filename, int w, int h, int comp, const void *data);
|
133
142
|
STBIWDEF int stbi_write_hdr(char const *filename, int w, int h, int comp, const float *data);
|
143
|
+
STBIWDEF int stbi_write_jpg(char const *filename, int x, int y, int comp, const void *data, int quality);
|
134
144
|
#endif
|
135
145
|
|
136
146
|
typedef void stbi_write_func(void *context, void *data, int size);
|
@@ -139,6 +149,7 @@ STBIWDEF int stbi_write_png_to_func(stbi_write_func *func, void *context, int w,
|
|
139
149
|
STBIWDEF int stbi_write_bmp_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const void *data);
|
140
150
|
STBIWDEF int stbi_write_tga_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const void *data);
|
141
151
|
STBIWDEF int stbi_write_hdr_to_func(stbi_write_func *func, void *context, int w, int h, int comp, const float *data);
|
152
|
+
STBIWDEF int stbi_write_jpg_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data, int quality);
|
142
153
|
|
143
154
|
#ifdef __cplusplus
|
144
155
|
}
|
@@ -277,6 +288,11 @@ static void stbiw__writef(stbi__write_context *s, const char *fmt, ...)
|
|
277
288
|
va_end(v);
|
278
289
|
}
|
279
290
|
|
291
|
+
static void stbiw__putc(stbi__write_context *s, unsigned char c)
|
292
|
+
{
|
293
|
+
s->func(s->context, &c, 1);
|
294
|
+
}
|
295
|
+
|
280
296
|
static void stbiw__write3(stbi__write_context *s, unsigned char a, unsigned char b, unsigned char c)
|
281
297
|
{
|
282
298
|
unsigned char arr[3];
|
@@ -293,10 +309,8 @@ static void stbiw__write_pixel(stbi__write_context *s, int rgb_dir, int comp, in
|
|
293
309
|
s->func(s->context, &d[comp - 1], 1);
|
294
310
|
|
295
311
|
switch (comp) {
|
312
|
+
case 2: // 2 pixels = mono + alpha, alpha is written separately, so same as 1-channel case
|
296
313
|
case 1:
|
297
|
-
s->func(s->context,d,1);
|
298
|
-
break;
|
299
|
-
case 2:
|
300
314
|
if (expand_mono)
|
301
315
|
stbiw__write3(s, d[0], d[0], d[0]); // monochrome bmp
|
302
316
|
else
|
@@ -452,7 +466,7 @@ static int stbi_write_tga_core(stbi__write_context *s, int x, int y, int comp, v
|
|
452
466
|
return 1;
|
453
467
|
}
|
454
468
|
|
455
|
-
int stbi_write_tga_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data)
|
469
|
+
STBIWDEF int stbi_write_tga_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data)
|
456
470
|
{
|
457
471
|
stbi__write_context s;
|
458
472
|
stbi__start_write_callbacks(&s, func, context);
|
@@ -460,7 +474,7 @@ int stbi_write_tga_to_func(stbi_write_func *func, void *context, int x, int y, i
|
|
460
474
|
}
|
461
475
|
|
462
476
|
#ifndef STBI_WRITE_NO_STDIO
|
463
|
-
int stbi_write_tga(char const *filename, int x, int y, int comp, const void *data)
|
477
|
+
STBIWDEF int stbi_write_tga(char const *filename, int x, int y, int comp, const void *data)
|
464
478
|
{
|
465
479
|
stbi__write_context s;
|
466
480
|
if (stbi__start_write_file(&s,filename)) {
|
@@ -475,7 +489,6 @@ int stbi_write_tga(char const *filename, int x, int y, int comp, const void *dat
|
|
475
489
|
// *************************************************************************************************
|
476
490
|
// Radiance RGBE HDR writer
|
477
491
|
// by Baldur Karlsson
|
478
|
-
#ifndef STBI_WRITE_NO_STDIO
|
479
492
|
|
480
493
|
#define stbiw__max(a, b) ((a) > (b) ? (a) : (b))
|
481
494
|
|
@@ -623,14 +636,15 @@ static int stbi_write_hdr_core(stbi__write_context *s, int x, int y, int comp, f
|
|
623
636
|
}
|
624
637
|
}
|
625
638
|
|
626
|
-
int stbi_write_hdr_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const float *data)
|
639
|
+
STBIWDEF int stbi_write_hdr_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const float *data)
|
627
640
|
{
|
628
641
|
stbi__write_context s;
|
629
642
|
stbi__start_write_callbacks(&s, func, context);
|
630
643
|
return stbi_write_hdr_core(&s, x, y, comp, (float *) data);
|
631
644
|
}
|
632
645
|
|
633
|
-
|
646
|
+
#ifndef STBI_WRITE_NO_STDIO
|
647
|
+
STBIWDEF int stbi_write_hdr(char const *filename, int x, int y, int comp, const float *data)
|
634
648
|
{
|
635
649
|
stbi__write_context s;
|
636
650
|
if (stbi__start_write_file(&s,filename)) {
|
@@ -896,6 +910,7 @@ static unsigned char stbiw__paeth(int a, int b, int c)
|
|
896
910
|
return STBIW_UCHAR(c);
|
897
911
|
}
|
898
912
|
|
913
|
+
// @OPTIMIZE: provide an option that always forces left-predict or paeth predict
|
899
914
|
unsigned char *stbi_write_png_to_mem(unsigned char *pixels, int stride_bytes, int x, int y, int n, int *out_len)
|
900
915
|
{
|
901
916
|
int ctype[5] = { -1, 0, 4, 2, 6 };
|
@@ -912,10 +927,10 @@ unsigned char *stbi_write_png_to_mem(unsigned char *pixels, int stride_bytes, in
|
|
912
927
|
for (j=0; j < y; ++j) {
|
913
928
|
static int mapping[] = { 0,1,2,3,4 };
|
914
929
|
static int firstmap[] = { 0,1,0,5,6 };
|
915
|
-
int *mymap = j ? mapping : firstmap;
|
930
|
+
int *mymap = (j != 0) ? mapping : firstmap;
|
916
931
|
int best = 0, bestval = 0x7fffffff;
|
917
932
|
for (p=0; p < 2; ++p) {
|
918
|
-
for (k= p?best:0; k < 5; ++k) {
|
933
|
+
for (k= p?best:0; k < 5; ++k) { // @TODO: clarity: rewrite this to go 0..5, and 'continue' the unwanted ones during 2nd pass
|
919
934
|
int type = mymap[k],est=0;
|
920
935
|
unsigned char *z = pixels + stride_bytes*j;
|
921
936
|
for (i=0; i < n; ++i)
|
@@ -1014,9 +1029,362 @@ STBIWDEF int stbi_write_png_to_func(stbi_write_func *func, void *context, int x,
|
|
1014
1029
|
return 1;
|
1015
1030
|
}
|
1016
1031
|
|
1032
|
+
|
1033
|
+
/* ***************************************************************************
|
1034
|
+
*
|
1035
|
+
* JPEG writer
|
1036
|
+
*
|
1037
|
+
* This is based on Jon Olick's jo_jpeg.cpp:
|
1038
|
+
* public domain Simple, Minimalistic JPEG writer - http://www.jonolick.com/code.html
|
1039
|
+
*/
|
1040
|
+
|
1041
|
+
static const unsigned char stbiw__jpg_ZigZag[] = { 0,1,5,6,14,15,27,28,2,4,7,13,16,26,29,42,3,8,12,17,25,30,41,43,9,11,18,
|
1042
|
+
24,31,40,44,53,10,19,23,32,39,45,52,54,20,22,33,38,46,51,55,60,21,34,37,47,50,56,59,61,35,36,48,49,57,58,62,63 };
|
1043
|
+
|
1044
|
+
static void stbiw__jpg_writeBits(stbi__write_context *s, int *bitBufP, int *bitCntP, const unsigned short *bs) {
|
1045
|
+
int bitBuf = *bitBufP, bitCnt = *bitCntP;
|
1046
|
+
bitCnt += bs[1];
|
1047
|
+
bitBuf |= bs[0] << (24 - bitCnt);
|
1048
|
+
while(bitCnt >= 8) {
|
1049
|
+
unsigned char c = (bitBuf >> 16) & 255;
|
1050
|
+
stbiw__putc(s, c);
|
1051
|
+
if(c == 255) {
|
1052
|
+
stbiw__putc(s, 0);
|
1053
|
+
}
|
1054
|
+
bitBuf <<= 8;
|
1055
|
+
bitCnt -= 8;
|
1056
|
+
}
|
1057
|
+
*bitBufP = bitBuf;
|
1058
|
+
*bitCntP = bitCnt;
|
1059
|
+
}
|
1060
|
+
|
1061
|
+
static void stbiw__jpg_DCT(float *d0p, float *d1p, float *d2p, float *d3p, float *d4p, float *d5p, float *d6p, float *d7p) {
|
1062
|
+
float d0 = *d0p, d1 = *d1p, d2 = *d2p, d3 = *d3p, d4 = *d4p, d5 = *d5p, d6 = *d6p, d7 = *d7p;
|
1063
|
+
float z1, z2, z3, z4, z5, z11, z13;
|
1064
|
+
|
1065
|
+
float tmp0 = d0 + d7;
|
1066
|
+
float tmp7 = d0 - d7;
|
1067
|
+
float tmp1 = d1 + d6;
|
1068
|
+
float tmp6 = d1 - d6;
|
1069
|
+
float tmp2 = d2 + d5;
|
1070
|
+
float tmp5 = d2 - d5;
|
1071
|
+
float tmp3 = d3 + d4;
|
1072
|
+
float tmp4 = d3 - d4;
|
1073
|
+
|
1074
|
+
// Even part
|
1075
|
+
float tmp10 = tmp0 + tmp3; // phase 2
|
1076
|
+
float tmp13 = tmp0 - tmp3;
|
1077
|
+
float tmp11 = tmp1 + tmp2;
|
1078
|
+
float tmp12 = tmp1 - tmp2;
|
1079
|
+
|
1080
|
+
d0 = tmp10 + tmp11; // phase 3
|
1081
|
+
d4 = tmp10 - tmp11;
|
1082
|
+
|
1083
|
+
z1 = (tmp12 + tmp13) * 0.707106781f; // c4
|
1084
|
+
d2 = tmp13 + z1; // phase 5
|
1085
|
+
d6 = tmp13 - z1;
|
1086
|
+
|
1087
|
+
// Odd part
|
1088
|
+
tmp10 = tmp4 + tmp5; // phase 2
|
1089
|
+
tmp11 = tmp5 + tmp6;
|
1090
|
+
tmp12 = tmp6 + tmp7;
|
1091
|
+
|
1092
|
+
// The rotator is modified from fig 4-8 to avoid extra negations.
|
1093
|
+
z5 = (tmp10 - tmp12) * 0.382683433f; // c6
|
1094
|
+
z2 = tmp10 * 0.541196100f + z5; // c2-c6
|
1095
|
+
z4 = tmp12 * 1.306562965f + z5; // c2+c6
|
1096
|
+
z3 = tmp11 * 0.707106781f; // c4
|
1097
|
+
|
1098
|
+
z11 = tmp7 + z3; // phase 5
|
1099
|
+
z13 = tmp7 - z3;
|
1100
|
+
|
1101
|
+
*d5p = z13 + z2; // phase 6
|
1102
|
+
*d3p = z13 - z2;
|
1103
|
+
*d1p = z11 + z4;
|
1104
|
+
*d7p = z11 - z4;
|
1105
|
+
|
1106
|
+
*d0p = d0; *d2p = d2; *d4p = d4; *d6p = d6;
|
1107
|
+
}
|
1108
|
+
|
1109
|
+
static void stbiw__jpg_calcBits(int val, unsigned short bits[2]) {
|
1110
|
+
int tmp1 = val < 0 ? -val : val;
|
1111
|
+
val = val < 0 ? val-1 : val;
|
1112
|
+
bits[1] = 1;
|
1113
|
+
while(tmp1 >>= 1) {
|
1114
|
+
++bits[1];
|
1115
|
+
}
|
1116
|
+
bits[0] = val & ((1<<bits[1])-1);
|
1117
|
+
}
|
1118
|
+
|
1119
|
+
static int stbiw__jpg_processDU(stbi__write_context *s, int *bitBuf, int *bitCnt, float *CDU, float *fdtbl, int DC, const unsigned short HTDC[256][2], const unsigned short HTAC[256][2]) {
|
1120
|
+
const unsigned short EOB[2] = { HTAC[0x00][0], HTAC[0x00][1] };
|
1121
|
+
const unsigned short M16zeroes[2] = { HTAC[0xF0][0], HTAC[0xF0][1] };
|
1122
|
+
int dataOff, i, diff, end0pos;
|
1123
|
+
int DU[64];
|
1124
|
+
|
1125
|
+
// DCT rows
|
1126
|
+
for(dataOff=0; dataOff<64; dataOff+=8) {
|
1127
|
+
stbiw__jpg_DCT(&CDU[dataOff], &CDU[dataOff+1], &CDU[dataOff+2], &CDU[dataOff+3], &CDU[dataOff+4], &CDU[dataOff+5], &CDU[dataOff+6], &CDU[dataOff+7]);
|
1128
|
+
}
|
1129
|
+
// DCT columns
|
1130
|
+
for(dataOff=0; dataOff<8; ++dataOff) {
|
1131
|
+
stbiw__jpg_DCT(&CDU[dataOff], &CDU[dataOff+8], &CDU[dataOff+16], &CDU[dataOff+24], &CDU[dataOff+32], &CDU[dataOff+40], &CDU[dataOff+48], &CDU[dataOff+56]);
|
1132
|
+
}
|
1133
|
+
// Quantize/descale/zigzag the coefficients
|
1134
|
+
for(i=0; i<64; ++i) {
|
1135
|
+
float v = CDU[i]*fdtbl[i];
|
1136
|
+
// DU[stbiw__jpg_ZigZag[i]] = (int)(v < 0 ? ceilf(v - 0.5f) : floorf(v + 0.5f));
|
1137
|
+
// ceilf() and floorf() are C99, not C89, but I /think/ they're not needed here anyway?
|
1138
|
+
DU[stbiw__jpg_ZigZag[i]] = (int)(v < 0 ? v - 0.5f : v + 0.5f);
|
1139
|
+
}
|
1140
|
+
|
1141
|
+
// Encode DC
|
1142
|
+
diff = DU[0] - DC;
|
1143
|
+
if (diff == 0) {
|
1144
|
+
stbiw__jpg_writeBits(s, bitBuf, bitCnt, HTDC[0]);
|
1145
|
+
} else {
|
1146
|
+
unsigned short bits[2];
|
1147
|
+
stbiw__jpg_calcBits(diff, bits);
|
1148
|
+
stbiw__jpg_writeBits(s, bitBuf, bitCnt, HTDC[bits[1]]);
|
1149
|
+
stbiw__jpg_writeBits(s, bitBuf, bitCnt, bits);
|
1150
|
+
}
|
1151
|
+
// Encode ACs
|
1152
|
+
end0pos = 63;
|
1153
|
+
for(; (end0pos>0)&&(DU[end0pos]==0); --end0pos) {
|
1154
|
+
}
|
1155
|
+
// end0pos = first element in reverse order !=0
|
1156
|
+
if(end0pos == 0) {
|
1157
|
+
stbiw__jpg_writeBits(s, bitBuf, bitCnt, EOB);
|
1158
|
+
return DU[0];
|
1159
|
+
}
|
1160
|
+
for(i = 1; i <= end0pos; ++i) {
|
1161
|
+
int startpos = i;
|
1162
|
+
int nrzeroes;
|
1163
|
+
unsigned short bits[2];
|
1164
|
+
for (; DU[i]==0 && i<=end0pos; ++i) {
|
1165
|
+
}
|
1166
|
+
nrzeroes = i-startpos;
|
1167
|
+
if ( nrzeroes >= 16 ) {
|
1168
|
+
int lng = nrzeroes>>4;
|
1169
|
+
int nrmarker;
|
1170
|
+
for (nrmarker=1; nrmarker <= lng; ++nrmarker)
|
1171
|
+
stbiw__jpg_writeBits(s, bitBuf, bitCnt, M16zeroes);
|
1172
|
+
nrzeroes &= 15;
|
1173
|
+
}
|
1174
|
+
stbiw__jpg_calcBits(DU[i], bits);
|
1175
|
+
stbiw__jpg_writeBits(s, bitBuf, bitCnt, HTAC[(nrzeroes<<4)+bits[1]]);
|
1176
|
+
stbiw__jpg_writeBits(s, bitBuf, bitCnt, bits);
|
1177
|
+
}
|
1178
|
+
if(end0pos != 63) {
|
1179
|
+
stbiw__jpg_writeBits(s, bitBuf, bitCnt, EOB);
|
1180
|
+
}
|
1181
|
+
return DU[0];
|
1182
|
+
}
|
1183
|
+
|
1184
|
+
static int stbi_write_jpg_core(stbi__write_context *s, int width, int height, int comp, const void* data, int quality) {
|
1185
|
+
// Constants that don't pollute global namespace
|
1186
|
+
static const unsigned char std_dc_luminance_nrcodes[] = {0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0};
|
1187
|
+
static const unsigned char std_dc_luminance_values[] = {0,1,2,3,4,5,6,7,8,9,10,11};
|
1188
|
+
static const unsigned char std_ac_luminance_nrcodes[] = {0,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,0x7d};
|
1189
|
+
static const unsigned char std_ac_luminance_values[] = {
|
1190
|
+
0x01,0x02,0x03,0x00,0x04,0x11,0x05,0x12,0x21,0x31,0x41,0x06,0x13,0x51,0x61,0x07,0x22,0x71,0x14,0x32,0x81,0x91,0xa1,0x08,
|
1191
|
+
0x23,0x42,0xb1,0xc1,0x15,0x52,0xd1,0xf0,0x24,0x33,0x62,0x72,0x82,0x09,0x0a,0x16,0x17,0x18,0x19,0x1a,0x25,0x26,0x27,0x28,
|
1192
|
+
0x29,0x2a,0x34,0x35,0x36,0x37,0x38,0x39,0x3a,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x53,0x54,0x55,0x56,0x57,0x58,0x59,
|
1193
|
+
0x5a,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x83,0x84,0x85,0x86,0x87,0x88,0x89,
|
1194
|
+
0x8a,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xb2,0xb3,0xb4,0xb5,0xb6,
|
1195
|
+
0xb7,0xb8,0xb9,0xba,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda,0xe1,0xe2,
|
1196
|
+
0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa
|
1197
|
+
};
|
1198
|
+
static const unsigned char std_dc_chrominance_nrcodes[] = {0,0,3,1,1,1,1,1,1,1,1,1,0,0,0,0,0};
|
1199
|
+
static const unsigned char std_dc_chrominance_values[] = {0,1,2,3,4,5,6,7,8,9,10,11};
|
1200
|
+
static const unsigned char std_ac_chrominance_nrcodes[] = {0,0,2,1,2,4,4,3,4,7,5,4,4,0,1,2,0x77};
|
1201
|
+
static const unsigned char std_ac_chrominance_values[] = {
|
1202
|
+
0x00,0x01,0x02,0x03,0x11,0x04,0x05,0x21,0x31,0x06,0x12,0x41,0x51,0x07,0x61,0x71,0x13,0x22,0x32,0x81,0x08,0x14,0x42,0x91,
|
1203
|
+
0xa1,0xb1,0xc1,0x09,0x23,0x33,0x52,0xf0,0x15,0x62,0x72,0xd1,0x0a,0x16,0x24,0x34,0xe1,0x25,0xf1,0x17,0x18,0x19,0x1a,0x26,
|
1204
|
+
0x27,0x28,0x29,0x2a,0x35,0x36,0x37,0x38,0x39,0x3a,0x43,0x44,0x45,0x46,0x47,0x48,0x49,0x4a,0x53,0x54,0x55,0x56,0x57,0x58,
|
1205
|
+
0x59,0x5a,0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6a,0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7a,0x82,0x83,0x84,0x85,0x86,0x87,
|
1206
|
+
0x88,0x89,0x8a,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xb2,0xb3,0xb4,
|
1207
|
+
0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7,0xc8,0xc9,0xca,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,0xd8,0xd9,0xda,
|
1208
|
+
0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa
|
1209
|
+
};
|
1210
|
+
// Huffman tables
|
1211
|
+
static const unsigned short YDC_HT[256][2] = { {0,2},{2,3},{3,3},{4,3},{5,3},{6,3},{14,4},{30,5},{62,6},{126,7},{254,8},{510,9}};
|
1212
|
+
static const unsigned short UVDC_HT[256][2] = { {0,2},{1,2},{2,2},{6,3},{14,4},{30,5},{62,6},{126,7},{254,8},{510,9},{1022,10},{2046,11}};
|
1213
|
+
static const unsigned short YAC_HT[256][2] = {
|
1214
|
+
{10,4},{0,2},{1,2},{4,3},{11,4},{26,5},{120,7},{248,8},{1014,10},{65410,16},{65411,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
|
1215
|
+
{12,4},{27,5},{121,7},{502,9},{2038,11},{65412,16},{65413,16},{65414,16},{65415,16},{65416,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
|
1216
|
+
{28,5},{249,8},{1015,10},{4084,12},{65417,16},{65418,16},{65419,16},{65420,16},{65421,16},{65422,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
|
1217
|
+
{58,6},{503,9},{4085,12},{65423,16},{65424,16},{65425,16},{65426,16},{65427,16},{65428,16},{65429,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
|
1218
|
+
{59,6},{1016,10},{65430,16},{65431,16},{65432,16},{65433,16},{65434,16},{65435,16},{65436,16},{65437,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
|
1219
|
+
{122,7},{2039,11},{65438,16},{65439,16},{65440,16},{65441,16},{65442,16},{65443,16},{65444,16},{65445,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
|
1220
|
+
{123,7},{4086,12},{65446,16},{65447,16},{65448,16},{65449,16},{65450,16},{65451,16},{65452,16},{65453,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
|
1221
|
+
{250,8},{4087,12},{65454,16},{65455,16},{65456,16},{65457,16},{65458,16},{65459,16},{65460,16},{65461,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
|
1222
|
+
{504,9},{32704,15},{65462,16},{65463,16},{65464,16},{65465,16},{65466,16},{65467,16},{65468,16},{65469,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
|
1223
|
+
{505,9},{65470,16},{65471,16},{65472,16},{65473,16},{65474,16},{65475,16},{65476,16},{65477,16},{65478,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
|
1224
|
+
{506,9},{65479,16},{65480,16},{65481,16},{65482,16},{65483,16},{65484,16},{65485,16},{65486,16},{65487,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
|
1225
|
+
{1017,10},{65488,16},{65489,16},{65490,16},{65491,16},{65492,16},{65493,16},{65494,16},{65495,16},{65496,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
|
1226
|
+
{1018,10},{65497,16},{65498,16},{65499,16},{65500,16},{65501,16},{65502,16},{65503,16},{65504,16},{65505,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
|
1227
|
+
{2040,11},{65506,16},{65507,16},{65508,16},{65509,16},{65510,16},{65511,16},{65512,16},{65513,16},{65514,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
|
1228
|
+
{65515,16},{65516,16},{65517,16},{65518,16},{65519,16},{65520,16},{65521,16},{65522,16},{65523,16},{65524,16},{0,0},{0,0},{0,0},{0,0},{0,0},
|
1229
|
+
{2041,11},{65525,16},{65526,16},{65527,16},{65528,16},{65529,16},{65530,16},{65531,16},{65532,16},{65533,16},{65534,16},{0,0},{0,0},{0,0},{0,0},{0,0}
|
1230
|
+
};
|
1231
|
+
static const unsigned short UVAC_HT[256][2] = {
|
1232
|
+
{0,2},{1,2},{4,3},{10,4},{24,5},{25,5},{56,6},{120,7},{500,9},{1014,10},{4084,12},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
|
1233
|
+
{11,4},{57,6},{246,8},{501,9},{2038,11},{4085,12},{65416,16},{65417,16},{65418,16},{65419,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
|
1234
|
+
{26,5},{247,8},{1015,10},{4086,12},{32706,15},{65420,16},{65421,16},{65422,16},{65423,16},{65424,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
|
1235
|
+
{27,5},{248,8},{1016,10},{4087,12},{65425,16},{65426,16},{65427,16},{65428,16},{65429,16},{65430,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
|
1236
|
+
{58,6},{502,9},{65431,16},{65432,16},{65433,16},{65434,16},{65435,16},{65436,16},{65437,16},{65438,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
|
1237
|
+
{59,6},{1017,10},{65439,16},{65440,16},{65441,16},{65442,16},{65443,16},{65444,16},{65445,16},{65446,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
|
1238
|
+
{121,7},{2039,11},{65447,16},{65448,16},{65449,16},{65450,16},{65451,16},{65452,16},{65453,16},{65454,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
|
1239
|
+
{122,7},{2040,11},{65455,16},{65456,16},{65457,16},{65458,16},{65459,16},{65460,16},{65461,16},{65462,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
|
1240
|
+
{249,8},{65463,16},{65464,16},{65465,16},{65466,16},{65467,16},{65468,16},{65469,16},{65470,16},{65471,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
|
1241
|
+
{503,9},{65472,16},{65473,16},{65474,16},{65475,16},{65476,16},{65477,16},{65478,16},{65479,16},{65480,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
|
1242
|
+
{504,9},{65481,16},{65482,16},{65483,16},{65484,16},{65485,16},{65486,16},{65487,16},{65488,16},{65489,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
|
1243
|
+
{505,9},{65490,16},{65491,16},{65492,16},{65493,16},{65494,16},{65495,16},{65496,16},{65497,16},{65498,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
|
1244
|
+
{506,9},{65499,16},{65500,16},{65501,16},{65502,16},{65503,16},{65504,16},{65505,16},{65506,16},{65507,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
|
1245
|
+
{2041,11},{65508,16},{65509,16},{65510,16},{65511,16},{65512,16},{65513,16},{65514,16},{65515,16},{65516,16},{0,0},{0,0},{0,0},{0,0},{0,0},{0,0},
|
1246
|
+
{16352,14},{65517,16},{65518,16},{65519,16},{65520,16},{65521,16},{65522,16},{65523,16},{65524,16},{65525,16},{0,0},{0,0},{0,0},{0,0},{0,0},
|
1247
|
+
{1018,10},{32707,15},{65526,16},{65527,16},{65528,16},{65529,16},{65530,16},{65531,16},{65532,16},{65533,16},{65534,16},{0,0},{0,0},{0,0},{0,0},{0,0}
|
1248
|
+
};
|
1249
|
+
static const int YQT[] = {16,11,10,16,24,40,51,61,12,12,14,19,26,58,60,55,14,13,16,24,40,57,69,56,14,17,22,29,51,87,80,62,18,22,
|
1250
|
+
37,56,68,109,103,77,24,35,55,64,81,104,113,92,49,64,78,87,103,121,120,101,72,92,95,98,112,100,103,99};
|
1251
|
+
static const int UVQT[] = {17,18,24,47,99,99,99,99,18,21,26,66,99,99,99,99,24,26,56,99,99,99,99,99,47,66,99,99,99,99,99,99,
|
1252
|
+
99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99,99};
|
1253
|
+
static const float aasf[] = { 1.0f * 2.828427125f, 1.387039845f * 2.828427125f, 1.306562965f * 2.828427125f, 1.175875602f * 2.828427125f,
|
1254
|
+
1.0f * 2.828427125f, 0.785694958f * 2.828427125f, 0.541196100f * 2.828427125f, 0.275899379f * 2.828427125f };
|
1255
|
+
|
1256
|
+
int row, col, i, k;
|
1257
|
+
float fdtbl_Y[64], fdtbl_UV[64];
|
1258
|
+
unsigned char YTable[64], UVTable[64];
|
1259
|
+
|
1260
|
+
if(!data || !width || !height || comp > 4 || comp < 1) {
|
1261
|
+
return 0;
|
1262
|
+
}
|
1263
|
+
|
1264
|
+
quality = quality ? quality : 90;
|
1265
|
+
quality = quality < 1 ? 1 : quality > 100 ? 100 : quality;
|
1266
|
+
quality = quality < 50 ? 5000 / quality : 200 - quality * 2;
|
1267
|
+
|
1268
|
+
for(i = 0; i < 64; ++i) {
|
1269
|
+
int uvti, yti = (YQT[i]*quality+50)/100;
|
1270
|
+
YTable[stbiw__jpg_ZigZag[i]] = (unsigned char) (yti < 1 ? 1 : yti > 255 ? 255 : yti);
|
1271
|
+
uvti = (UVQT[i]*quality+50)/100;
|
1272
|
+
UVTable[stbiw__jpg_ZigZag[i]] = (unsigned char) (uvti < 1 ? 1 : uvti > 255 ? 255 : uvti);
|
1273
|
+
}
|
1274
|
+
|
1275
|
+
for(row = 0, k = 0; row < 8; ++row) {
|
1276
|
+
for(col = 0; col < 8; ++col, ++k) {
|
1277
|
+
fdtbl_Y[k] = 1 / (YTable [stbiw__jpg_ZigZag[k]] * aasf[row] * aasf[col]);
|
1278
|
+
fdtbl_UV[k] = 1 / (UVTable[stbiw__jpg_ZigZag[k]] * aasf[row] * aasf[col]);
|
1279
|
+
}
|
1280
|
+
}
|
1281
|
+
|
1282
|
+
// Write Headers
|
1283
|
+
{
|
1284
|
+
static const unsigned char head0[] = { 0xFF,0xD8,0xFF,0xE0,0,0x10,'J','F','I','F',0,1,1,0,0,1,0,1,0,0,0xFF,0xDB,0,0x84,0 };
|
1285
|
+
static const unsigned char head2[] = { 0xFF,0xDA,0,0xC,3,1,0,2,0x11,3,0x11,0,0x3F,0 };
|
1286
|
+
const unsigned char head1[] = { 0xFF,0xC0,0,0x11,8,(unsigned char)(height>>8),STBIW_UCHAR(height),(unsigned char)(width>>8),STBIW_UCHAR(width),
|
1287
|
+
3,1,0x11,0,2,0x11,1,3,0x11,1,0xFF,0xC4,0x01,0xA2,0 };
|
1288
|
+
s->func(s->context, (void*)head0, sizeof(head0));
|
1289
|
+
s->func(s->context, (void*)YTable, sizeof(YTable));
|
1290
|
+
stbiw__putc(s, 1);
|
1291
|
+
s->func(s->context, UVTable, sizeof(UVTable));
|
1292
|
+
s->func(s->context, (void*)head1, sizeof(head1));
|
1293
|
+
s->func(s->context, (void*)(std_dc_luminance_nrcodes+1), sizeof(std_dc_luminance_nrcodes)-1);
|
1294
|
+
s->func(s->context, (void*)std_dc_luminance_values, sizeof(std_dc_luminance_values));
|
1295
|
+
stbiw__putc(s, 0x10); // HTYACinfo
|
1296
|
+
s->func(s->context, (void*)(std_ac_luminance_nrcodes+1), sizeof(std_ac_luminance_nrcodes)-1);
|
1297
|
+
s->func(s->context, (void*)std_ac_luminance_values, sizeof(std_ac_luminance_values));
|
1298
|
+
stbiw__putc(s, 1); // HTUDCinfo
|
1299
|
+
s->func(s->context, (void*)(std_dc_chrominance_nrcodes+1), sizeof(std_dc_chrominance_nrcodes)-1);
|
1300
|
+
s->func(s->context, (void*)std_dc_chrominance_values, sizeof(std_dc_chrominance_values));
|
1301
|
+
stbiw__putc(s, 0x11); // HTUACinfo
|
1302
|
+
s->func(s->context, (void*)(std_ac_chrominance_nrcodes+1), sizeof(std_ac_chrominance_nrcodes)-1);
|
1303
|
+
s->func(s->context, (void*)std_ac_chrominance_values, sizeof(std_ac_chrominance_values));
|
1304
|
+
s->func(s->context, (void*)head2, sizeof(head2));
|
1305
|
+
}
|
1306
|
+
|
1307
|
+
// Encode 8x8 macroblocks
|
1308
|
+
{
|
1309
|
+
static const unsigned short fillBits[] = {0x7F, 7};
|
1310
|
+
const unsigned char *imageData = (const unsigned char *)data;
|
1311
|
+
int DCY=0, DCU=0, DCV=0;
|
1312
|
+
int bitBuf=0, bitCnt=0;
|
1313
|
+
// comp == 2 is grey+alpha (alpha is ignored)
|
1314
|
+
int ofsG = comp > 2 ? 1 : 0, ofsB = comp > 2 ? 2 : 0;
|
1315
|
+
int x, y, pos;
|
1316
|
+
for(y = 0; y < height; y += 8) {
|
1317
|
+
for(x = 0; x < width; x += 8) {
|
1318
|
+
float YDU[64], UDU[64], VDU[64];
|
1319
|
+
for(row = y, pos = 0; row < y+8; ++row) {
|
1320
|
+
for(col = x; col < x+8; ++col, ++pos) {
|
1321
|
+
int p = row*width*comp + col*comp;
|
1322
|
+
float r, g, b;
|
1323
|
+
if(row >= height) {
|
1324
|
+
p -= width*comp*(row+1 - height);
|
1325
|
+
}
|
1326
|
+
if(col >= width) {
|
1327
|
+
p -= comp*(col+1 - width);
|
1328
|
+
}
|
1329
|
+
|
1330
|
+
r = imageData[p+0];
|
1331
|
+
g = imageData[p+ofsG];
|
1332
|
+
b = imageData[p+ofsB];
|
1333
|
+
YDU[pos]=+0.29900f*r+0.58700f*g+0.11400f*b-128;
|
1334
|
+
UDU[pos]=-0.16874f*r-0.33126f*g+0.50000f*b;
|
1335
|
+
VDU[pos]=+0.50000f*r-0.41869f*g-0.08131f*b;
|
1336
|
+
}
|
1337
|
+
}
|
1338
|
+
|
1339
|
+
DCY = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, YDU, fdtbl_Y, DCY, YDC_HT, YAC_HT);
|
1340
|
+
DCU = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, UDU, fdtbl_UV, DCU, UVDC_HT, UVAC_HT);
|
1341
|
+
DCV = stbiw__jpg_processDU(s, &bitBuf, &bitCnt, VDU, fdtbl_UV, DCV, UVDC_HT, UVAC_HT);
|
1342
|
+
}
|
1343
|
+
}
|
1344
|
+
|
1345
|
+
// Do the bit alignment of the EOI marker
|
1346
|
+
stbiw__jpg_writeBits(s, &bitBuf, &bitCnt, fillBits);
|
1347
|
+
}
|
1348
|
+
|
1349
|
+
// EOI
|
1350
|
+
stbiw__putc(s, 0xFF);
|
1351
|
+
stbiw__putc(s, 0xD9);
|
1352
|
+
|
1353
|
+
return 1;
|
1354
|
+
}
|
1355
|
+
|
1356
|
+
STBIWDEF int stbi_write_jpg_to_func(stbi_write_func *func, void *context, int x, int y, int comp, const void *data, int quality)
|
1357
|
+
{
|
1358
|
+
stbi__write_context s;
|
1359
|
+
stbi__start_write_callbacks(&s, func, context);
|
1360
|
+
return stbi_write_jpg_core(&s, x, y, comp, (void *) data, quality);
|
1361
|
+
}
|
1362
|
+
|
1363
|
+
|
1364
|
+
#ifndef STBI_WRITE_NO_STDIO
|
1365
|
+
STBIWDEF int stbi_write_jpg(char const *filename, int x, int y, int comp, const void *data, int quality)
|
1366
|
+
{
|
1367
|
+
stbi__write_context s;
|
1368
|
+
if (stbi__start_write_file(&s,filename)) {
|
1369
|
+
int r = stbi_write_jpg_core(&s, x, y, comp, data, quality);
|
1370
|
+
stbi__end_write_file(&s);
|
1371
|
+
return r;
|
1372
|
+
} else
|
1373
|
+
return 0;
|
1374
|
+
}
|
1375
|
+
#endif
|
1376
|
+
|
1017
1377
|
#endif // STB_IMAGE_WRITE_IMPLEMENTATION
|
1018
1378
|
|
1019
1379
|
/* Revision history
|
1380
|
+
1.07 (2017-07-24)
|
1381
|
+
doc fix
|
1382
|
+
1.06 (2017-07-23)
|
1383
|
+
writing JPEG (using Jon Olick's code)
|
1384
|
+
1.05 ???
|
1385
|
+
1.04 (2017-03-03)
|
1386
|
+
monochrome BMP expansion
|
1387
|
+
1.03 ???
|
1020
1388
|
1.02 (2016-04-02)
|
1021
1389
|
avoid allocating large structures on the stack
|
1022
1390
|
1.01 (2016-01-16)
|
@@ -1046,3 +1414,45 @@ STBIWDEF int stbi_write_png_to_func(stbi_write_func *func, void *context, int x,
|
|
1046
1414
|
first public release
|
1047
1415
|
0.90 first internal release
|
1048
1416
|
*/
|
1417
|
+
|
1418
|
+
/*
|
1419
|
+
------------------------------------------------------------------------------
|
1420
|
+
This software is available under 2 licenses -- choose whichever you prefer.
|
1421
|
+
------------------------------------------------------------------------------
|
1422
|
+
ALTERNATIVE A - MIT License
|
1423
|
+
Copyright (c) 2017 Sean Barrett
|
1424
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
1425
|
+
this software and associated documentation files (the "Software"), to deal in
|
1426
|
+
the Software without restriction, including without limitation the rights to
|
1427
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
1428
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
1429
|
+
so, subject to the following conditions:
|
1430
|
+
The above copyright notice and this permission notice shall be included in all
|
1431
|
+
copies or substantial portions of the Software.
|
1432
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
1433
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
1434
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
1435
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
1436
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
1437
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
1438
|
+
SOFTWARE.
|
1439
|
+
------------------------------------------------------------------------------
|
1440
|
+
ALTERNATIVE B - Public Domain (www.unlicense.org)
|
1441
|
+
This is free and unencumbered software released into the public domain.
|
1442
|
+
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
|
1443
|
+
software, either in source code form or as a compiled binary, for any purpose,
|
1444
|
+
commercial or non-commercial, and by any means.
|
1445
|
+
In jurisdictions that recognize copyright laws, the author or authors of this
|
1446
|
+
software dedicate any and all copyright interest in the software to the public
|
1447
|
+
domain. We make this dedication for the benefit of the public at large and to
|
1448
|
+
the detriment of our heirs and successors. We intend this dedication to be an
|
1449
|
+
overt act of relinquishment in perpetuity of all present and future rights to
|
1450
|
+
this software under copyright law.
|
1451
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
1452
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
1453
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
1454
|
+
AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
1455
|
+
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
1456
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1457
|
+
------------------------------------------------------------------------------
|
1458
|
+
*/
|