summaryrefslogtreecommitdiff
path: root/hitomezashi.h
blob: e0782ebd1d776a4689fe2a6d011f0d55afd4a0e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef HITOMEZASHI_HITOMEZASHI_H
#define HITOMEZASHI_HITOMEZASHI_H

#include "SDL.h"

struct Hitomezashi_State {
  int x_pattern_len;
  int y_pattern_len;

  char *x_pattern;
  char *y_pattern;

  int gap;

  int line_thickness;

  int output_width;
  int output_height;

  SDL_Surface *surface;
};

enum Hitomezashi_State_Init_Result {
  Hitomezashi_State_Init_Result_Success,
  Hitomezashi_State_Init_Result_Err_Create_Surface,
};

enum Hitomezashi_Draw_Result {
  Hitomezashi_Draw_Result_Success,
  Hitomezashi_Draw_Result_Err_Lock_Surface,
};

enum Hitomezashi_State_Init_Result
hitomezashi_state_init(struct Hitomezashi_State *state, int x_pattern_len,
                       int y_pattern_len, char *x_pattern, char *y_pattern,
                       int gap, int line_thickness);

enum Hitomezashi_Draw_Result hitomezashi_draw(struct Hitomezashi_State *state);

#endif // HITOMEZASHI_HITOMEZASHI_H