void SelectionView::mouseReleaseEvent( QMouseEvent *e ) { if ( _drawLine ) { QPainter painter( getPix() ); painter.setPen(QPen(Qt::red, 12, Qt::DashDotLine, Qt::RoundCap)); painter.drawPath( *linePath ); pixItem->setPixmap( *getPix() ); // scene()->addPixmap( *getPix() ); _drawLineHold = false; return; } //!* self-defined pixel if ( _snapRatio == -1.0) { if (_isFromCenter) { _originPoint.rx() = e ->pos().x() - int(_snapWidth*_zoomRatio/2+0.5); _originPoint.ry() = e ->pos().y() - int(_snapHeight*_zoomRatio/2+0.5); _terminalPoint.rx() = e ->pos().x() + int(_snapWidth*_zoomRatio/2+0.5); _terminalPoint.ry() = e ->pos().y() + int(_snapHeight*_zoomRatio/2+0.5); } else { _originPoint = e->pos(); _terminalPoint.rx() = e ->pos().x() + int(_snapWidth*_zoomRatio+0.5) - 1; _terminalPoint.ry() = e ->pos().y() + int(_snapHeight*_zoomRatio+0.5) - 1; } } //!* specify ratio else { if (_isFromCenter) { _originPoint = _originPoint + _originPoint - _terminalPoint; } } QRect selectedRect = getSelectedRect(); QPoint topLeft = selectedRect.topLeft() / _zoomRatio; QPoint bottomRight = selectedRect.bottomRight() / _zoomRatio; if ( qAbs(bottomRight.x()-topLeft.x()) > 2 && qAbs(bottomRight.y()-topLeft.y()) > 2 ) emit rubberBandSelectionFinished(); _selectionFinished = true; }
static void initDisplayUtilsImages() { if (!KexiDisplayUtils_autonum) { /*! @warning not reentrant! */ KexiDisplayUtils_autonum_deleter.setObject( KexiDisplayUtils_autonum, getPix(0) ); } }
void SelectionView::dealWithPixmap(QPixmap pm) { if ( !scene() ) { qDebug() << "No scene!"; return; } scene()->setSceneRect(0, 0, pm.width(), pm.height()); scene()->clear(); setPix( &pm ); pixItem = scene()->addPixmap( pm ); qDebug() << QString().sprintf( "pix: %p, pixItem: %p", getPix(), pixItem ); }
void imTestRegression() { Image * im; int dimx,dimy;int i,j;Pixel couleur2 = { 0, 0, 0 }; Pixel couleur;couleur.b=8;couleur.r=1;couleur.g=1; printf("Donnez la dimension de ton image:\n dimx:"); scanf("%d",&dimx); printf("dimy:"); scanf("%d",&dimy); im=imCreer(dimx,dimy); printf("Taille de l'image :%dpx*%dpx",im->dimx,im->dimy); imDessineRectangle(im,4,6,12,15,couleur);printf("\n"); for(j=0;j<im->dimy;j++) { for(i=0;i<im->dimx;i++) { couleur=getPix(im,j,i); if(couleur.b==8)printf("* "); else printf("- "); } printf("\n"); } imEffacer(im,couleur2); printf("\nAffichage de l'image aprés la procedure qui efface\n"); for(j=0;j<im->dimy;j++) { for(i=0;i<im->dimx;i++) { couleur=getPix(im,j,i); if(couleur.b==8)printf("* "); else printf("- "); } printf("\n"); } imDetruire(im); }
void imPrintf(const Image *pIm) { int x,y; Pixel pix; printf( "%d %d\n", pIm->dimx, pIm->dimy); /* dimension de l'image*/ for(y=0;y<pIm->dimy;++y) { for(x=0;x<pIm->dimx;++x) { pix = getPix(pIm,x,y); printf("%d %d %d ", pix.r, pix.g, pix.b); } printf("\n"); } }
TrayIcon::TrayIcon(MainWindow* wnd) : _gwin(wnd) , m_status(STATUS_UNKNOW) { pixUser[STATUS_UNKNOW] = getPix("status_offline.png"); pixUser[STATUS_ONLINE] = getPix("status_online.png"); pixUser[STATUS_CHAT] = getPix("status_online.png"); pixUser[STATUS_AWAY] = getPix("status_away.png"); pixUser[STATUS_DND] = getPix("status_dnd.png"); pixUser[STATUS_EX] = getPix("status_ex.png"); pixUser[STATUS_OFFLINE] = getPix("status_offline.png"); pixUser[STATUS_NEW_MSG] = getPix("status_msg.png"); tooltip[STATUS_UNKNOW] = _("(Unknow) "); tooltip[STATUS_ONLINE] = _("(Online) "); tooltip[STATUS_CHAT] = _("(Chat) "); tooltip[STATUS_AWAY] = _("(Away) "); tooltip[STATUS_DND] = _("(Don't Disturb) "); tooltip[STATUS_EX] = _("(Extend away) "); tooltip[STATUS_OFFLINE] = _("(Offline) "); tooltip[STATUS_NEW_MSG] = _("New Message"); /* tooltip[0] = "(未知状态) "; tooltip[1] = "(在线) "; tooltip[2] = "(唠叨) "; tooltip[3] = "(离开) "; tooltip[4] = "(请勿打扰) "; tooltip[5] = "(远远离开) "; tooltip[6] = "(未连接) "; */ GtkStatusIcon* gobj_StatusIcon = this->gobj(); g_signal_connect(G_OBJECT(gobj_StatusIcon), "activate", G_CALLBACK(on_statusicon_activated), _gwin); g_signal_connect(G_OBJECT(gobj_StatusIcon), "popup-menu", G_CALLBACK(on_statusicon_popup), _gwin); this->set (pixUser[STATUS_OFFLINE]); }
void imSauver(const Image *pIm, const char filename[]) { FILE* f; Pixel pix; int x,y; f = fopen(filename, "w"); if (f==NULL) { printf("Erreur lors de l'ouverture de %s\n", filename); assert( f ); } fprintf( f , "P3\n"); /*P3 = ascii avec 3 composantes RGB*/ fprintf( f , "%d %d\n", pIm->dimx, pIm->dimy); /* dimension de l'image*/ fprintf( f , "255\n"); /* chaque composante est comprise entre 0 et 255*/ for(y=0;y<pIm->dimy;++y) for(x=0;x<pIm->dimx;++x) { pix = getPix(pIm,x++,y); fprintf(f, "%d %d %d ", pix.r, pix.g, pix.b); } printf("Sauvegarde de l'image %s ...OK\n", filename); fclose(f); }
Glib::RefPtr<Gdk::Pixbuf> MemberList::getPixfromAffilliation(MUCRoomAffiliation affiliation) { std::string pix; switch (affiliation) { case AffiliationNone: pix.assign("voice.png"); break; case AffiliationOutcast: pix.assign("outcast.png"); break; case AffiliationMember: pix.assign("voice.png"); break; case AffiliationOwner: pix.assign("owner.png"); break; case AffiliationAdmin: pix.assign("admin.png"); break; case AffiliationInvalid: pix.assign("invalid.png"); break; default: pix.assign("voice.png"); break; } return getPix(pix.c_str()); }