aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/color.c45
-rw-r--r--src/color.h7
-rw-r--r--src/m.c22
-rw-r--r--src/m.h14
-rw-r--r--src/main.c3
5 files changed, 0 insertions, 91 deletions
diff --git a/src/color.c b/src/color.c
index d7b3cdf..10afeea 100644
--- a/src/color.c
+++ b/src/color.c
@@ -28,42 +28,6 @@ uint8_t rgb_luminance(uint8_t R, uint8_t G, uint8_t B)
return ret;
}
-char* calc_col(uint8_t R, uint8_t G, uint8_t B)
-{
- unsigned int nearest_num = 0;
- uint8_t a2[3];
- a2[0] = colors[0].R;
- a2[1] = colors[0].G;
- a2[2] = colors[0].B;
-
- uint8_t a1[] = {R,G,B};
-
- //Normalize the color
- //Does not really work all that well
- /*while(a1[0] < 255 && a1[1] < 255 && a1[2] < 255)
- {
- a1[0]++;
- a1[1]++;
- a1[2]++;
- }*/
-
- float nearest_val = distance( a1, a2 );
-
- for( unsigned int i = 1; i < _COLORS_SIZE; i++)
- {
- a2[0] = colors[i].R;
- a2[1] = colors[i].G;
- a2[2] = colors[i].B;
-
- float dist = distance(a1, a2);
- if(dist < nearest_val){
- nearest_num = i;
- nearest_val = dist;
- }
- }
- return colors[ nearest_num ].no;
-}
-//TODO consolidate
char* calc_col_ansi(uint8_t R, uint8_t G, uint8_t B, uint8_t _mode)
{
int mode = _mode == COLOR_BG ? 4 : 3;
@@ -74,12 +38,3 @@ char* calc_col_ansi(uint8_t R, uint8_t G, uint8_t B, uint8_t _mode)
return c;
}
-char* calc_bg_col_ansi(uint8_t R, uint8_t G, uint8_t B)
-{
- int num = 36 * (R/51) + 6 * (G/51) + (B/51);
- char *c = malloc(9);
- snprintf( c, 6, "48;5;" );
- snprintf( c + 5, 4, "%i", num + 16 );
-
- return c;
-}
diff --git a/src/color.h b/src/color.h
index a2f82d3..ffe1916 100644
--- a/src/color.h
+++ b/src/color.h
@@ -6,8 +6,6 @@
#include <stdio.h>
#include <stdlib.h>
-#include "m.h"
-
#define _COLORS_SIZE 16u
#define COLOR_FG 1
#define COLOR_BG 2
@@ -27,10 +25,5 @@ extern struct console_color colors[ _COLORS_SIZE ];
//Order LSB first: BGR
uint8_t rgb_luminance(uint8_t R, uint8_t G, uint8_t B);
-//Get nearest printable color in console
-char *calc_col(uint8_t R, uint8_t G, uint8_t B);
-
char *calc_col_ansi(uint8_t R, uint8_t G, uint8_t B, uint8_t _mode);
-
-char *calc_bg_col_ansi(uint8_t R, uint8_t G, uint8_t B);
#endif //_COLOR_H_
diff --git a/src/m.c b/src/m.c
deleted file mode 100644
index b1401f1..0000000
--- a/src/m.c
+++ /dev/null
@@ -1,22 +0,0 @@
-#include "m.h"
-
-uint8_t avg(int argc, uint8_t *argv)
-{
- uint8_t ret = 0;
- uint64_t sum = 0;
-
- for(int i = 0; i < argc; i++)
- sum += (uint64_t)argv[i];
-
- ret = (char)(sum / argc);
-
- return ret;
-}//avg
-
-
-float distance(uint8_t _1[3], uint8_t _2[3])
-{
- return fabs( sqrt( pow((double)_2[0] - (double)_1[0], 2) +
- pow((double)_2[1] - (double)_1[1], 2) +
- pow((double)_2[2] - (double)_1[2], 2) ) );
-}
diff --git a/src/m.h b/src/m.h
deleted file mode 100644
index 25aff9e..0000000
--- a/src/m.h
+++ /dev/null
@@ -1,14 +0,0 @@
-#ifndef _M_H_
-#define _M_H_
-
-#include <stdint.h>
-#include <math.h>
-
-
-//Calculate average
-uint8_t avg(int argc, uint8_t *argv);
-
-//Distance of 2 3d vectors
-float distance(uint8_t _1[3], uint8_t _2[3]);
-
-#endif
diff --git a/src/main.c b/src/main.c
index d73c58a..26f38c2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -12,7 +12,6 @@
#include "bitmap.h"
#include "character.h"
-#include "m.h"
#include "color.h"
#ifdef _DEBUG
@@ -53,8 +52,6 @@ int main(int argc, char *argv[])
uint8_t brightness_min = 0x00;
uint8_t brightness_max = 0xff;
- int size_x, size_y;
-
if ( bitmap_read(args.filename, &bitmap) ) {
printf("Error reading file\n");
return 1;