QScriptValue PHIBaseItem::moveBy( qint32 left, qint32 top, qint32 width, qint32 height, qint32 start, qint32 duration, const QString &ease ) { QEasingCurve::Type curve=PHI::toEasingCurveType( ease ); _effect->setMoveBy( start, duration, left, top, width, height, curve ); if ( !isClientItem() ) return self(); QParallelAnimationGroup *group=new QParallelAnimationGroup( this ); QPropertyAnimation *l=new QPropertyAnimation( this, BL( "_x" ), group ); l->setEndValue( PHIBOUND(left)+qRound( realX() ) ); l->setDuration( duration ); l->setEasingCurve( curve ); QPropertyAnimation *t=new QPropertyAnimation( this, BL( "_y" ), group ); t->setEndValue( PHIBOUND(top)+qRound( realY() ) ); t->setDuration( duration ); t->setEasingCurve( curve ); QPropertyAnimation *w=new QPropertyAnimation( this, BL( "_width" ), group ); w->setEndValue( PHIBOUND(width)+qRound( realWidth() ) ); w->setDuration( duration ); w->setEasingCurve( curve ); QPropertyAnimation *h=new QPropertyAnimation( this, BL( "_height" ), group ); h->setEndValue( PHIBOUND(height)+qRound( realHeight() ) ); h->setDuration( duration ); h->setEasingCurve( curve ); group->addAnimation( l ); group->addAnimation( t ); group->addAnimation( w ); group->addAnimation( h ); connect( group, &QAbstractAnimation::finished, group, &QAbstractAnimation::deleteLater ); QTimer::singleShot( start, group, SLOT( start() ) ); return self(); }
__inline__ bmp_t* create_bmp( int width, int height, rgb_t * pixel) { bmp_t* bmp = (bmp_t*) malloc(sizeof(bmp_t)); int lwidth = realWidth(width); int sizeImage = lineBytes(width)* height ; //int sizeImage = lwidth * height * (int)sizeof(rgb_t); bmp->file_header.type = 19778; bmp->file_header.reserved1 = bmp->file_header.reserved2 = 0; bmp->file_header.offsetbytes = 54; bmp->file_header.fsize = 54 + sizeImage; bmp->info_header.hsize = sizeof(bitmapInfoHeader_t); bmp->info_header.width = width; bmp->info_header.height = height; bmp->info_header.planes = 1; bmp->info_header.bitcount = 8 * sizeof(rgb_t); bmp->info_header.compression = 0; bmp->info_header.sizeimage = sizeImage; bmp->info_header.xpelspermeter = 0; bmp->info_header.ypelspermeter = 0; bmp->info_header.colorsused = 0; bmp->info_header.colorsimportant = 0; if(pixel != NULL) bmp->data= (u8*)pixel; else bmp->data = (u8*)malloc(sizeImage); return bmp; }
__inline__ int write_bmp(char * filename, rgb_t * pixel, int width, int height) { bmp_t bmp; int lwidth = realWidth(width); //int sizeImage = lwidth * height * (int)sizeof(rgb_t); int sizeImage = lineBytes(width)* height ; bmp.file_header.type = 19778; bmp.file_header.reserved1 = bmp.file_header.reserved2 = 0; bmp.file_header.offsetbytes = 54; bmp.file_header.fsize = 54 + sizeImage; bmp.info_header.hsize = sizeof(bitmapInfoHeader_t); bmp.info_header.width = width; bmp.info_header.height = height; bmp.info_header.planes = 1; bmp.info_header.bitcount = 8 * sizeof(rgb_t); bmp.info_header.compression = 0; bmp.info_header.sizeimage = sizeImage; bmp.info_header.xpelspermeter = 0; bmp.info_header.ypelspermeter = 0; bmp.info_header.colorsused = 0; bmp.info_header.colorsimportant = 0; return write_bmp(filename, &bmp, pixel); }
void toResultViewCheck::setText(int col, const QString &txt) { if (txt != text(col)) { if (col >= ColumnCount || !ColumnData) { int ns = (col + ALLOC_SIZE) / ALLOC_SIZE * ALLOC_SIZE; keyData *nd = new keyData[ns]; int i; for (i = 0; i < ColumnCount; i++) nd[i] = ColumnData[i]; while (i < ns) { nd[i].Width = 0; nd[i].Type = keyData::String; i++; } delete[] ColumnData; ColumnData = nd; ColumnCount = ns; } static QRegExp number(QString::fromLatin1("^\\d*\\.?\\d+E?-?\\d*.?.?$")); ColumnData[col].Data = txt; if (txt == "N/A") { ColumnData[col].Type = keyData::String; ColumnData[col].KeyAsc = "\xff"; ColumnData[col].KeyDesc = "\x00"; } // qt4 else if (number.match(txt) >= 0) else if (number.indexIn(txt) >= 0) { ColumnData[col].Type = keyData::Number; static char buf[100]; double val = txt.toFloat(); if (val < 0) sprintf(buf, "\x01%015.5f", val); else sprintf(buf, "%015.5f", val); ColumnData[col].KeyAsc = ColumnData[col].KeyDesc = QString::fromLatin1(buf); } else { ColumnData[col].Type = keyData::String; ColumnData[col].KeyAsc = ColumnData[col].KeyDesc = ColumnData[col].Data; } ColumnData[col].Width = realWidth(listView()->fontMetrics(), listView(), col, txt); } toTreeWidgetCheck::setText(col, firstText(col)); }
__inline__ bmp_t* create_gray256( int width, int height, u8* pixel) { int i; bmp_t* bmp = (bmp_t*) malloc(sizeof(bmp_t)); int lwidth = realWidth(width); int sizeImage = lwidth * height * (int)sizeof(u8); bmp->file_header.type = 19778; bmp->file_header.reserved1 = bmp->file_header.reserved2 = 0; bmp->file_header.offsetbytes = 54 + 1024; bmp->file_header.fsize = 54 + 1024 + sizeImage; bmp->info_header.hsize = sizeof(bitmapInfoHeader_t); bmp->info_header.width = width; bmp->info_header.height = height; bmp->info_header.planes = 1; bmp->info_header.bitcount = 8; bmp->info_header.compression = 0; bmp->info_header.sizeimage = sizeImage; bmp->info_header.xpelspermeter = 0; bmp->info_header.ypelspermeter = 0; bmp->info_header.colorsused = 0; bmp->info_header.colorsimportant = 0; if(pixel != NULL) bmp->data= pixel; else bmp->data = (u8*)malloc(sizeImage); bmp->color_table= (RGBQUAD*)malloc((1<< bmp->info_header.bitcount)*sizeof(RGBQUAD)); for(i=0;i<(1<< bmp->info_header.bitcount);i++){ bmp->color_table[i].B= i; bmp->color_table[i].G= i; bmp->color_table[i].R= i; bmp->color_table[i].Reserved=i; } return bmp; }
__inline__ int write_gray256(char * filename, u8* pixel, int width, int height) { int i; bmp_t bmp; int lwidth = realWidth(width); int sizeImage = lwidth * height * (int)sizeof(u8); bmp.file_header.type = 19778; bmp.file_header.reserved1 = bmp.file_header.reserved2 = 0; bmp.file_header.offsetbytes = 54 + 1024; bmp.file_header.fsize = 54 + 1024 + sizeImage; bmp.info_header.hsize = sizeof(bitmapInfoHeader_t); bmp.info_header.width = width; bmp.info_header.height = height; bmp.info_header.planes = 1; bmp.info_header.bitcount = 8; bmp.info_header.compression = 0; bmp.info_header.sizeimage = sizeImage; bmp.info_header.xpelspermeter = 0; bmp.info_header.ypelspermeter = 0; bmp.info_header.colorsused = 0; bmp.info_header.colorsimportant = 0; bmp.data= pixel; bmp.color_table= (RGBQUAD*)malloc((1<< bmp.info_header.bitcount)*sizeof(RGBQUAD)); for(i=0;i<(1<< bmp.info_header.bitcount);i++){ bmp.color_table[i].B= i; bmp.color_table[i].G= i; bmp.color_table[i].R= i; bmp.color_table[i].Reserved=i; } return write_gray256(filename, &bmp, pixel); }
QScriptValue PHIBaseItem::width( const QScriptValue &v ) { if ( !v.isValid() ) return qRound( realWidth() ); setWidth( v.toNumber() ); return self(); }