First version out
It certainly is full of bug but the main goal is done so i'm kinda happy ^^
This commit is contained in:
		
							
								
								
									
										3
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										3
									
								
								Makefile
									
									
									
									
									
								
							@ -1,6 +1,7 @@
 | 
			
		||||
.PHONY: clean, mrproper
 | 
			
		||||
CC = gcc
 | 
			
		||||
CFLAGS = -g -Wall -Wextra -pedantic
 | 
			
		||||
LIBS = -lm
 | 
			
		||||
 | 
			
		||||
all: fisualizer
 | 
			
		||||
 | 
			
		||||
@ -8,7 +9,7 @@ all: fisualizer
 | 
			
		||||
	$(CC) $(CFLAGS) -c -o $@ $<
 | 
			
		||||
 | 
			
		||||
fisualizer: fisualizer.o
 | 
			
		||||
	$(CC) $(CFLAGS) -o $@ $+
 | 
			
		||||
	$(CC) $(CFLAGS) -o $@ $+ $(LIBS)
 | 
			
		||||
 | 
			
		||||
clean:
 | 
			
		||||
	rm -f *.o core.*
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										10
									
								
								fisualizer.c
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								fisualizer.c
									
									
									
									
									
								
							@ -1,8 +1,10 @@
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
#include <math.h>
 | 
			
		||||
 | 
			
		||||
#define STB_IMAGE_WRITE_IMPLEMENTATION
 | 
			
		||||
#include "stb_image_write.h"
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
FILE *fd;
 | 
			
		||||
size_t file_sz;
 | 
			
		||||
@ -12,7 +14,7 @@ char *filename_output;
 | 
			
		||||
int main(int argc, char *argv[])
 | 
			
		||||
{
 | 
			
		||||
	argv++;
 | 
			
		||||
	while(argc--){
 | 
			
		||||
	while(--argc){
 | 
			
		||||
 | 
			
		||||
		const char* filename = *argv++;
 | 
			
		||||
		filename_output = malloc(sizeof(char) * strlen(filename) + 8);
 | 
			
		||||
@ -33,9 +35,11 @@ int main(int argc, char *argv[])
 | 
			
		||||
 | 
			
		||||
		canvas = calloc(256*256, sizeof(char));
 | 
			
		||||
 | 
			
		||||
		double weight = (double)file_sz / 255; 
 | 
			
		||||
 | 
			
		||||
		for (size_t i = 0; i < file_sz - 1; ++i) {
 | 
			
		||||
			unsigned char at_pos = file_cnt[i], next_pos = file_cnt[i+1];
 | 
			
		||||
			canvas[at_pos + next_pos * 256] = 255;
 | 
			
		||||
			canvas[at_pos + next_pos * 256] += weight;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		stbi_write_png(strcat(filename_output, ".out.png"), 256, 256, 1, canvas, 256);
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user