Merge branch 'master' of https://github.com/LysanderGG/stb into working
This commit is contained in:
commit
70de0adb28
@ -12,6 +12,7 @@ library | lastest version | category | description
|
||||
**stretchy_buffer.h** | 1.01 | utility | typesafe dynamic array for C (i.e. approximation to vector<>), doesn't compile as C++
|
||||
**stb_textedit.h** | 1.3 | UI | guts of a text editor for games etc implementing them from scratch
|
||||
**stb_dxt.h** | 1.04 | 3D graphics | Fabian "ryg" Giesen's real-time DXT compressor
|
||||
**stb_herringbone_wang_tile.h** | 0.5 | games | herringbone Wang tile map generator
|
||||
**stb_perlin.h** | 0.2 | 3D graphics | revised Perlin noise (3D input, 1D output)
|
||||
**stb_c_lexer.h** | 0.06 | parsing | simplify writing parsers for C-like languages
|
||||
**stb_divide.h** | 0.91 | math | more useful 32-bit modulus e.g. "euclidean divide"
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* stbhw - v0.5 - http://nothings.org/stb/stb_herringbone_wang_tile.h
|
||||
/* stbhw - v0.5 - http://nothings.org/gamedev/herringbone
|
||||
Herringbone Wang Tile Generator - Sean Barrett 2014 - public domain
|
||||
|
||||
This file is in the public domain. In case that declaration is ineffective,
|
||||
|
@ -553,6 +553,7 @@ static stbi_uc *stbi__hdr_to_ldr(float *data, int x, int y, int comp);
|
||||
|
||||
static unsigned char *stbi_load_main(stbi__context *s, int *x, int *y, int *comp, int req_comp)
|
||||
{
|
||||
s->img_n = 0;
|
||||
if (stbi__jpeg_test(s)) return stbi__jpeg_load(s,x,y,comp,req_comp);
|
||||
if (stbi__png_test(s)) return stbi__png_load(s,x,y,comp,req_comp);
|
||||
if (stbi__bmp_test(s)) return stbi__bmp_load(s,x,y,comp,req_comp);
|
||||
@ -1807,8 +1808,9 @@ static void stbi__cleanup_jpeg(stbi__jpeg *j)
|
||||
{
|
||||
int i;
|
||||
for (i=0; i < j->s->img_n; ++i) {
|
||||
if (j->img_comp[i].data) {
|
||||
if (j->img_comp[i].raw_data) {
|
||||
free(j->img_comp[i].raw_data);
|
||||
j->img_comp[i].raw_data = NULL;
|
||||
j->img_comp[i].data = NULL;
|
||||
}
|
||||
if (j->img_comp[i].linebuf) {
|
||||
|
@ -378,7 +378,7 @@ int main(int arg, char **argv)
|
||||
#ifndef STBTT_malloc
|
||||
#include <stdlib.h>
|
||||
#define STBTT_malloc(x,u) ((void)(u),malloc(x))
|
||||
#define STBTT_free(x,u) free(x)
|
||||
#define STBTT_free(x,u) ((void)(u),free(x))
|
||||
#endif
|
||||
|
||||
#ifndef STBTT_assert
|
||||
|
@ -1084,7 +1084,7 @@ static void compute_accelerated_huffman(Codebook *c)
|
||||
}
|
||||
}
|
||||
|
||||
static int uint32_compare(const void *p, const void *q)
|
||||
static int __cdecl uint32_compare(const void *p, const void *q)
|
||||
{
|
||||
uint32 x = * (uint32 *) p;
|
||||
uint32 y = * (uint32 *) q;
|
||||
@ -1240,7 +1240,7 @@ typedef struct
|
||||
uint16 x,y;
|
||||
} Point;
|
||||
|
||||
int point_compare(const void *p, const void *q)
|
||||
int __cdecl point_compare(const void *p, const void *q)
|
||||
{
|
||||
Point *a = (Point *) p;
|
||||
Point *b = (Point *) q;
|
||||
|
@ -18,26 +18,26 @@ int main(int argc, char **argv)
|
||||
fprintf(stderr, "Usage: herringbone_map {inputfile} {output-width} {output-height} {outputfile}\n");
|
||||
return 1;
|
||||
} else {
|
||||
char *filename = argv[1];
|
||||
char *filename = argv[1];
|
||||
int out_w = atoi(argv[2]);
|
||||
int out_h = atoi(argv[3]);
|
||||
int out_h = atoi(argv[3]);
|
||||
char *outfile = argv[4];
|
||||
|
||||
unsigned char *pixels, *out_pixels;
|
||||
stbhw_tileset ts;
|
||||
int w,h;
|
||||
unsigned char *pixels, *out_pixels;
|
||||
stbhw_tileset ts;
|
||||
int w,h;
|
||||
|
||||
pixels = stbi_load(filename, &w, &h, 0, 3);
|
||||
pixels = stbi_load(filename, &w, &h, 0, 3);
|
||||
if (pixels == 0) {
|
||||
fprintf(stderr, "Could open input file '%s'\n", filename);
|
||||
}
|
||||
|
||||
if (!stbhw_build_tileset_from_image(&ts, pixels, w*3, w, h)) {
|
||||
fprintf(stderr, "Error: %s\n", stbhw_get_last_error());
|
||||
return 1;
|
||||
}
|
||||
if (!stbhw_build_tileset_from_image(&ts, pixels, w*3, w, h)) {
|
||||
fprintf(stderr, "Error: %s\n", stbhw_get_last_error());
|
||||
return 1;
|
||||
}
|
||||
|
||||
free(pixels);
|
||||
free(pixels);
|
||||
|
||||
#ifdef DEBUG_OUTPUT
|
||||
{
|
||||
@ -66,17 +66,17 @@ int main(int argc, char **argv)
|
||||
}
|
||||
#endif
|
||||
|
||||
out_pixels = malloc(out_w * out_h * 3);
|
||||
out_pixels = malloc(out_w * out_h * 3);
|
||||
|
||||
if (!stbhw_generate_image(&ts, NULL, out_pixels, out_w*3, out_w, out_h)) {
|
||||
fprintf(stderr, "Error: %s\n", stbhw_get_last_error());
|
||||
return 1;
|
||||
}
|
||||
if (!stbhw_generate_image(&ts, NULL, out_pixels, out_w*3, out_w, out_h)) {
|
||||
fprintf(stderr, "Error: %s\n", stbhw_get_last_error());
|
||||
return 1;
|
||||
}
|
||||
|
||||
stbi_write_png(argv[4], out_w, out_h, 3, out_pixels, out_w*3);
|
||||
free(out_pixels);
|
||||
stbi_write_png(argv[4], out_w, out_h, 3, out_pixels, out_w*3);
|
||||
free(out_pixels);
|
||||
|
||||
stbhw_free_tileset(&ts);
|
||||
return 0;
|
||||
stbhw_free_tileset(&ts);
|
||||
return 0;
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@ stb_image_write.h | graphics | image writing to disk: PNG, TGA, BMP
|
||||
stretchy_buffer.h | utility | typesafe dynamic array for C (i.e. approximation to vector<>), doesn't compile as C++
|
||||
stb_textedit.h | UI | guts of a text editor for games etc implementing them from scratch
|
||||
stb_dxt.h | 3D graphics | Fabian "ryg" Giesen's real-time DXT compressor
|
||||
stb_herringbone_wang_tile.h | games | herringbone Wang tile map generator
|
||||
stb_perlin.h | 3D graphics | revised Perlin noise (3D input, 1D output)
|
||||
stb_c_lexer.h | parsing | simplify writing parsers for C-like languages
|
||||
stb_divide.h | math | more useful 32-bit modulus e.g. "euclidean divide"
|
||||
|
Loading…
Reference in New Issue
Block a user