//______________________________________________________________ TileSet::TileSet(const QPixmap &source, int w1, int h1, int w2, int h2 ): _w1(w1), _h1(h1), _w3(0), _h3(0) { _pixmaps.reserve(9); if( source.isNull() ) return; _w3 = source.width()/devicePixelRatio( source ) - (w1 + w2); _h3 = source.height()/devicePixelRatio( source ) - (h1 + h2); int w = w2; int h = h2; // initialise pixmap array initPixmap( _pixmaps, source, _w1, _h1, QRect(0, 0, _w1, _h1) ); initPixmap( _pixmaps, source, w, _h1, QRect(_w1, 0, w2, _h1) ); initPixmap( _pixmaps, source, _w3, _h1, QRect(_w1+w2, 0, _w3, _h1) ); initPixmap( _pixmaps, source, _w1, h, QRect(0, _h1, _w1, h2) ); initPixmap( _pixmaps, source, w, h, QRect(_w1, _h1, w2, h2) ); initPixmap( _pixmaps, source, _w3, h, QRect(_w1+w2, _h1, _w3, h2) ); initPixmap( _pixmaps, source, _w1, _h3, QRect(0, _h1+h2, _w1, _h3) ); initPixmap( _pixmaps, source, w, _h3, QRect(_w1, _h1+h2, w2, _h3) ); initPixmap( _pixmaps, source, _w3, _h3, QRect(_w1+w2, _h1+h2, _w3, _h3) ); }
//______________________________________________________________ TileSet::TileSet(const QPixmap &pix, int w1, int h1, int w3, int h3, int x1, int y1, int w2, int h2, bool stretch ): _stretch( stretch ), _w1(w1), _h1(h1), _w3(w3), _h3(h3) { _pixmaps.reserve(9); if (pix.isNull()) return; int x2 = pix.width() - _w3; int y2 = pix.height() - _h3; int w = w2; int h = h2; if( !_stretch ) { while (w < _sideExtent && w2 > 0) w += w2; while (h < _sideExtent && h2 > 0) h += h2; } // initialise pixmap array initPixmap( _pixmaps, pix, _w1, _h1, QRect(0, 0, _w1, _h1) ); initPixmap( _pixmaps, pix, w, _h1, QRect(x1, 0, w2, _h1) ); initPixmap( _pixmaps, pix, _w3, _h1, QRect(x2, 0, _w3, _h1) ); initPixmap( _pixmaps, pix, _w1, h, QRect(0, y1, _w1, h2) ); initPixmap( _pixmaps, pix, w, h, QRect(x1, y1, w2, h2) ); initPixmap( _pixmaps, pix, _w3, h, QRect(x2, y1, _w3, h2) ); initPixmap( _pixmaps, pix, _w1, _h3, QRect(0, y2, _w1, _h3) ); initPixmap( _pixmaps, pix, w, _h3, QRect(x1, y2, w2, _h3) ); initPixmap( _pixmaps, pix, _w3, _h3, QRect(x2, y2, _w3, _h3) ); }
void dialogAnalog::plot(bool forceRedraw,QSize size) { QPainter p; screenPixmap = QPixmap( size); if (forceRedraw) { initPixmap(size); QColor greenColor(Qt::green); QPen dataPen1( greenColor); fillPixmap(&dataplot,&dataPen1); #if 0 QPen dataPen2(QColor(Qt::red)); dataPen2.setStyle(Qt::DashDotDotLine); fillPixmap(&dataplot2,&dataPen2); #endif } p.begin(&screenPixmap); p.drawPixmap(0, 0, lastPixmap); drawMarkers(&p); p.end(); // draw markers }
void WPigSetWorldCoordinates(const double *xlow, const double *xhigh, const double *ylow, const double *yhigh) { XtVaGetValues( MainCanvas, XtNheight, &height, XtNwidth, &width, NULL); // printf ("set val height,width= (%d,%d)\n", height, width); WorldX1 = (double) *xlow; WorldX2 = (double) *xhigh; WorldY1 = (double) *ylow; WorldY2 = (double) *yhigh; WCentx = width/(WorldX2 - WorldX1); WCenty = height/(WorldY2 - WorldY1); WtoVScale = 0.9*WCentx; if(WCenty < WCentx) { WtoVScale = 0.9*WCenty; } WCentx = 0.5*(WorldX2 + WorldX1); WCenty = 0.5*(WorldY2 + WorldY1); // Kludge - initializing pixmap here because dimensions of the pixmap are known here!!! if (use_pixmap) initPixmap(); }
SoundViewerWidget::SoundViewerWidget(unsigned ch) { this->channel = ch; this->volume = 0.0; this->panL = 0.0; this->panR = 0.0; this->note = -1; initPixmap(); setMinimumWidth(NUM_OCTAVES * pixmap.width()); setMaximumWidth(NUM_OCTAVES * pixmap.width()); setMinimumHeight(pixmap.height() + METER_HEIGHT); setMaximumHeight(pixmap.height() + METER_HEIGHT); }
//! [0] TabletCanvas::TabletCanvas() { resize(500, 500); myBrush = QBrush(); myPen = QPen(); initPixmap(); setAutoFillBackground(true); deviceDown = false; myColor = Qt::red; myTabletDevice = QTabletEvent::Stylus; alphaChannelType = NoAlpha; colorSaturationType = NoSaturation; lineWidthType = LineWidthPressure; }
//! [0] TabletCanvas::TabletCanvas(QWidget *parent) : QWidget(parent) { myBrush = QBrush(); myPen = QPen(); initPixmap(); setAutoFillBackground(true); deviceDown = false; myColor = Qt::red; myTabletDevice = QTabletEvent::Stylus; alphaChannelType = NoAlpha; colorSaturationType = NoSaturation; lineWidthType = LineWidthPressure; mouseDown=false; factor =1.0; }
int main() { initMac(); setUp(); createWindow(); /* Create a window to display the final image. */ initPixmap(); /* Initialize offscreen pixmap. */ createImage(); /* Copy the main screen's pixmap into the offscreen's. */ drawImage(); /* Copy the offscreen's pixmap onto the window. */ doEventLoop(); /* Handle any events. */ DisposeWindow( gWindow ); return 0; }
void Shadows::Private::setupPixmaps() { clearPixmaps(); initPixmap("shadow-top"); initPixmap("shadow-topright"); initPixmap("shadow-right"); initPixmap("shadow-bottomright"); initPixmap("shadow-bottom"); initPixmap("shadow-bottomleft"); initPixmap("shadow-left"); initPixmap("shadow-topleft"); m_emptyCornerPix = initEmptyPixmap(QSize(1,1)); m_emptyCornerLeftPix = initEmptyPixmap(QSize(q->elementSize("shadow-topleft").width(), 1)); m_emptyCornerTopPix = initEmptyPixmap(QSize(1, q->elementSize("shadow-topleft").height())); m_emptyCornerRightPix = initEmptyPixmap(QSize(q->elementSize("shadow-bottomright").width(), 1)); m_emptyCornerBottomPix = initEmptyPixmap(QSize(1, q->elementSize("shadow-bottomright").height())); m_emptyVerticalPix = initEmptyPixmap(QSize(1, q->elementSize("shadow-left").height())); m_emptyHorizontalPix = initEmptyPixmap(QSize(q->elementSize("shadow-top").width(), 1)); }
///// Initialize ////////////////////////////////////////////////////////////// void IconSets::initialize() /// Initializes the static data of the class. In practice it fills the default /// QMimeSourceFactory with data from the included qembed'ed files. /// QIconSet's are constructed from these data when requested. This allows the /// factory to be filed with different versions of an icon. { if(isInitialized) return; isInitialized = true; ///// IconSet pixmaps // Open initPixmap((unsigned char*)open_normal_data, 32, 32, true, OpenNormal, "OpenNormal", Open); initPixmap((unsigned char*)open_active_data, 32, 32, true, OpenActive, "OpenActive"); // Save initPixmap((unsigned char*)save_normal_data, 32, 32, true, SaveNormal, "SaveNormal", Save); initPixmap((unsigned char*)save_disabled_data, 32, 32, true, SaveDisabled, "SaveDisabled"); initPixmap((unsigned char*)save_active_data, 32, 32, true, SaveActive, "SaveActive"); // Prefs initPixmap((unsigned char*)prefs_normal_data, 32, 32, true, PrefsNormal, "PrefsNormal", Prefs); initPixmap((unsigned char*)prefs_active_data, 32, 32, true, PrefsActive, "PrefsActive"); // Image initPixmap((unsigned char*)image_normal_data, 32, 32, true, ImageNormal, "ImageNormal", Image); initPixmap((unsigned char*)image_disabled_data, 32, 32, true, ImageDisabled, "ImageDisabled"); initPixmap((unsigned char*)image_active_data, 32, 32, true, ImageActive, "ImageActive"); // Help initPixmap((unsigned char*)help_normal_data, 32, 32, true, HelpNormal, "HelpNormal", Help); initPixmap((unsigned char*)help_active_data, 32, 32, true, HelpActive, "HelpActive"); // What's This initPixmap((unsigned char*)whatsthis_normal_data, 32, 32, true, WhatsThisNormal, "WhatsThisNormal", WhatsThis); initPixmap((unsigned char*)whatsthis_active_data, 32, 32, true, WhatsThisActive, "WhatsThisActive"); }
void TabletCanvas::resizeEvent(QResizeEvent *) { initPixmap(); polyLine[0] = polyLine[1] = polyLine[2] = QPoint(); }