1 /****************************************************************************
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/
6 ** This file is part of the QtGui module of the Qt Toolkit.
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** GNU Lesser General Public License Usage
10 ** This file may be used under the terms of the GNU Lesser General Public
11 ** License version 2.1 as published by the Free Software Foundation and
12 ** appearing in the file LICENSE.LGPL included in the packaging of this
13 ** file. Please review the following information to ensure the GNU Lesser
14 ** General Public License version 2.1 requirements will be met:
15 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17 ** In addition, as a special exception, Nokia gives you certain additional
18 ** rights. These rights are described in the Nokia Qt LGPL Exception
19 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
21 ** GNU General Public License Usage
22 ** Alternatively, this file may be used under the terms of the GNU General
23 ** Public License version 3.0 as published by the Free Software Foundation
24 ** and appearing in the file LICENSE.GPL included in the packaging of this
25 ** file. Please review the following information to ensure the GNU General
26 ** Public License version 3.0 requirements will be met:
27 ** http://www.gnu.org/copyleft/gpl.html.
30 ** Alternatively, this file may be used in accordance with the terms and
31 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
43 #include "qblendfunctions_p.h"
47 struct SourceOnlyAlpha
49 inline uchar alpha(uchar src) const { return src; }
50 inline quint16 bytemul(quint16 spix) const { return spix; }
54 struct SourceAndConstAlpha
56 SourceAndConstAlpha(int a) : m_alpha256(a) {
57 m_alpha255 = (m_alpha256 * 255) >> 8;
59 inline uchar alpha(uchar src) const { return (src * m_alpha256) >> 8; }
60 inline quint16 bytemul(quint16 x) const {
61 uint t = (((x & 0x07e0)*m_alpha255) >> 8) & 0x07e0;
62 t |= (((x & 0xf81f)*(m_alpha255>>2)) >> 6) & 0xf81f;
70 /************************************************************************
71 RGB16 (565) format target format
72 ************************************************************************/
74 struct Blend_RGB16_on_RGB16_NoAlpha {
75 inline void write(quint16 *dst, quint16 src) { *dst = src; }
77 inline void flush(void *) {}
80 struct Blend_RGB16_on_RGB16_ConstAlpha {
81 inline Blend_RGB16_on_RGB16_ConstAlpha(quint32 alpha) {
82 m_alpha = (alpha * 255) >> 8;
83 m_ialpha = 255 - m_alpha;
86 inline void write(quint16 *dst, quint16 src) {
87 *dst = BYTE_MUL_RGB16(src, m_alpha) + BYTE_MUL_RGB16(*dst, m_ialpha);
90 inline void flush(void *) {}
96 struct Blend_ARGB32_on_RGB16_SourceAlpha {
97 inline void write(quint16 *dst, quint32 src) {
98 const quint8 alpha = qAlpha(src);
100 quint16 s = qConvertRgb32To16(src);
102 s += BYTE_MUL_RGB16(*dst, 255 - alpha);
107 inline void flush(void *) {}
110 struct Blend_ARGB32_on_RGB16_SourceAndConstAlpha {
111 inline Blend_ARGB32_on_RGB16_SourceAndConstAlpha(quint32 alpha) {
112 m_alpha = (alpha * 255) >> 8;
115 inline void write(quint16 *dst, quint32 src) {
116 src = BYTE_MUL(src, m_alpha);
117 const quint8 alpha = qAlpha(src);
119 quint16 s = qConvertRgb32To16(src);
121 s += BYTE_MUL_RGB16(*dst, 255 - alpha);
126 inline void flush(void *) {}
131 void qt_scale_image_rgb16_on_rgb16(uchar *destPixels, int dbpl,
132 const uchar *srcPixels, int sbpl,
133 const QRectF &targetRect,
134 const QRectF &sourceRect,
139 printf("qt_scale_rgb16_on_rgb16: dst=(%p, %d), src=(%p, %d), target=(%d, %d), [%d x %d], src=(%d, %d) [%d x %d] alpha=%d\n",
140 destPixels, dbpl, srcPixels, sbpl,
141 targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(),
142 sourceRect.x(), sourceRect.y(), sourceRect.width(), sourceRect.height(),
145 if (const_alpha == 256) {
146 Blend_RGB16_on_RGB16_NoAlpha noAlpha;
147 qt_scale_image_16bit<quint16>(destPixels, dbpl, srcPixels, sbpl,
148 targetRect, sourceRect, clip, noAlpha);
150 Blend_RGB16_on_RGB16_ConstAlpha constAlpha(const_alpha);
151 qt_scale_image_16bit<quint16>(destPixels, dbpl, srcPixels, sbpl,
152 targetRect, sourceRect, clip, constAlpha);
156 void qt_scale_image_argb32_on_rgb16(uchar *destPixels, int dbpl,
157 const uchar *srcPixels, int sbpl,
158 const QRectF &targetRect,
159 const QRectF &sourceRect,
164 printf("qt_scale_argb32_on_rgb16: dst=(%p, %d), src=(%p, %d), target=(%d, %d), [%d x %d], src=(%d, %d) [%d x %d] alpha=%d\n",
165 destPixels, dbpl, srcPixels, sbpl,
166 targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(),
167 sourceRect.x(), sourceRect.y(), sourceRect.width(), sourceRect.height(),
170 if (const_alpha == 256) {
171 Blend_ARGB32_on_RGB16_SourceAlpha noAlpha;
172 qt_scale_image_16bit<quint32>(destPixels, dbpl, srcPixels, sbpl,
173 targetRect, sourceRect, clip, noAlpha);
175 Blend_ARGB32_on_RGB16_SourceAndConstAlpha constAlpha(const_alpha);
176 qt_scale_image_16bit<quint32>(destPixels, dbpl, srcPixels, sbpl,
177 targetRect, sourceRect, clip, constAlpha);
181 void qt_blend_rgb16_on_rgb16(uchar *dst, int dbpl,
182 const uchar *src, int sbpl,
187 printf("qt_blend_rgb16_on_rgb16: dst=(%p, %d), src=(%p, %d), dim=(%d, %d) alpha=%d\n",
188 dst, dbpl, src, sbpl, w, h, const_alpha);
191 if (const_alpha == 256) {
194 QT_MEMCPY_USHORT(dst, src, w);
201 memcpy(dst, src, length);
206 } else if (const_alpha != 0) {
207 quint16 *d = (quint16 *) dst;
208 const quint16 *s = (const quint16 *) src;
209 quint8 a = (255 * const_alpha) >> 8;
212 for (int x=0; x<w; ++x) {
213 d[x] = BYTE_MUL_RGB16(s[x], a) + BYTE_MUL_RGB16(d[x], ia);
215 d = (quint16 *)(((uchar *) d) + dbpl);
216 s = (const quint16 *)(((const uchar *) s) + sbpl);
222 void qt_blend_argb32_on_rgb16_const_alpha(uchar *destPixels, int dbpl,
223 const uchar *srcPixels, int sbpl,
227 quint16 *dst = (quint16 *) destPixels;
228 const quint32 *src = (const quint32 *) srcPixels;
230 const_alpha = (const_alpha * 255) >> 8;
231 for (int y=0; y<h; ++y) {
232 for (int i = 0; i < w; ++i) {
234 s = BYTE_MUL(s, const_alpha);
235 int alpha = qAlpha(s);
236 s = qConvertRgb32To16(s);
237 s += BYTE_MUL_RGB16(dst[i], 255 - alpha);
240 dst = (quint16 *)(((uchar *) dst) + dbpl);
241 src = (const quint32 *)(((const uchar *) src) + sbpl);
245 static void qt_blend_argb32_on_rgb16(uchar *destPixels, int dbpl,
246 const uchar *srcPixels, int sbpl,
250 if (const_alpha != 256) {
251 qt_blend_argb32_on_rgb16_const_alpha(destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);
255 quint16 *dst = (quint16 *) destPixels;
256 quint32 *src = (quint32 *) srcPixels;
258 for (int y=0; y<h; ++y) {
259 for (int x=0; x<w; ++x) {
261 quint32 spix = src[x];
262 quint32 alpha = spix >> 24;
265 dst[x] = qConvertRgb32To16(spix);
266 } else if (alpha != 0) {
267 quint32 dpix = dst[x];
269 quint32 sia = 255 - alpha;
271 quint32 sr = (spix >> 8) & 0xf800;
272 quint32 sg = (spix >> 5) & 0x07e0;
273 quint32 sb = (spix >> 3) & 0x001f;
275 quint32 dr = (dpix & 0x0000f800);
276 quint32 dg = (dpix & 0x000007e0);
277 quint32 db = (dpix & 0x0000001f);
279 quint32 siar = dr * sia;
280 quint32 siag = dg * sia;
281 quint32 siab = db * sia;
283 quint32 rr = sr + ((siar + (siar>>8) + (0x80 << 8)) >> 8);
284 quint32 rg = sg + ((siag + (siag>>8) + (0x80 << 3)) >> 8);
285 quint32 rb = sb + ((siab + (siab>>8) + (0x80 >> 3)) >> 8);
287 dst[x] = (rr & 0xf800)
292 dst = (quint16 *) (((uchar *) dst) + dbpl);
293 src = (quint32 *) (((uchar *) src) + sbpl);
298 static void qt_blend_rgb32_on_rgb16(uchar *destPixels, int dbpl,
299 const uchar *srcPixels, int sbpl,
304 printf("qt_blend_rgb32_on_rgb16: dst=(%p, %d), src=(%p, %d), dim=(%d, %d) alpha=%d\n",
305 destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);
308 if (const_alpha != 256) {
309 qt_blend_argb32_on_rgb16(destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);
313 const quint32 *src = (const quint32 *) srcPixels;
314 int srcExtraStride = (sbpl >> 2) - w;
316 int dstJPL = dbpl / 2;
318 quint16 *dst = (quint16 *) destPixels;
319 quint16 *dstEnd = dst + dstJPL * h;
321 int dstExtraStride = dstJPL - w;
323 while (dst < dstEnd) {
324 const quint32 *srcEnd = src + w;
325 while (src < srcEnd) {
326 *dst = qConvertRgb32To16(*src);
330 dst += dstExtraStride;
331 src += srcExtraStride;
337 /************************************************************************
338 RGB32 (-888) format target format
339 ************************************************************************/
341 static void qt_blend_argb32_on_argb32(uchar *destPixels, int dbpl,
342 const uchar *srcPixels, int sbpl,
347 fprintf(stdout, "qt_blend_argb32_on_argb32: dst=(%p, %d), src=(%p, %d), dim=(%d, %d) alpha=%d\n",
348 destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);
352 const uint *src = (const uint *) srcPixels;
353 uint *dst = (uint *) destPixels;
354 if (const_alpha == 256) {
355 for (int y=0; y<h; ++y) {
356 for (int x=0; x<w; ++x) {
361 dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s));
363 dst = (quint32 *)(((uchar *) dst) + dbpl);
364 src = (const quint32 *)(((const uchar *) src) + sbpl);
366 } else if (const_alpha != 0) {
367 const_alpha = (const_alpha * 255) >> 8;
368 for (int y=0; y<h; ++y) {
369 for (int x=0; x<w; ++x) {
370 uint s = BYTE_MUL(src[x], const_alpha);
371 dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s));
373 dst = (quint32 *)(((uchar *) dst) + dbpl);
374 src = (const quint32 *)(((const uchar *) src) + sbpl);
380 void qt_blend_rgb32_on_rgb32(uchar *destPixels, int dbpl,
381 const uchar *srcPixels, int sbpl,
386 fprintf(stdout, "qt_blend_rgb32_on_rgb32: dst=(%p, %d), src=(%p, %d), dim=(%d, %d) alpha=%d\n",
387 destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);
391 if (const_alpha != 256) {
392 qt_blend_argb32_on_argb32(destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);
396 const uint *src = (const uint *) srcPixels;
397 uint *dst = (uint *) destPixels;
399 for (int y=0; y<h; ++y) {
400 memcpy(dst, src, len);
401 dst = (quint32 *)(((uchar *) dst) + dbpl);
402 src = (const quint32 *)(((const uchar *) src) + sbpl);
408 struct Blend_RGB32_on_RGB32_NoAlpha {
409 inline void write(quint32 *dst, quint32 src) { *dst = src; }
411 inline void flush(void *) {}
414 struct Blend_RGB32_on_RGB32_ConstAlpha {
415 inline Blend_RGB32_on_RGB32_ConstAlpha(quint32 alpha) {
416 m_alpha = (alpha * 255) >> 8;
417 m_ialpha = 255 - m_alpha;
420 inline void write(quint32 *dst, quint32 src) {
421 *dst = BYTE_MUL(src, m_alpha) + BYTE_MUL(*dst, m_ialpha);
424 inline void flush(void *) {}
430 struct Blend_ARGB32_on_ARGB32_SourceAlpha {
431 inline void write(quint32 *dst, quint32 src) {
432 *dst = src + BYTE_MUL(*dst, qAlpha(~src));
435 inline void flush(void *) {}
438 struct Blend_ARGB32_on_ARGB32_SourceAndConstAlpha {
439 inline Blend_ARGB32_on_ARGB32_SourceAndConstAlpha(quint32 alpha) {
440 m_alpha = (alpha * 255) >> 8;
441 m_ialpha = 255 - m_alpha;
444 inline void write(quint32 *dst, quint32 src) {
445 src = BYTE_MUL(src, m_alpha);
446 *dst = src + BYTE_MUL(*dst, qAlpha(~src));
449 inline void flush(void *) {}
455 void qt_scale_image_rgb32_on_rgb32(uchar *destPixels, int dbpl,
456 const uchar *srcPixels, int sbpl,
457 const QRectF &targetRect,
458 const QRectF &sourceRect,
463 printf("qt_scale_rgb32_on_rgb32: dst=(%p, %d), src=(%p, %d), target=(%d, %d), [%d x %d], src=(%d, %d) [%d x %d] alpha=%d\n",
464 destPixels, dbpl, srcPixels, sbpl,
465 targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(),
466 sourceRect.x(), sourceRect.y(), sourceRect.width(), sourceRect.height(),
469 if (const_alpha == 256) {
470 Blend_RGB32_on_RGB32_NoAlpha noAlpha;
471 qt_scale_image_32bit(destPixels, dbpl, srcPixels, sbpl,
472 targetRect, sourceRect, clip, noAlpha);
474 Blend_RGB32_on_RGB32_ConstAlpha constAlpha(const_alpha);
475 qt_scale_image_32bit(destPixels, dbpl, srcPixels, sbpl,
476 targetRect, sourceRect, clip, constAlpha);
480 void qt_scale_image_argb32_on_argb32(uchar *destPixels, int dbpl,
481 const uchar *srcPixels, int sbpl,
482 const QRectF &targetRect,
483 const QRectF &sourceRect,
488 printf("qt_scale_argb32_on_argb32: dst=(%p, %d), src=(%p, %d), target=(%d, %d), [%d x %d], src=(%d, %d) [%d x %d] alpha=%d\n",
489 destPixels, dbpl, srcPixels, sbpl,
490 targetRect.x(), targetRect.y(), targetRect.width(), targetRect.height(),
491 sourceRect.x(), sourceRect.y(), sourceRect.width(), sourceRect.height(),
494 if (const_alpha == 256) {
495 Blend_ARGB32_on_ARGB32_SourceAlpha sourceAlpha;
496 qt_scale_image_32bit(destPixels, dbpl, srcPixels, sbpl,
497 targetRect, sourceRect, clip, sourceAlpha);
499 Blend_ARGB32_on_ARGB32_SourceAndConstAlpha constAlpha(const_alpha);
500 qt_scale_image_32bit(destPixels, dbpl, srcPixels, sbpl,
501 targetRect, sourceRect, clip, constAlpha);
505 void qt_transform_image_rgb16_on_rgb16(uchar *destPixels, int dbpl,
506 const uchar *srcPixels, int sbpl,
507 const QRectF &targetRect,
508 const QRectF &sourceRect,
510 const QTransform &targetRectTransform,
513 if (const_alpha == 256) {
514 Blend_RGB16_on_RGB16_NoAlpha noAlpha;
515 qt_transform_image(reinterpret_cast<quint16 *>(destPixels), dbpl,
516 reinterpret_cast<const quint16 *>(srcPixels), sbpl,
517 targetRect, sourceRect, clip, targetRectTransform, noAlpha);
519 Blend_RGB16_on_RGB16_ConstAlpha constAlpha(const_alpha);
520 qt_transform_image(reinterpret_cast<quint16 *>(destPixels), dbpl,
521 reinterpret_cast<const quint16 *>(srcPixels), sbpl,
522 targetRect, sourceRect, clip, targetRectTransform, constAlpha);
526 void qt_transform_image_argb32_on_rgb16(uchar *destPixels, int dbpl,
527 const uchar *srcPixels, int sbpl,
528 const QRectF &targetRect,
529 const QRectF &sourceRect,
531 const QTransform &targetRectTransform,
534 if (const_alpha == 256) {
535 Blend_ARGB32_on_RGB16_SourceAlpha noAlpha;
536 qt_transform_image(reinterpret_cast<quint16 *>(destPixels), dbpl,
537 reinterpret_cast<const quint32 *>(srcPixels), sbpl,
538 targetRect, sourceRect, clip, targetRectTransform, noAlpha);
540 Blend_ARGB32_on_RGB16_SourceAndConstAlpha constAlpha(const_alpha);
541 qt_transform_image(reinterpret_cast<quint16 *>(destPixels), dbpl,
542 reinterpret_cast<const quint32 *>(srcPixels), sbpl,
543 targetRect, sourceRect, clip, targetRectTransform, constAlpha);
548 void qt_transform_image_rgb32_on_rgb32(uchar *destPixels, int dbpl,
549 const uchar *srcPixels, int sbpl,
550 const QRectF &targetRect,
551 const QRectF &sourceRect,
553 const QTransform &targetRectTransform,
556 if (const_alpha == 256) {
557 Blend_RGB32_on_RGB32_NoAlpha noAlpha;
558 qt_transform_image(reinterpret_cast<quint32 *>(destPixels), dbpl,
559 reinterpret_cast<const quint32 *>(srcPixels), sbpl,
560 targetRect, sourceRect, clip, targetRectTransform, noAlpha);
562 Blend_RGB32_on_RGB32_ConstAlpha constAlpha(const_alpha);
563 qt_transform_image(reinterpret_cast<quint32 *>(destPixels), dbpl,
564 reinterpret_cast<const quint32 *>(srcPixels), sbpl,
565 targetRect, sourceRect, clip, targetRectTransform, constAlpha);
569 void qt_transform_image_argb32_on_argb32(uchar *destPixels, int dbpl,
570 const uchar *srcPixels, int sbpl,
571 const QRectF &targetRect,
572 const QRectF &sourceRect,
574 const QTransform &targetRectTransform,
577 if (const_alpha == 256) {
578 Blend_ARGB32_on_ARGB32_SourceAlpha sourceAlpha;
579 qt_transform_image(reinterpret_cast<quint32 *>(destPixels), dbpl,
580 reinterpret_cast<const quint32 *>(srcPixels), sbpl,
581 targetRect, sourceRect, clip, targetRectTransform, sourceAlpha);
583 Blend_ARGB32_on_ARGB32_SourceAndConstAlpha constAlpha(const_alpha);
584 qt_transform_image(reinterpret_cast<quint32 *>(destPixels), dbpl,
585 reinterpret_cast<const quint32 *>(srcPixels), sbpl,
586 targetRect, sourceRect, clip, targetRectTransform, constAlpha);
590 SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = {
592 0, // Format_Invalid,
594 0, // Format_MonoLSB,
595 0, // Format_Indexed8,
598 0, // Format_ARGB32_Premultiplied,
600 0, // Format_ARGB8565_Premultiplied,
602 0, // Format_ARGB6666_Premultiplied,
604 0, // Format_ARGB8555_Premultiplied,
607 0 // Format_ARGB4444_Premultiplied,
610 0, // Format_Invalid,
612 0, // Format_MonoLSB,
613 0, // Format_Indexed8,
616 0, // Format_ARGB32_Premultiplied,
618 0, // Format_ARGB8565_Premultiplied,
620 0, // Format_ARGB6666_Premultiplied,
622 0, // Format_ARGB8555_Premultiplied,
625 0 // Format_ARGB4444_Premultiplied,
628 0, // Format_Invalid,
630 0, // Format_MonoLSB,
631 0, // Format_Indexed8,
634 0, // Format_ARGB32_Premultiplied,
636 0, // Format_ARGB8565_Premultiplied,
638 0, // Format_ARGB6666_Premultiplied,
640 0, // Format_ARGB8555_Premultiplied,
643 0 // Format_ARGB4444_Premultiplied,
646 0, // Format_Invalid,
648 0, // Format_MonoLSB,
649 0, // Format_Indexed8,
652 0, // Format_ARGB32_Premultiplied,
654 0, // Format_ARGB8565_Premultiplied,
656 0, // Format_ARGB6666_Premultiplied,
658 0, // Format_ARGB8555_Premultiplied,
661 0 // Format_ARGB4444_Premultiplied,
664 0, // Format_Invalid,
666 0, // Format_MonoLSB,
667 0, // Format_Indexed8,
668 qt_scale_image_rgb32_on_rgb32, // Format_RGB32,
670 qt_scale_image_argb32_on_argb32, // Format_ARGB32_Premultiplied,
672 0, // Format_ARGB8565_Premultiplied,
674 0, // Format_ARGB6666_Premultiplied,
676 0, // Format_ARGB8555_Premultiplied,
679 0 // Format_ARGB4444_Premultiplied,
682 0, // Format_Invalid,
684 0, // Format_MonoLSB,
685 0, // Format_Indexed8,
688 0, // Format_ARGB32_Premultiplied,
690 0, // Format_ARGB8565_Premultiplied,
692 0, // Format_ARGB6666_Premultiplied,
694 0, // Format_ARGB8555_Premultiplied,
697 0 // Format_ARGB4444_Premultiplied,
699 { // Format_ARGB32_Premultiplied
700 0, // Format_Invalid,
702 0, // Format_MonoLSB,
703 0, // Format_Indexed8,
704 qt_scale_image_rgb32_on_rgb32, // Format_RGB32,
706 qt_scale_image_argb32_on_argb32, // Format_ARGB32_Premultiplied,
708 0, // Format_ARGB8565_Premultiplied,
710 0, // Format_ARGB6666_Premultiplied,
712 0, // Format_ARGB8555_Premultiplied,
715 0 // Format_ARGB4444_Premultiplied,
718 0, // Format_Invalid,
720 0, // Format_MonoLSB,
721 0, // Format_Indexed8,
724 qt_scale_image_argb32_on_rgb16, // Format_ARGB32_Premultiplied,
725 qt_scale_image_rgb16_on_rgb16, // Format_RGB16,
726 0, // Format_ARGB8565_Premultiplied,
728 0, // Format_ARGB6666_Premultiplied,
730 0, // Format_ARGB8555_Premultiplied,
733 0 // Format_ARGB4444_Premultiplied,
735 { // Format_ARGB8565_Premultiplied
736 0, // Format_Invalid,
738 0, // Format_MonoLSB,
739 0, // Format_Indexed8,
742 0, // Format_ARGB32_Premultiplied,
744 0, // Format_ARGB8565_Premultiplied,
746 0, // Format_ARGB6666_Premultiplied,
748 0, // Format_ARGB8555_Premultiplied,
751 0 // Format_ARGB4444_Premultiplied,
754 0, // Format_Invalid,
756 0, // Format_MonoLSB,
757 0, // Format_Indexed8,
760 0, // Format_ARGB32_Premultiplied,
762 0, // Format_ARGB8565_Premultiplied,
764 0, // Format_ARGB6666_Premultiplied,
766 0, // Format_ARGB8555_Premultiplied,
769 0 // Format_ARGB4444_Premultiplied,
771 { // Format_ARGB6666_Premultiplied
772 0, // Format_Invalid,
774 0, // Format_MonoLSB,
775 0, // Format_Indexed8,
778 0, // Format_ARGB32_Premultiplied,
780 0, // Format_ARGB8565_Premultiplied,
782 0, // Format_ARGB6666_Premultiplied,
784 0, // Format_ARGB8555_Premultiplied,
787 0 // Format_ARGB4444_Premultiplied,
790 0, // Format_Invalid,
792 0, // Format_MonoLSB,
793 0, // Format_Indexed8,
796 0, // Format_ARGB32_Premultiplied,
798 0, // Format_ARGB8565_Premultiplied,
800 0, // Format_ARGB6666_Premultiplied,
802 0, // Format_ARGB8555_Premultiplied,
805 0 // Format_ARGB4444_Premultiplied,
807 { // Format_ARGB8555_Premultiplied
808 0, // Format_Invalid,
810 0, // Format_MonoLSB,
811 0, // Format_Indexed8,
814 0, // Format_ARGB32_Premultiplied,
816 0, // Format_ARGB8565_Premultiplied,
818 0, // Format_ARGB6666_Premultiplied,
820 0, // Format_ARGB8555_Premultiplied,
823 0 // Format_ARGB4444_Premultiplied,
826 0, // Format_Invalid,
828 0, // Format_MonoLSB,
829 0, // Format_Indexed8,
832 0, // Format_ARGB32_Premultiplied,
834 0, // Format_ARGB8565_Premultiplied,
836 0, // Format_ARGB6666_Premultiplied,
838 0, // Format_ARGB8555_Premultiplied,
841 0 // Format_ARGB4444_Premultiplied,
844 0, // Format_Invalid,
846 0, // Format_MonoLSB,
847 0, // Format_Indexed8,
850 0, // Format_ARGB32_Premultiplied,
852 0, // Format_ARGB8565_Premultiplied,
854 0, // Format_ARGB6666_Premultiplied,
856 0, // Format_ARGB8555_Premultiplied,
859 0 // Format_ARGB4444_Premultiplied,
861 { // Format_ARGB4444_Premultiplied
862 0, // Format_Invalid,
864 0, // Format_MonoLSB,
865 0, // Format_Indexed8,
868 0, // Format_ARGB32_Premultiplied,
870 0, // Format_ARGB8565_Premultiplied,
872 0, // Format_ARGB6666_Premultiplied,
874 0, // Format_ARGB8555_Premultiplied,
877 0 // Format_ARGB4444_Premultiplied,
882 SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = {
884 0, // Format_Invalid,
886 0, // Format_MonoLSB,
887 0, // Format_Indexed8,
890 0, // Format_ARGB32_Premultiplied,
892 0, // Format_ARGB8565_Premultiplied,
894 0, // Format_ARGB6666_Premultiplied,
896 0, // Format_ARGB8555_Premultiplied,
899 0 // Format_ARGB4444_Premultiplied,
902 0, // Format_Invalid,
904 0, // Format_MonoLSB,
905 0, // Format_Indexed8,
908 0, // Format_ARGB32_Premultiplied,
910 0, // Format_ARGB8565_Premultiplied,
912 0, // Format_ARGB6666_Premultiplied,
914 0, // Format_ARGB8555_Premultiplied,
917 0 // Format_ARGB4444_Premultiplied,
920 0, // Format_Invalid,
922 0, // Format_MonoLSB,
923 0, // Format_Indexed8,
926 0, // Format_ARGB32_Premultiplied,
928 0, // Format_ARGB8565_Premultiplied,
930 0, // Format_ARGB6666_Premultiplied,
932 0, // Format_ARGB8555_Premultiplied,
935 0 // Format_ARGB4444_Premultiplied,
938 0, // Format_Invalid,
940 0, // Format_MonoLSB,
941 0, // Format_Indexed8,
944 0, // Format_ARGB32_Premultiplied,
946 0, // Format_ARGB8565_Premultiplied,
948 0, // Format_ARGB6666_Premultiplied,
950 0, // Format_ARGB8555_Premultiplied,
953 0 // Format_ARGB4444_Premultiplied,
956 0, // Format_Invalid,
958 0, // Format_MonoLSB,
959 0, // Format_Indexed8,
960 qt_blend_rgb32_on_rgb32, // Format_RGB32,
962 qt_blend_argb32_on_argb32, // Format_ARGB32_Premultiplied,
964 0, // Format_ARGB8565_Premultiplied,
966 0, // Format_ARGB6666_Premultiplied,
968 0, // Format_ARGB8555_Premultiplied,
971 0 // Format_ARGB4444_Premultiplied,
974 0, // Format_Invalid,
976 0, // Format_MonoLSB,
977 0, // Format_Indexed8,
980 0, // Format_ARGB32_Premultiplied,
982 0, // Format_ARGB8565_Premultiplied,
984 0, // Format_ARGB6666_Premultiplied,
986 0, // Format_ARGB8555_Premultiplied,
989 0 // Format_ARGB4444_Premultiplied,
991 { // Format_ARGB32_Premultiplied
992 0, // Format_Invalid,
994 0, // Format_MonoLSB,
995 0, // Format_Indexed8,
996 qt_blend_rgb32_on_rgb32, // Format_RGB32,
998 qt_blend_argb32_on_argb32, // Format_ARGB32_Premultiplied,
1000 0, // Format_ARGB8565_Premultiplied,
1001 0, // Format_RGB666,
1002 0, // Format_ARGB6666_Premultiplied,
1003 0, // Format_RGB555,
1004 0, // Format_ARGB8555_Premultiplied,
1005 0, // Format_RGB888,
1006 0, // Format_RGB444,
1007 0 // Format_ARGB4444_Premultiplied,
1010 0, // Format_Invalid,
1012 0, // Format_MonoLSB,
1013 0, // Format_Indexed8,
1014 qt_blend_rgb32_on_rgb16, // Format_RGB32,
1015 0, // Format_ARGB32,
1016 qt_blend_argb32_on_rgb16, // Format_ARGB32_Premultiplied,
1017 qt_blend_rgb16_on_rgb16, // Format_RGB16,
1018 0, // Format_ARGB8565_Premultiplied,
1019 0, // Format_RGB666,
1020 0, // Format_ARGB6666_Premultiplied,
1021 0, // Format_RGB555,
1022 0, // Format_ARGB8555_Premultiplied,
1023 0, // Format_RGB888,
1024 0, // Format_RGB444,
1025 0 // Format_ARGB4444_Premultiplied,
1027 { // Format_ARGB8565_Premultiplied
1028 0, // Format_Invalid,
1030 0, // Format_MonoLSB,
1031 0, // Format_Indexed8,
1033 0, // Format_ARGB32,
1034 0, // Format_ARGB32_Premultiplied,
1036 0, // Format_ARGB8565_Premultiplied,
1037 0, // Format_RGB666,
1038 0, // Format_ARGB6666_Premultiplied,
1039 0, // Format_RGB555,
1040 0, // Format_ARGB8555_Premultiplied,
1041 0, // Format_RGB888,
1042 0, // Format_RGB444,
1043 0 // Format_ARGB4444_Premultiplied,
1046 0, // Format_Invalid,
1048 0, // Format_MonoLSB,
1049 0, // Format_Indexed8,
1051 0, // Format_ARGB32,
1052 0, // Format_ARGB32_Premultiplied,
1054 0, // Format_ARGB8565_Premultiplied,
1055 0, // Format_RGB666,
1056 0, // Format_ARGB6666_Premultiplied,
1057 0, // Format_RGB555,
1058 0, // Format_ARGB8555_Premultiplied,
1059 0, // Format_RGB888,
1060 0, // Format_RGB444,
1061 0 // Format_ARGB4444_Premultiplied,
1063 { // Format_ARGB6666_Premultiplied
1064 0, // Format_Invalid,
1066 0, // Format_MonoLSB,
1067 0, // Format_Indexed8,
1069 0, // Format_ARGB32,
1070 0, // Format_ARGB32_Premultiplied,
1072 0, // Format_ARGB8565_Premultiplied,
1073 0, // Format_RGB666,
1074 0, // Format_ARGB6666_Premultiplied,
1075 0, // Format_RGB555,
1076 0, // Format_ARGB8555_Premultiplied,
1077 0, // Format_RGB888,
1078 0, // Format_RGB444,
1079 0 // Format_ARGB4444_Premultiplied,
1082 0, // Format_Invalid,
1084 0, // Format_MonoLSB,
1085 0, // Format_Indexed8,
1087 0, // Format_ARGB32,
1088 0, // Format_ARGB32_Premultiplied,
1090 0, // Format_ARGB8565_Premultiplied,
1091 0, // Format_RGB666,
1092 0, // Format_ARGB6666_Premultiplied,
1093 0, // Format_RGB555,
1094 0, // Format_ARGB8555_Premultiplied,
1095 0, // Format_RGB888,
1096 0, // Format_RGB444,
1097 0 // Format_ARGB4444_Premultiplied,
1099 { // Format_ARGB8555_Premultiplied
1100 0, // Format_Invalid,
1102 0, // Format_MonoLSB,
1103 0, // Format_Indexed8,
1105 0, // Format_ARGB32,
1106 0, // Format_ARGB32_Premultiplied,
1108 0, // Format_ARGB8565_Premultiplied,
1109 0, // Format_RGB666,
1110 0, // Format_ARGB6666_Premultiplied,
1111 0, // Format_RGB555,
1112 0, // Format_ARGB8555_Premultiplied,
1113 0, // Format_RGB888,
1114 0, // Format_RGB444,
1115 0 // Format_ARGB4444_Premultiplied,
1118 0, // Format_Invalid,
1120 0, // Format_MonoLSB,
1121 0, // Format_Indexed8,
1123 0, // Format_ARGB32,
1124 0, // Format_ARGB32_Premultiplied,
1126 0, // Format_ARGB8565_Premultiplied,
1127 0, // Format_RGB666,
1128 0, // Format_ARGB6666_Premultiplied,
1129 0, // Format_RGB555,
1130 0, // Format_ARGB8555_Premultiplied,
1131 0, // Format_RGB888,
1132 0, // Format_RGB444,
1133 0 // Format_ARGB4444_Premultiplied,
1136 0, // Format_Invalid,
1138 0, // Format_MonoLSB,
1139 0, // Format_Indexed8,
1141 0, // Format_ARGB32,
1142 0, // Format_ARGB32_Premultiplied,
1144 0, // Format_ARGB8565_Premultiplied,
1145 0, // Format_RGB666,
1146 0, // Format_ARGB6666_Premultiplied,
1147 0, // Format_RGB555,
1148 0, // Format_ARGB8555_Premultiplied,
1149 0, // Format_RGB888,
1150 0, // Format_RGB444,
1151 0 // Format_ARGB4444_Premultiplied,
1153 { // Format_ARGB4444_Premultiplied
1154 0, // Format_Invalid,
1156 0, // Format_MonoLSB,
1157 0, // Format_Indexed8,
1159 0, // Format_ARGB32,
1160 0, // Format_ARGB32_Premultiplied,
1162 0, // Format_ARGB8565_Premultiplied,
1163 0, // Format_RGB666,
1164 0, // Format_ARGB6666_Premultiplied,
1165 0, // Format_RGB555,
1166 0, // Format_ARGB8555_Premultiplied,
1167 0, // Format_RGB888,
1168 0, // Format_RGB444,
1169 0 // Format_ARGB4444_Premultiplied,
1173 SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFormats] = {
1175 0, // Format_Invalid,
1177 0, // Format_MonoLSB,
1178 0, // Format_Indexed8,
1180 0, // Format_ARGB32,
1181 0, // Format_ARGB32_Premultiplied,
1183 0, // Format_ARGB8565_Premultiplied,
1184 0, // Format_RGB666,
1185 0, // Format_ARGB6666_Premultiplied,
1186 0, // Format_RGB555,
1187 0, // Format_ARGB8555_Premultiplied,
1188 0, // Format_RGB888,
1189 0, // Format_RGB444,
1190 0 // Format_ARGB4444_Premultiplied,
1193 0, // Format_Invalid,
1195 0, // Format_MonoLSB,
1196 0, // Format_Indexed8,
1198 0, // Format_ARGB32,
1199 0, // Format_ARGB32_Premultiplied,
1201 0, // Format_ARGB8565_Premultiplied,
1202 0, // Format_RGB666,
1203 0, // Format_ARGB6666_Premultiplied,
1204 0, // Format_RGB555,
1205 0, // Format_ARGB8555_Premultiplied,
1206 0, // Format_RGB888,
1207 0, // Format_RGB444,
1208 0 // Format_ARGB4444_Premultiplied,
1211 0, // Format_Invalid,
1213 0, // Format_MonoLSB,
1214 0, // Format_Indexed8,
1216 0, // Format_ARGB32,
1217 0, // Format_ARGB32_Premultiplied,
1219 0, // Format_ARGB8565_Premultiplied,
1220 0, // Format_RGB666,
1221 0, // Format_ARGB6666_Premultiplied,
1222 0, // Format_RGB555,
1223 0, // Format_ARGB8555_Premultiplied,
1224 0, // Format_RGB888,
1225 0, // Format_RGB444,
1226 0 // Format_ARGB4444_Premultiplied,
1228 { // Format_Indexed8
1229 0, // Format_Invalid,
1231 0, // Format_MonoLSB,
1232 0, // Format_Indexed8,
1234 0, // Format_ARGB32,
1235 0, // Format_ARGB32_Premultiplied,
1237 0, // Format_ARGB8565_Premultiplied,
1238 0, // Format_RGB666,
1239 0, // Format_ARGB6666_Premultiplied,
1240 0, // Format_RGB555,
1241 0, // Format_ARGB8555_Premultiplied,
1242 0, // Format_RGB888,
1243 0, // Format_RGB444,
1244 0 // Format_ARGB4444_Premultiplied,
1247 0, // Format_Invalid,
1249 0, // Format_MonoLSB,
1250 0, // Format_Indexed8,
1251 qt_transform_image_rgb32_on_rgb32, // Format_RGB32,
1252 0, // Format_ARGB32,
1253 qt_transform_image_argb32_on_argb32, // Format_ARGB32_Premultiplied,
1255 0, // Format_ARGB8565_Premultiplied,
1256 0, // Format_RGB666,
1257 0, // Format_ARGB6666_Premultiplied,
1258 0, // Format_RGB555,
1259 0, // Format_ARGB8555_Premultiplied,
1260 0, // Format_RGB888,
1261 0, // Format_RGB444,
1262 0 // Format_ARGB4444_Premultiplied,
1265 0, // Format_Invalid,
1267 0, // Format_MonoLSB,
1268 0, // Format_Indexed8,
1270 0, // Format_ARGB32,
1271 0, // Format_ARGB32_Premultiplied,
1273 0, // Format_ARGB8565_Premultiplied,
1274 0, // Format_RGB666,
1275 0, // Format_ARGB6666_Premultiplied,
1276 0, // Format_RGB555,
1277 0, // Format_ARGB8555_Premultiplied,
1278 0, // Format_RGB888,
1279 0, // Format_RGB444,
1280 0 // Format_ARGB4444_Premultiplied,
1282 { // Format_ARGB32_Premultiplied
1283 0, // Format_Invalid,
1285 0, // Format_MonoLSB,
1286 0, // Format_Indexed8,
1287 qt_transform_image_rgb32_on_rgb32, // Format_RGB32,
1288 0, // Format_ARGB32,
1289 qt_transform_image_argb32_on_argb32, // Format_ARGB32_Premultiplied,
1291 0, // Format_ARGB8565_Premultiplied,
1292 0, // Format_RGB666,
1293 0, // Format_ARGB6666_Premultiplied,
1294 0, // Format_RGB555,
1295 0, // Format_ARGB8555_Premultiplied,
1296 0, // Format_RGB888,
1297 0, // Format_RGB444,
1298 0 // Format_ARGB4444_Premultiplied,
1301 0, // Format_Invalid,
1303 0, // Format_MonoLSB,
1304 0, // Format_Indexed8,
1306 0, // Format_ARGB32,
1307 qt_transform_image_argb32_on_rgb16, // Format_ARGB32_Premultiplied,
1308 qt_transform_image_rgb16_on_rgb16, // Format_RGB16,
1309 0, // Format_ARGB8565_Premultiplied,
1310 0, // Format_RGB666,
1311 0, // Format_ARGB6666_Premultiplied,
1312 0, // Format_RGB555,
1313 0, // Format_ARGB8555_Premultiplied,
1314 0, // Format_RGB888,
1315 0, // Format_RGB444,
1316 0 // Format_ARGB4444_Premultiplied,
1318 { // Format_ARGB8565_Premultiplied
1319 0, // Format_Invalid,
1321 0, // Format_MonoLSB,
1322 0, // Format_Indexed8,
1324 0, // Format_ARGB32,
1325 0, // Format_ARGB32_Premultiplied,
1327 0, // Format_ARGB8565_Premultiplied,
1328 0, // Format_RGB666,
1329 0, // Format_ARGB6666_Premultiplied,
1330 0, // Format_RGB555,
1331 0, // Format_ARGB8555_Premultiplied,
1332 0, // Format_RGB888,
1333 0, // Format_RGB444,
1334 0 // Format_ARGB4444_Premultiplied,
1337 0, // Format_Invalid,
1339 0, // Format_MonoLSB,
1340 0, // Format_Indexed8,
1342 0, // Format_ARGB32,
1343 0, // Format_ARGB32_Premultiplied,
1345 0, // Format_ARGB8565_Premultiplied,
1346 0, // Format_RGB666,
1347 0, // Format_ARGB6666_Premultiplied,
1348 0, // Format_RGB555,
1349 0, // Format_ARGB8555_Premultiplied,
1350 0, // Format_RGB888,
1351 0, // Format_RGB444,
1352 0 // Format_ARGB4444_Premultiplied,
1354 { // Format_ARGB6666_Premultiplied
1355 0, // Format_Invalid,
1357 0, // Format_MonoLSB,
1358 0, // Format_Indexed8,
1360 0, // Format_ARGB32,
1361 0, // Format_ARGB32_Premultiplied,
1363 0, // Format_ARGB8565_Premultiplied,
1364 0, // Format_RGB666,
1365 0, // Format_ARGB6666_Premultiplied,
1366 0, // Format_RGB555,
1367 0, // Format_ARGB8555_Premultiplied,
1368 0, // Format_RGB888,
1369 0, // Format_RGB444,
1370 0 // Format_ARGB4444_Premultiplied,
1373 0, // Format_Invalid,
1375 0, // Format_MonoLSB,
1376 0, // Format_Indexed8,
1378 0, // Format_ARGB32,
1379 0, // Format_ARGB32_Premultiplied,
1381 0, // Format_ARGB8565_Premultiplied,
1382 0, // Format_RGB666,
1383 0, // Format_ARGB6666_Premultiplied,
1384 0, // Format_RGB555,
1385 0, // Format_ARGB8555_Premultiplied,
1386 0, // Format_RGB888,
1387 0, // Format_RGB444,
1388 0 // Format_ARGB4444_Premultiplied,
1390 { // Format_ARGB8555_Premultiplied
1391 0, // Format_Invalid,
1393 0, // Format_MonoLSB,
1394 0, // Format_Indexed8,
1396 0, // Format_ARGB32,
1397 0, // Format_ARGB32_Premultiplied,
1399 0, // Format_ARGB8565_Premultiplied,
1400 0, // Format_RGB666,
1401 0, // Format_ARGB6666_Premultiplied,
1402 0, // Format_RGB555,
1403 0, // Format_ARGB8555_Premultiplied,
1404 0, // Format_RGB888,
1405 0, // Format_RGB444,
1406 0 // Format_ARGB4444_Premultiplied,
1409 0, // Format_Invalid,
1411 0, // Format_MonoLSB,
1412 0, // Format_Indexed8,
1414 0, // Format_ARGB32,
1415 0, // Format_ARGB32_Premultiplied,
1417 0, // Format_ARGB8565_Premultiplied,
1418 0, // Format_RGB666,
1419 0, // Format_ARGB6666_Premultiplied,
1420 0, // Format_RGB555,
1421 0, // Format_ARGB8555_Premultiplied,
1422 0, // Format_RGB888,
1423 0, // Format_RGB444,
1424 0 // Format_ARGB4444_Premultiplied,
1427 0, // Format_Invalid,
1429 0, // Format_MonoLSB,
1430 0, // Format_Indexed8,
1432 0, // Format_ARGB32,
1433 0, // Format_ARGB32_Premultiplied,
1435 0, // Format_ARGB8565_Premultiplied,
1436 0, // Format_RGB666,
1437 0, // Format_ARGB6666_Premultiplied,
1438 0, // Format_RGB555,
1439 0, // Format_ARGB8555_Premultiplied,
1440 0, // Format_RGB888,
1441 0, // Format_RGB444,
1442 0 // Format_ARGB4444_Premultiplied,
1444 { // Format_ARGB4444_Premultiplied
1445 0, // Format_Invalid,
1447 0, // Format_MonoLSB,
1448 0, // Format_Indexed8,
1450 0, // Format_ARGB32,
1451 0, // Format_ARGB32_Premultiplied,
1453 0, // Format_ARGB8565_Premultiplied,
1454 0, // Format_RGB666,
1455 0, // Format_ARGB6666_Premultiplied,
1456 0, // Format_RGB555,
1457 0, // Format_ARGB8555_Premultiplied,
1458 0, // Format_RGB888,
1459 0, // Format_RGB444,
1460 0 // Format_ARGB4444_Premultiplied,