summaryrefslogtreecommitdiffstats
path: root/flatten.c
diff options
context:
space:
mode:
authorHenning Makholm <henning@makholm.net>2006-02-19 18:00:00 (EST)
committer Julien Jorge <julien.jorge@stuff-o-matic.com>2013-01-10 16:05:04 (EST)
commit4877693228e5f942db451c5f2b0ccabb5b050813 (patch)
tree72b1f863eaa746e6aac955172e7081e40ee0418c /flatten.c
parent00a8b13b5bf8cf2c367a0db3ae09086e45230968 (diff)
downloadxcftools-4877693228e5f942db451c5f2b0ccabb5b050813.zip
xcftools-4877693228e5f942db451c5f2b0ccabb5b050813.tar.gz
xcftools-4877693228e5f942db451c5f2b0ccabb5b050813.tar.bz2
Import of release 1.0.0
Diffstat (limited to 'flatten.c')
-rw-r--r--flatten.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/flatten.c b/flatten.c
index 45ce005..e4a1382 100644
--- a/flatten.c
+++ b/flatten.c
@@ -379,7 +379,8 @@ merge_exotic(struct Tile *bot, const struct Tile *top,
break ;
}
default:
- FatalUnsupportedXCF(_("'%s' layer mode"),showGimpLayerModeEffects(mode));
+ FatalUnsupportedXCF(_("'%s' layer mode"),
+ _(showGimpLayerModeEffects(mode)));
}
if( FULLALPHA(bot->pixels[i] & top->pixels[i]) )
bot->pixels[i] = (bot->pixels[i] & (255 << ALPHA_SHIFT)) +
@@ -548,7 +549,7 @@ flattenTopdown(struct FlattenSpec *spec, struct Tile *top,
}
static void
-addBackground(struct FlattenSpec *spec, struct Tile *tile)
+addBackground(struct FlattenSpec *spec, struct Tile *tile, unsigned ncols)
{
unsigned i ;
@@ -568,6 +569,21 @@ addBackground(struct FlattenSpec *spec, struct Tile *tile)
break ;
}
+ if( spec->default_pixel == CHECKERED_BACKGROUND ) {
+ INIT_SCALETABLE_IF( !(tile->summary & TILESUMMARY_CRISP ) );
+ for( i=0; i<tile->count; i++ )
+ if( !FULLALPHA(tile->pixels[i]) ) {
+ rgba fillwith = ((i/ncols)^(i%ncols))&8 ? 0x66 : 0x99 ;
+ fillwith = graytable[fillwith] + (255 << ALPHA_SHIFT) ;
+ if( NULLALPHA(tile->pixels[i]) )
+ tile->pixels[i] = fillwith ;
+ else
+ tile->pixels[i] = composite_one(fillwith,tile->pixels[i]);
+ }
+ tile->summary = TILESUMMARY_UPTODATE +
+ TILESUMMARY_ALLFULL + TILESUMMARY_CRISP ;
+ return ;
+ }
if( !FULLALPHA(spec->default_pixel) ) return ;
if( tileSummary(tile) & TILESUMMARY_ALLNULL ) {
fillTile(tile,spec->default_pixel);
@@ -616,7 +632,7 @@ flattenIncrementally(struct FlattenSpec *spec,lineCallback callback)
TILESUMMARY_ALLNULL + TILESUMMARY_CRISP );
tile = flattenTopdown(spec,&toptile,spec->numLayers,&where) ;
toptile.refcount-- ; /* addBackground may change destructively */
- addBackground(spec,tile);
+ addBackground(spec,tile,ncols);
for( i = 0 ; i < tile->count ; i++ )
if( NULLALPHA(tile->pixels[i]) )