|
|
@ -561,7 +561,7 @@ void XCFImageFormat::initializeImage ( XCFImage& xcf_image )
|
|
|
|
// individual colors.
|
|
|
|
// individual colors.
|
|
|
|
|
|
|
|
|
|
|
|
// Note: TQt treats a bitmap with a Black and White color palette
|
|
|
|
// Note: TQt treats a bitmap with a Black and White color palette
|
|
|
|
// as a tqmask, so only the "on" bits are drawn, regardless of the
|
|
|
|
// as a mask, so only the "on" bits are drawn, regardless of the
|
|
|
|
// order color table entries. Otherwise (i.e., at least one of the
|
|
|
|
// order color table entries. Otherwise (i.e., at least one of the
|
|
|
|
// color table entries is not black or white), it obeys the one-
|
|
|
|
// color table entries is not black or white), it obeys the one-
|
|
|
|
// or two-color palette. Have to ask about this...
|
|
|
|
// or two-color palette. Have to ask about this...
|
|
|
@ -750,7 +750,7 @@ void XCFImageFormat::setPalette ( XCFImage& xcf_image, TQImage& image )
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
/*!
|
|
|
|
* An XCF file can contain an arbitrary number of properties associated
|
|
|
|
* An XCF file can contain an arbitrary number of properties associated
|
|
|
|
* with the image (and layer and tqmask).
|
|
|
|
* with the image (and layer and mask).
|
|
|
|
* \param xcf_io the data stream connected to the XCF image
|
|
|
|
* \param xcf_io the data stream connected to the XCF image
|
|
|
|
* \param xcf_image XCF image data.
|
|
|
|
* \param xcf_image XCF image data.
|
|
|
|
* \return true if there were no I/O errors.
|
|
|
|
* \return true if there were no I/O errors.
|
|
|
@ -964,15 +964,15 @@ bool XCFImageFormat::loadLayerProperties ( SafeDataStream& xcf_io, Layer& layer
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case PROP_APPLY_MASK:
|
|
|
|
case PROP_APPLY_MASK:
|
|
|
|
property >> layer.apply_tqmask;
|
|
|
|
property >> layer.apply_mask;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case PROP_EDIT_MASK:
|
|
|
|
case PROP_EDIT_MASK:
|
|
|
|
property >> layer.edit_tqmask;
|
|
|
|
property >> layer.edit_mask;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case PROP_SHOW_MASK:
|
|
|
|
case PROP_SHOW_MASK:
|
|
|
|
property >> layer.show_tqmask;
|
|
|
|
property >> layer.show_mask;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
|
|
case PROP_OFFSETS:
|
|
|
|
case PROP_OFFSETS:
|
|
|
@ -995,9 +995,9 @@ bool XCFImageFormat::loadLayerProperties ( SafeDataStream& xcf_io, Layer& layer
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
/*!
|
|
|
|
* An XCF file can contain an arbitrary number of properties associated
|
|
|
|
* An XCF file can contain an arbitrary number of properties associated
|
|
|
|
* with a channel. Note that this routine only reads tqmask channel properties.
|
|
|
|
* with a channel. Note that this routine only reads mask channel properties.
|
|
|
|
* \param xcf_io the data stream connected to the XCF image.
|
|
|
|
* \param xcf_io the data stream connected to the XCF image.
|
|
|
|
* \param layer layer containing the tqmask channel to collect the properties.
|
|
|
|
* \param layer layer containing the mask channel to collect the properties.
|
|
|
|
* \return true if there were no I/O errors.
|
|
|
|
* \return true if there were no I/O errors.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
bool XCFImageFormat::loadChannelProperties ( SafeDataStream& xcf_io, Layer& layer )
|
|
|
|
bool XCFImageFormat::loadChannelProperties ( SafeDataStream& xcf_io, Layer& layer )
|
|
|
@ -1167,9 +1167,9 @@ bool XCFImageFormat::loadLevel ( SafeDataStream& xcf_io, Layer& layer, TQ_INT32
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
/*!
|
|
|
|
* A layer can have a one channel image which is used as a tqmask.
|
|
|
|
* A layer can have a one channel image which is used as a mask.
|
|
|
|
* \param xcf_io the data stream connected to the XCF image.
|
|
|
|
* \param xcf_io the data stream connected to the XCF image.
|
|
|
|
* \param layer the layer to collect the tqmask image.
|
|
|
|
* \param layer the layer to collect the mask image.
|
|
|
|
* \return true if there were no I/O errors.
|
|
|
|
* \return true if there were no I/O errors.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
bool XCFImageFormat::loadMask ( SafeDataStream& xcf_io, Layer& layer )
|
|
|
|
bool XCFImageFormat::loadMask ( SafeDataStream& xcf_io, Layer& layer )
|
|
|
@ -1181,7 +1181,7 @@ bool XCFImageFormat::loadMask ( SafeDataStream& xcf_io, Layer& layer )
|
|
|
|
xcf_io >> width >> height >> name;
|
|
|
|
xcf_io >> width >> height >> name;
|
|
|
|
|
|
|
|
|
|
|
|
if ( xcf_io.failed() ) {
|
|
|
|
if ( xcf_io.failed() ) {
|
|
|
|
qDebug( "XCF: read failure on tqmask info" );
|
|
|
|
qDebug( "XCF: read failure on mask info" );
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1194,7 +1194,7 @@ bool XCFImageFormat::loadMask ( SafeDataStream& xcf_io, Layer& layer )
|
|
|
|
xcf_io >> hierarchy_offset;
|
|
|
|
xcf_io >> hierarchy_offset;
|
|
|
|
|
|
|
|
|
|
|
|
if ( xcf_io.failed() ) {
|
|
|
|
if ( xcf_io.failed() ) {
|
|
|
|
qDebug( "XCF: read failure on tqmask image offset" );
|
|
|
|
qDebug( "XCF: read failure on mask image offset" );
|
|
|
|
return false;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -1393,8 +1393,8 @@ void XCFImageFormat::assignImageBytes ( Layer& layer, uint i, uint j )
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*!
|
|
|
|
/*!
|
|
|
|
* Copy the bytes from the tile buffer into the tqmask tile TQImage.
|
|
|
|
* Copy the bytes from the tile buffer into the mask tile TQImage.
|
|
|
|
* \param layer layer containing the tile buffer and the tqmask tile matrix.
|
|
|
|
* \param layer layer containing the tile buffer and the mask tile matrix.
|
|
|
|
* \param i column index of current tile.
|
|
|
|
* \param i column index of current tile.
|
|
|
|
* \param j row index of current tile.
|
|
|
|
* \param j row index of current tile.
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -1605,9 +1605,9 @@ void XCFImageFormat::copyRGBToRGB ( Layer& layer, uint i, uint j, int k, int l,
|
|
|
|
if ( layer.type == RGBA_GIMAGE )
|
|
|
|
if ( layer.type == RGBA_GIMAGE )
|
|
|
|
src_a = INT_MULT( src_a, tqAlpha( src ) );
|
|
|
|
src_a = INT_MULT( src_a, tqAlpha( src ) );
|
|
|
|
|
|
|
|
|
|
|
|
// Apply the tqmask (if any)
|
|
|
|
// Apply the mask (if any)
|
|
|
|
|
|
|
|
|
|
|
|
if ( layer.apply_tqmask == 1 && layer.mask_tiles.size() > j &&
|
|
|
|
if ( layer.apply_mask == 1 && layer.mask_tiles.size() > j &&
|
|
|
|
layer.mask_tiles[j].size() > i )
|
|
|
|
layer.mask_tiles[j].size() > i )
|
|
|
|
src_a = INT_MULT( src_a, layer.mask_tiles[j][i].pixelIndex( k, l ) );
|
|
|
|
src_a = INT_MULT( src_a, layer.mask_tiles[j][i].pixelIndex( k, l ) );
|
|
|
|
|
|
|
|
|
|
|
@ -1678,9 +1678,9 @@ void XCFImageFormat::copyGrayAToRGB ( Layer& layer, uint i, uint j, int k, int l
|
|
|
|
|
|
|
|
|
|
|
|
src_a = INT_MULT( src_a, layer.opacity );
|
|
|
|
src_a = INT_MULT( src_a, layer.opacity );
|
|
|
|
|
|
|
|
|
|
|
|
// Apply the tqmask (if any)
|
|
|
|
// Apply the mask (if any)
|
|
|
|
|
|
|
|
|
|
|
|
if ( layer.apply_tqmask == 1 && layer.mask_tiles.size() > j &&
|
|
|
|
if ( layer.apply_mask == 1 && layer.mask_tiles.size() > j &&
|
|
|
|
layer.mask_tiles[j].size() > i )
|
|
|
|
layer.mask_tiles[j].size() > i )
|
|
|
|
src_a = INT_MULT( src_a, layer.mask_tiles[j][i].pixelIndex( k, l ) );
|
|
|
|
src_a = INT_MULT( src_a, layer.mask_tiles[j][i].pixelIndex( k, l ) );
|
|
|
|
|
|
|
|
|
|
|
@ -1726,7 +1726,7 @@ void XCFImageFormat::copyIndexedAToIndexed ( Layer& layer,uint i,uint j,int k,in
|
|
|
|
|
|
|
|
|
|
|
|
src_a = INT_MULT( src_a, layer.opacity );
|
|
|
|
src_a = INT_MULT( src_a, layer.opacity );
|
|
|
|
|
|
|
|
|
|
|
|
if ( layer.apply_tqmask == 1 &&
|
|
|
|
if ( layer.apply_mask == 1 &&
|
|
|
|
layer.mask_tiles.size() > j &&
|
|
|
|
layer.mask_tiles.size() > j &&
|
|
|
|
layer.mask_tiles[j].size() > i )
|
|
|
|
layer.mask_tiles[j].size() > i )
|
|
|
|
src_a = INT_MULT( src_a,
|
|
|
|
src_a = INT_MULT( src_a,
|
|
|
@ -1762,9 +1762,9 @@ void XCFImageFormat::copyIndexedAToRGB ( Layer& layer, uint i, uint j, int k, in
|
|
|
|
|
|
|
|
|
|
|
|
src_a = INT_MULT( src_a, layer.opacity );
|
|
|
|
src_a = INT_MULT( src_a, layer.opacity );
|
|
|
|
|
|
|
|
|
|
|
|
// Apply the tqmask (if any)
|
|
|
|
// Apply the mask (if any)
|
|
|
|
|
|
|
|
|
|
|
|
if ( layer.apply_tqmask == 1 && layer.mask_tiles.size() > j &&
|
|
|
|
if ( layer.apply_mask == 1 && layer.mask_tiles.size() > j &&
|
|
|
|
layer.mask_tiles[j].size() > i )
|
|
|
|
layer.mask_tiles[j].size() > i )
|
|
|
|
src_a = INT_MULT( src_a, layer.mask_tiles[j][i].pixelIndex( k, l ) );
|
|
|
|
src_a = INT_MULT( src_a, layer.mask_tiles[j][i].pixelIndex( k, l ) );
|
|
|
|
|
|
|
|
|
|
|
@ -2019,9 +2019,9 @@ void XCFImageFormat::mergeRGBToRGB ( Layer& layer, uint i, uint j, int k, int l,
|
|
|
|
|
|
|
|
|
|
|
|
src_a = INT_MULT( src_a, layer.opacity );
|
|
|
|
src_a = INT_MULT( src_a, layer.opacity );
|
|
|
|
|
|
|
|
|
|
|
|
// Apply the tqmask (if any)
|
|
|
|
// Apply the mask (if any)
|
|
|
|
|
|
|
|
|
|
|
|
if ( layer.apply_tqmask == 1 && layer.mask_tiles.size() > j &&
|
|
|
|
if ( layer.apply_mask == 1 && layer.mask_tiles.size() > j &&
|
|
|
|
layer.mask_tiles[j].size() > i )
|
|
|
|
layer.mask_tiles[j].size() > i )
|
|
|
|
src_a = INT_MULT( src_a, layer.mask_tiles[j][i].pixelIndex( k, l ) );
|
|
|
|
src_a = INT_MULT( src_a, layer.mask_tiles[j][i].pixelIndex( k, l ) );
|
|
|
|
|
|
|
|
|
|
|
@ -2121,9 +2121,9 @@ void XCFImageFormat::mergeGrayAToGray ( Layer& layer, uint i, uint j, int k, int
|
|
|
|
|
|
|
|
|
|
|
|
src_a = INT_MULT( src_a, layer.opacity );
|
|
|
|
src_a = INT_MULT( src_a, layer.opacity );
|
|
|
|
|
|
|
|
|
|
|
|
// Apply the tqmask (if any)
|
|
|
|
// Apply the mask (if any)
|
|
|
|
|
|
|
|
|
|
|
|
if ( layer.apply_tqmask == 1 && layer.mask_tiles.size() > j &&
|
|
|
|
if ( layer.apply_mask == 1 && layer.mask_tiles.size() > j &&
|
|
|
|
layer.mask_tiles[j].size() > i )
|
|
|
|
layer.mask_tiles[j].size() > i )
|
|
|
|
src_a = INT_MULT( src_a, layer.mask_tiles[j][i].pixelIndex( k, l ) );
|
|
|
|
src_a = INT_MULT( src_a, layer.mask_tiles[j][i].pixelIndex( k, l ) );
|
|
|
|
|
|
|
|
|
|
|
@ -2232,9 +2232,9 @@ void XCFImageFormat::mergeGrayAToRGB ( Layer& layer, uint i, uint j, int k, int
|
|
|
|
|
|
|
|
|
|
|
|
src_a = INT_MULT( src_a, layer.opacity );
|
|
|
|
src_a = INT_MULT( src_a, layer.opacity );
|
|
|
|
|
|
|
|
|
|
|
|
// Apply the tqmask (if any)
|
|
|
|
// Apply the mask (if any)
|
|
|
|
|
|
|
|
|
|
|
|
if ( layer.apply_tqmask == 1 && layer.mask_tiles.size() > j &&
|
|
|
|
if ( layer.apply_mask == 1 && layer.mask_tiles.size() > j &&
|
|
|
|
layer.mask_tiles[j].size() > i )
|
|
|
|
layer.mask_tiles[j].size() > i )
|
|
|
|
src_a = INT_MULT( src_a, layer.mask_tiles[j][i].pixelIndex( k, l ) );
|
|
|
|
src_a = INT_MULT( src_a, layer.mask_tiles[j][i].pixelIndex( k, l ) );
|
|
|
|
|
|
|
|
|
|
|
@ -2290,7 +2290,7 @@ void XCFImageFormat::mergeIndexedAToIndexed ( Layer& layer,uint i,uint j,int k,i
|
|
|
|
|
|
|
|
|
|
|
|
src_a = INT_MULT( src_a, layer.opacity );
|
|
|
|
src_a = INT_MULT( src_a, layer.opacity );
|
|
|
|
|
|
|
|
|
|
|
|
if ( layer.apply_tqmask == 1 &&
|
|
|
|
if ( layer.apply_mask == 1 &&
|
|
|
|
layer.mask_tiles.size() > j &&
|
|
|
|
layer.mask_tiles.size() > j &&
|
|
|
|
layer.mask_tiles[j].size() > i )
|
|
|
|
layer.mask_tiles[j].size() > i )
|
|
|
|
src_a = INT_MULT( src_a,
|
|
|
|
src_a = INT_MULT( src_a,
|
|
|
@ -2324,9 +2324,9 @@ void XCFImageFormat::mergeIndexedAToRGB ( Layer& layer, uint i, uint j, int k, i
|
|
|
|
|
|
|
|
|
|
|
|
src_a = INT_MULT( src_a, layer.opacity );
|
|
|
|
src_a = INT_MULT( src_a, layer.opacity );
|
|
|
|
|
|
|
|
|
|
|
|
// Apply the tqmask (if any)
|
|
|
|
// Apply the mask (if any)
|
|
|
|
|
|
|
|
|
|
|
|
if ( layer.apply_tqmask == 1 && layer.mask_tiles.size() > j &&
|
|
|
|
if ( layer.apply_mask == 1 && layer.mask_tiles.size() > j &&
|
|
|
|
layer.mask_tiles[j].size() > i )
|
|
|
|
layer.mask_tiles[j].size() > i )
|
|
|
|
src_a = INT_MULT( src_a, layer.mask_tiles[j][i].pixelIndex( k, l ) );
|
|
|
|
src_a = INT_MULT( src_a, layer.mask_tiles[j][i].pixelIndex( k, l ) );
|
|
|
|
|
|
|
|
|
|
|
|