/* cross-stitch.h
(C) 2020 by marnout à free pt fr  Released under the GPL
*/

#ifndef MRD_CROSS_STITCH_H
#define MRD_CROSS_STITCH_H

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gd.h>

#define step 15
#define pad step
#define hole 3
#define scale 2
#define palette_size 8

// crotchets by line, pitches
int N = 24;
// frame width, height
int W, H; // aida width, height
int width, height;
// palette
int palette[][3] = {
   {0, 0, 0},
   {210, 215, 219},
   {249, 245, 240},
   {124, 142, 145},
   {0, 0, 120},
   {60, 60, 240},
   {60, 240, 60},
   {255, 255, 250}
};
// stitches colors
int color[][3] = {
   {255, 0, 0},
   {0, 255, 0},
   {0, 0, 255},
   {127, 0, 0},
   {0, 127, 0},
   {0, 0, 127},
   {127, 127, 0},
   {127, 0, 127}
};

const int NaN = 255; // not a number !

FILE *jpeg;
// colors
int fg[7], c[7];
// image pointer
gdImagePtr im;
// saved coord
int x, y, _x, _y;
// draw line from x1, y1, to x2, y2
void line(int, int, int, int, int);
// draw line from the saved point to x, y
void lineto(int x, int y, int c) {line(_x, _y, x, y, c);}
// rectangle box(x, y, w, h, color)
void rect(int, int, int, int, int);
// filled rectangle box(x, y, w, h, color)
void box(int, int, int, int, int);
// draw cross stitch  cross(x, y, color)
void cross(int, int, int);
// draw a rest
void rest(int, int, int);
// make the cloth
void aida();
// do cross-titches
void score(char *);
// save the image
void save(char *);

#endif
