45 #include <QtGui/private/qpixmap_blitter_p.h> 70 DFBSurfaceCapabilities surfaceCaps;
72 m_premult = (surfaceCaps & DSCAPS_PREMULTIPLIED);
78 DFBSurfaceDescription surfaceDesc;
79 memset(&surfaceDesc,0,
sizeof(DFBSurfaceDescription));
80 surfaceDesc.width = rect.
width();
81 surfaceDesc.height = rect.
height();
88 surfaceDesc.caps = DSCAPS_PREMULTIPLIED;
90 surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_CAPS | DSDESC_PIXELFORMAT);
92 surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT);
138 if ((w <= 0) || (h <= 0))
return;
144 DFBSurfaceDrawingFlags(
m_premult ? (DSDRAW_NOFX | DSDRAW_SRC_PREMULTIPLY) : DSDRAW_NOFX));
151 if (color.
alpha() == 0)
155 DFBSurfaceDrawingFlags(
m_premult ? (DSDRAW_BLEND | DSDRAW_SRC_PREMULTIPLY) : DSDRAW_BLEND));
164 if (result != DFB_OK)
165 DirectFBError(
"QDirectFBBlitter::alphaFillRect()", result);
172 DFBRectangle sRect = { sQRect.
x(), sQRect.
y(), sQRect.
width(), sQRect.
height() };
173 DFBRectangle dRect = { dQRect.
x(), dQRect.
y(), dQRect.
width(), dQRect.
height() };
177 if ((dRect.w <= 0) || (dRect.h <= 0))
return;
180 if (sRect.w <= 0) sRect.w = 1;
181 if (sRect.h <= 0) sRect.h = 1;
189 DFBSurfaceBlittingFlags blittingFlags = DFBSurfaceBlittingFlags(DSBLIT_BLEND_ALPHACHANNEL);
194 blittingFlags = DFBSurfaceBlittingFlags(blittingFlags | DSBLIT_BLEND_COLORALPHA | (
m_premult ? DSBLIT_SRC_PREMULTCOLOR : 0));
204 if ((sRect.w == dRect.w) && (sRect.h == dRect.h))
209 if (result != DFB_OK)
210 DirectFBError(
"QDirectFBBlitter::drawPixmapExtended()", result);
220 const DFBResult result =
m_surface->Lock(
m_surface.
data(), DFBSurfaceLockFlags(DSLF_WRITE|DSLF_READ),
static_cast<void**
>(&mem), &bpl);
221 if (result == DFB_OK) {
222 DFBSurfacePixelFormat dfbFormat;
223 DFBSurfaceCapabilities dfbCaps;
231 DirectFBError(
"Failed to lock image", result);
244 result = dfb->CreateDataBuffer(dfb, &dataBufferDescription, dataBuffer.
outPtr());
245 if (result != DFB_OK) {
252 result = dataBuffer->CreateImageProvider(dataBuffer.
data(), provider.
outPtr());
253 if (result != DFB_OK) {
259 DFBImageDescription imageDescription;
260 result = provider->GetImageDescription(provider.
data(), &imageDescription);
261 if (result != DFB_OK) {
267 if (imageDescription.caps & DICAPS_COLORKEY)
270 DFBSurfaceDescription surfaceDescription;
271 result = provider->GetSurfaceDescription(provider.
data(), &surfaceDescription);
272 if (result != DFB_OK) {
277 m_alpha = imageDescription.caps & DICAPS_ALPHACHANNEL;
278 resize(surfaceDescription.width, surfaceDescription.height);
282 result = provider->RenderTo(provider.
data(), dfbBlitter()->dfbSurface(), 0);
283 if (result != DFB_OK) {
292 Qt::ImageConversionFlags flags)
308 DFBDataBufferDescription description;
309 description.flags = DBDESC_FILE;
311 description.file = fileNameData.
constData();
312 if (fromDataBufferDescription(description))
The QColor class provides colors based on RGB, HSV or CMYK values.
virtual bool fromFile(const QString &filename, const char *format, Qt::ImageConversionFlags flags)
Format
The following image formats are available in Qt.
#define QT_END_NAMESPACE
This macro expands to.
CompositionMode
Defines the modes supported for digital image compositing.
T * data() const
Returns the value of the pointer referenced by this object.
virtual QImage * doLock()
The QByteArray class provides an array of bytes.
static QBlittable::Capabilities dfb_blitter_capabilities()
void drawPixmapOpacity(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect, QPainter::CompositionMode cmode, qreal opacity)
int width() const
Returns the width of the rectangle.
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
ushort red
Returns the red color component of this color.
static QImage::Format imageFormatFromSurfaceFormat(const DFBSurfacePixelFormat format, const DFBSurfaceCapabilities caps)
int height() const
Returns the height of the rectangle.
The QString class provides a Unicode character string.
virtual void fillRect(const QRectF &rect, const QColor &color)
bool exists() const
Returns true if the file specified by fileName() exists; otherwise returns false. ...
int width() const
Returns the width.
#define QT_BEGIN_NAMESPACE
This macro expands to.
The QRectF class defines a rectangle in the plane using floating point precision. ...
virtual ~QDirectFbBlitter()
QDirectFbBlitter(const QSize &size, IDirectFBSurface *surface)
virtual void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect)
static DFBSurfacePixelFormat pixmapFormat()
The QImage class provides a hardware-independent image representation that allows direct access to th...
QByteArray toLocal8Bit() const Q_REQUIRED_RESULT
Returns the local 8-bit representation of the string as a QByteArray.
QRect toRect() const
Returns a QRect based on the values of this rectangle.
void alphaFillRect(const QRectF &rect, const QColor &color, QPainter::CompositionMode cmode)
const char * constData() const
Returns a pointer to the data stored in the byte array.
ushort blue
Returns the blue color component of this color.
ushort alpha
Returns the alpha color component of this color.
int y() const
Returns the y-coordinate of the rectangle's top edge.
int x() const
Returns the x-coordinate of the rectangle's left edge.
int height() const
Returns the height.
The QRect class defines a rectangle in the plane using integer precision.
static IDirectFB * dfbInterface()
void getRect(int *x, int *y, int *w, int *h) const
Extracts the position of the rectangle's top-left corner to *x and *y, and its dimensions to *width a...
The QPixmap class is an off-screen image representation that can be used as a paint device...
The QSize class defines the size of a two-dimensional object using integer point precision.
QBlittable * blittable() const
static DFBSurfacePixelFormat selectPixmapFormat(bool withAlpha)
static DFBSurfacePixelFormat alphaPixmapFormat()
ushort green
Returns the green color component of this color.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
QDirectFBPointer< IDirectFBSurface > m_surface
QPixmapData * pixmapData() const