/// Draw the Slider void Slider::draw() const { if(showing) { if( type == HORIZONTAL ) { gl::color( ColorA( 0.2,0.3,0.4, alpha) ); gl::drawSolidRoundedRect( *this, 5.0, 32 ); Rectf pctg_rect = Rectf( Vec2f( getX1(), getY1() ), Vec2f( getX1() + pctg*getWidth(), getY2() ) ) ; gl::color( color ); gl::drawSolidRoundedRect( pctg_rect, 5.0, 32); } else if( type == VERTICAL ) { gl::color( ColorA( 0.2,0.3,0.4, alpha) ); gl::drawSolidRoundedRect( *this, 5.0, 32 ); Rectf pctg_rect = Rectf( Vec2f( getX1(), getY2() - pctg*getHeight() ), Vec2f( getX2(), getY2() ) ) ; gl::color( color ); gl::drawSolidRoundedRect( pctg_rect, 5.0, 32); } else if( type == CIRCULAR ) { gl::color( ColorA( 0.2,0.3,0.4, alpha) ); _drawArc( getCenter(), getWidth(), getHeight(), 0.0, 2*3.14159 , 10 ); gl::color( color ); _drawArc( getCenter(), getWidth(), getHeight(), 0.0, 2*3.14159*pctg, 7 ); } } }
void Utility::Yuv422FileSaver::savePlanar() { for(std::size_t k=0; k<video_->getNumberOfFrames()&&isRunning_; k++) { QVector<unsigned char> uBuffer; QVector<unsigned char> vBuffer; auto frame=video_->getFrame(k); for(int i=0; i<width_*height_; i+=2) { int y1=i/width_; int x1=i%width_; int y2=(i+1)/width_; int x2=(i+1)%width_; if(!frame->valid(x1,y1)||!frame->valid(x2,y2)) { qDebug()<<"Wrong pixel coordinates"; continue; } auto vec=Rgb888ToYuv422(frame->pixel(x1,y1),frame->pixel(x2,y2)); dataStream_<<vec.getY1()<<vec.getY2(); uBuffer.push_back(vec.getU()); vBuffer.push_back(vec.getV()); } while (!uBuffer.isEmpty()) { dataStream_<<uBuffer.takeFirst(); } while (!vBuffer.isEmpty()) { dataStream_<<vBuffer.takeFirst(); } } }
//---------------------------------------------------------- bool Rect::operator == (const Rect & rect) const { bool bSame = true; bSame = bSame && (getX1() == rect.getX1()); bSame = bSame && (getX2() == rect.getX2()); bSame = bSame && (getY1() == rect.getY1()); bSame = bSame && (getY2() == rect.getY2()); return bSame; }
void TestYuv411FileSaver::testRgb888ToYuv411() { auto vector = Utility::Yuv411FileSaver::Rgb888ToYuv411(pixel1,pixel2,pixel3,pixel4); QVERIFY(vector.getY1() == 16); QVERIFY(vector.getU() == 128); QVERIFY(vector.getV() == 128); QVERIFY(vector.getY2() == 16); QVERIFY(vector.getY3() == 16); QVERIFY(vector.getY4() == 16); }
std::vector<Line> HourGlass::getLines() const { std::vector<Line> lines; float x1 = getX1()+2; float x2 = getX2()-2; float y1 = getY1()+2; float y2 = getY2()-2; lines.push_back(Line(x1,y1,x2,y2)); lines.push_back(Line(x2,y1,x1,y2)); lines.push_back(Line(x1,y1,x2,y1)); lines.push_back(Line(x1,y2,x2,y2)); return lines; }
void QFCropPixelsEdit::spinValueChanged() { connectWidgets(false); if (spinX2->value()<=spinX1->value()) { spinX1->setValue(spinX2->value()+1); } if (spinY2->value()<=spinY1->value()) { spinY1->setValue(spinY2->value()+1); } connectWidgets(true); emit valueChanged(getX1(), getX2(), getY1(), getY2()); }
//---------------------------------------------------------- void Rect::lerp(const Rect & rect, float p) { float _x1 = coc::lerp(getX1(), rect.getX1(), p); float _x2 = coc::lerp(getX2(), rect.getX2(), p); float _y1 = coc::lerp(getY1(), rect.getY1(), p); float _y2 = coc::lerp(getY2(), rect.getY2(), p); setX1(_x1); setX2(_x2); setY1(_y1); setY2(_y2); }
void Utility::Yuv422FileSaver::savePacked() { for(std::size_t k=0; k<video_->getNumberOfFrames()&&isRunning_; k++) { auto frame=video_->getFrame(k); for(int i=0; i<width_*height_; i+=2) { int y1=i/width_; int x1=i%width_; int y2=(i+1)/width_; int x2=(i+1)%width_; if(!frame->valid(x1,y1)||!frame->valid(x2,y2)) { qDebug()<<"Wrong pixel coordinates"; continue; } auto vec=Rgb888ToYuv422(frame->pixel(x1,y1),frame->pixel(x2,y2)); dataStream_<<vec.getU()<<vec.getY1()<<vec.getV()<<vec.getY2(); } } }
void UMLInheritanceLink::draw(Gtk::DrawingArea* drawingArea) { Cairo::RefPtr<Cairo::Context> cr = drawingArea->get_window()->create_cairo_context(); Arrows::draw_arrow(cr, getX1(), getY1(), getX2(), getY2(), Line::FULL, Arrow::NORMAL, Arrow::NONE, isSelected()); }
int QFCropPixelsEdit::getHEIGHT() const { return getY2()-getY1()+1; }