mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-25 03:12:56 +00:00
dither_to_Mono() now requires 32-bit source image
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
0dc381dea6
commit
80652bfdb1
1 changed files with 9 additions and 3 deletions
|
@ -1776,6 +1776,7 @@ static void dither_to_Mono(QImageData *dst, const QImageData *src,
|
|||
{
|
||||
Q_ASSERT(src->width == dst->width);
|
||||
Q_ASSERT(src->height == dst->height);
|
||||
Q_ASSERT(src->depth == 32);
|
||||
Q_ASSERT(dst->format == QImage::Format_Mono || dst->format == QImage::Format_MonoLSB);
|
||||
|
||||
dst->mono0 = QRgb(0xffffffff);
|
||||
|
@ -2693,12 +2694,17 @@ QImage QImage::transformed(const QMatrix &matrix, Qt::TransformationMode mode) c
|
|||
*/
|
||||
QImage QImage::createAlphaMask(Qt::ImageConversionFlags flags) const
|
||||
{
|
||||
if (!d || d->format == QImage::Format_RGB32)
|
||||
if (!d || d->format == QImage::Format_RGB32 || d->format == QImage::Format_RGB16)
|
||||
return QImage();
|
||||
|
||||
QImage source(*this);
|
||||
if (d->depth != 32) {
|
||||
source = source.convertToFormat(QImage::Format_ARGB32);
|
||||
}
|
||||
|
||||
QImage mask(d->width, d->height, Format_MonoLSB);
|
||||
if (!mask.isNull()) {
|
||||
dither_to_Mono(mask.d, d, flags, true);
|
||||
dither_to_Mono(mask.d, source.d, flags, true);
|
||||
}
|
||||
return mask;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue