File: flatten.h

package info (click to toggle)
xcftools 1.0.7-6%2Bdeb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,308 kB
  • sloc: sh: 3,898; ansic: 3,158; perl: 668; makefile: 216
file content (77 lines) | stat: -rw-r--r-- 2,445 bytes parent folder | download | duplicates (6)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* Flattning functions for xcftools
 *
 * This file was written by Henning Makholm <henning@makholm.net>
 * It is hereby in the public domain.
 * 
 * In jurisdictions that do not recognise grants of copyright to the
 * public domain: I, the author and (presumably, in those jurisdictions)
 * copyright holder, hereby permit anyone to distribute and use this code,
 * in source code or binary form, with or without modifications. This
 * permission is world-wide and irrevocable.
 *
 * Of course, I will not be liable for any errors or shortcomings in the
 * code, since I give it away without asking any compenstations.
 *
 * If you use or distribute this code, I would appreciate receiving
 * credit for writing it, in whichever way you find proper and customary.
 */

#ifndef FLATTEN_H
#define FLATTEN_H

#include "xcftools.h"
#include "pixels.h"

#define PERHAPS_ALPHA_CHANNEL (NEWALPHA(0,1))
#define FORCE_ALPHA_CHANNEL (NEWALPHA(0,2))
#define CHECKERED_BACKGROUND (NEWALPHA(0,200))
struct FlattenSpec {
  struct tileDimensions dim ;
  rgba default_pixel ;
  int numLayers ;
  struct xcfLayer *layers ;

  const char * transmap_filename ;
  const char * output_filename ;
  enum out_color_mode {
    COLOR_BY_FILENAME,
    COLOR_BY_CONTENTS,
    COLOR_INDEXED,
    COLOR_RGB,
    COLOR_GRAY,
    COLOR_MONO
  } out_color_mode ;
  enum { ALLOW_PARTIAL_TRANSPARENCY,
         DISSOLVE_PARTIAL_TRANSPARENCY,
         FORBID_PARTIAL_TRANSPARENCY,
         PARTIAL_TRANSPARENCY_IMPOSSIBLE
  } partial_transparency_mode ;
  enum { USE_CANVAS = 0,
         MANUAL_OFFSET = 1,
         MANUAL_CROP = 2,
         AUTOCROP = 4 } window_mode ;
  int process_in_memory ;
  int gimpish_indexed ;
};

/* From flatspec.c */

void init_flatspec(struct FlattenSpec *);

void add_layer_request(struct FlattenSpec *,const char *name);
struct xcfLayer *lastlayerspec(struct FlattenSpec *,const char *option);

typedef enum out_color_mode (*guesser) (struct FlattenSpec *,rgba **);

/* Call this after processing options, and after opening the XCF file */
void complete_flatspec(struct FlattenSpec *,guesser);
void analyse_colormode(struct FlattenSpec *,rgba **allPixels,guesser);

/* From flatten.c */

typedef void (*lineCallback)(unsigned num,rgba *pixels);
void flattenIncrementally(struct FlattenSpec *,lineCallback);
rgba **flattenAll(struct FlattenSpec*);
void shipoutWithCallback(struct FlattenSpec *,rgba **pixels,lineCallback);

#endif /* FLATTEN_H */