Changeset 621


Ignore:
Timestamp:
Mar 3, 2010, 3:04:01 AM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

gui: QPixmap: Enhanced fromPmHBITMAO, added fromPmHPOINTER().

Location:
trunk/src/gui/image
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gui/image/qpixmap.h

    r561 r621  
    163163#if defined(Q_WS_PM)
    164164    HBITMAP toPmHBITMAP(HBITMAP *mask = 0, bool embedRealAlpha = false) const;
    165     static QPixmap fromPmHBITMAP(HBITMAP hbm);
     165    static QPixmap fromPmHBITMAP(HBITMAP hbm);
    166166    static HPOINTER toPmHPOINTER(const QIcon &icon, bool isPointer = false,
    167167                                 int hotX = 0, int hotY = 0,
    168168                                 bool embedRealAlpha = false, bool isMini = true);
     169
     170
    169171#endif
    170172
  • trunk/src/gui/image/qpixmap_pm.cpp

    r569 r621  
    9393    handle.
    9494
    95     If \a mask is not NULL, the mask mode is turned. In this mode, the bitmap
     95    If \a mask is not NULL, the mask mode is turned. In this mode, the bitmap
    9696    mask is also created from the QPixmap's mask and returned in the given
    9797    variable. This bitmap mask will contain two vertically adjacent sections,
     
    233233
    234234/*!
    235     Returns a QPixmap that is equivalent to the given \a bitmap.
     235    Returns a QPixmap that is equivalent to the given \a bitmap. If \a hbmMask
     236    is not NULLHANDLE, it should contain vertically adjacent AND and XOR masks
     237    for the given bitmap which will be used to create a mask for the returned
     238    QPixmap.
     239
     240    Note that this method will attempt to auto-detect the presence of the real
     241    alpha chennel in the high 8 bits of the 32-bit pixel value for each pixel if
     242    the \a bitmap has 1 plane and the 32-bit depth. This alpha channel will be
     243    used to create an alpha channel for the returned QPixmap.
    236244
    237245    \warning This function is only available on OS/2.
     
    241249*/
    242250// static
    243 QPixmap QPixmap::fromPmHBITMAP(HBITMAP hbm)
     251QPixmap QPixmap::fromPmHBITMAP(HBITMAP hbm)
    244252{
    245253    QPixmap res;
     
    258266        return res;
    259267
    260     HPS hps = qt_alloc_mem_ps(bmh->cx, bmh->cy);
     268    HPS hps = qt_alloc_mem_ps(bmh->cx, bmh->cy);
    261269    if (hps == NULLHANDLE)
    262270        return res;
     
    270278        // monochrome bitmap
    271279        img = QImage(bmh->cx, bmh->cy, QImage::Format_Mono);
    272         if (GpiQueryBitmapBits(hps, 0, bmh->cy, (PBYTE)img.bits(),
     280        if (GpiQueryBitmapBits(hps, 0, , (PBYTE)img.bits(),
    273281                               (PBITMAPINFO2)&bmi) != GPI_ALTERROR) {
    274282            succeeded = true;
     
    277285            colors[0] = QRgb(pal[0]);
    278286            colors[1] = QRgb(pal[1]);
     287
    279288        }
    280289    } else {
     
    283292        bmh->cPlanes = 1;
    284293        bmh->cBitCount = 32;
    285         if (GpiQueryBitmapBits(hps, 0, bmh->cy, (PBYTE)img.bits(),
     294        if (GpiQueryBitmapBits(hps, 0, , (PBYTE)img.bits(),
    286295                               (PBITMAPINFO2)&bmi) != GPI_ALTERROR) {
    287296            succeeded = true;
     
    300309                img = alphaImg;
    301310            }
     311
     312
    302313        }
    303314    }
    304315
     316
     317
     318
     319
     320
     321
     322
     323
     324
     325
     326
     327
     328
     329
     330
     331
     332
     333
     334
     335
     336
     337
     338
     339
    305340    qt_free_mem_ps(hps);
    306341
    307342    if (succeeded) {
    308         // flip the bitmap top to bottom to cancel PM inversion
    309         img = img.mirrored();
    310343        res = QPixmap::fromImage(img);
     344
     345
    311346    }
    312347
     
    399434}
    400435
     436
     437
     438
     439
     440
     441
     442
     443
     444
     445
     446
     447
     448
     449
     450
     451
     452
     453
     454
     455
     456
     457
     458
     459
     460
     461
     462
     463
     464
     465
     466
     467
     468
     469
     470
     471
     472
     473
     474
     475
     476
     477
     478
     479
    401480QPixmap QPixmap::grabWindow(WId winId, int x, int y, int w, int h)
    402481{
Note: See TracChangeset for help on using the changeset viewer.