44 if( spec->
layers == NULL ) {
59 if(
spec->numLayers == 0 ) {
60 FatalGeneric(20,
_(
"The %s option must follow a layer name on the "
61 "command line"),option);
64 return spec->layers + (
spec->numLayers-1) ;
83static enum out_color_mode
96 }
else if(
spec->gimpish_indexed &&
113 for( i=0; i<
spec->numLayers; i++ )
114 switch(
spec->layers[i].type ) {
138 if(
spec->numLayers == 0 ) {
142 for( i=0; i<
spec->numLayers; i++ ) {
150 spec->layers[i].name);
165 spec->layers[i].name);
172 spec->layers[i].isVisible = 1 ;
179 for( i=0; i <
spec->numLayers; i++ ) {
180 if(
spec->layers[i].isVisible ) {
189 for( i=0; i<
spec->numLayers; i++ )
193 spec->gimpish_indexed = 0 ;
196 if(
spec->window_mode == AUTOCROP ) {
198 for( i=0; i<
spec->numLayers; i++ )
199 if(
spec->layers[i].isVisible ) {
218 spec->window_mode = USE_CANVAS ;
224 if(
spec->window_mode != AUTOCROP ) {
225 if( (
spec->window_mode & MANUAL_OFFSET) == 0 )
227 if( (
spec->window_mode & MANUAL_CROP) == 0 ) {
237 for( i=0; i<
spec->numLayers; i++ )
238 if(
spec->layers[i].isVisible &&
240 spec->layers[i].isVisible = 0 ;
245 for( i=
spec->numLayers; i-- ; ) {
246 if( !
spec->layers[i].isVisible )
252 !
spec->layers[i].hasMask &&
260 while(i)
spec->layers[--i].isVisible = 0 ;
267 if(
spec->partial_transparency_mode == ALLOW_PARTIAL_TRANSPARENCY &&
269 spec->partial_transparency_mode = PARTIAL_TRANSPARENCY_IMPOSSIBLE ;
272 for( i=
spec->numLayers; i--; )
273 if(
spec->layers[i].isVisible ) {
284 if(
spec->layers[i].opacity < 255 )
293 if(
spec->out_color_mode == COLOR_BY_CONTENTS &&
294 !
spec->process_in_memory ) {
297 if(
spec->out_color_mode == COLOR_BY_CONTENTS )
328 if(
spec->partial_transparency_mode == DISSOLVE_PARTIAL_TRANSPARENCY ||
329 spec->partial_transparency_mode == PARTIAL_TRANSPARENCY_IMPOSSIBLE )
336 for( y=0; status && y<
spec->dim.
height; y++ ) {
338 if( (status & 3) != 0 ) {
340 for( x=0; status && x<
spec->dim.
width; x++ ) {
356 for( x=0; status && x<
spec->dim.
width; x++ ) {
367 switch(
spec->out_color_mode ) {
372 if( (status & 1) == 0 ) {
374 _(
"Grayscale output selected, but colored pixel(s) found"));
379 if( (status & 2) == 0 ) {
380 FatalGeneric(103,
_(
"Monochrome output selected, but not all pixels "
381 "are black or white"));
385 case COLOR_BY_FILENAME:
386 case COLOR_BY_CONTENTS:
387 if( (status & 1) == 0 )
388 spec->out_color_mode = COLOR_RGB ;
389 else if( (status & 2) == 0 )
390 spec->out_color_mode = COLOR_GRAY ;
392 spec->out_color_mode = COLOR_MONO ;
396 if( (status & 12) == 12 )
398 else if( (status & 12) == 4 )
399 spec->partial_transparency_mode = PARTIAL_TRANSPARENCY_IMPOSSIBLE ;
const char * showGimpLayerModeEffects(GimpLayerModeEffects x)
const char * showGimpImageType(GimpImageType x)
@ GIMP_NORMAL_NOPARTIAL_MODE
int add_layer_request(struct FlattenSpec *spec, const char *layer)
int complete_flatspec(struct FlattenSpec *spec, guesser guess_callback)
static int typeHasTransparency(GimpImageType type)
static enum out_color_mode color_by_layers(struct FlattenSpec *spec)
struct xcfLayer * lastlayerspec(struct FlattenSpec *spec, const char *option)
void init_flatspec(struct FlattenSpec *spec)
int analyse_colormode(struct FlattenSpec *spec, rgba **allPixels, guesser guess_callback)
#define FORCE_ALPHA_CHANNEL
#define PERHAPS_ALPHA_CHANNEL
enum out_color_mode(* guesser)(struct FlattenSpec *, rgba **)
#define CHECKERED_BACKGROUND
int degrayPixel(rgba pixel)
int initLayer(struct xcfLayer *layer)
const char * transmap_filename
enum FlattenSpec::@15 window_mode
const char * output_filename
enum FlattenSpec::@14 partial_transparency_mode
GimpLayerModeEffects mode
struct tileDimensions dim
void FatalGeneric(int status, const char *format,...)
void FatalUnexpected(const char *format,...)
int computeDimensions(struct tileDimensions *d)