void PlotControl::enableSync(bool enable) { if (enable) { connect(zoomer1, SIGNAL(zoomed(QRectF)), zoomer2, SLOT(zoom(QRectF))); connect(zoomer2, SIGNAL(zoomed(QRectF)), zoomer1, SLOT(zoom(QRectF))); } else { plot1->enableAxis(QwtPlot::xBottom, true); disconnect(zoomer1, 0, zoomer2, 0); disconnect(zoomer2, 0, zoomer1, 0); } }
void DrawRotaZoom(const CharParamPtrX& char_param,bool Trans,bool call_alpha) { CharParam::Type half_x=char_param->texture_->GetSize().width_ *char_param->scale_x_/2; CharParam::Type half_y=char_param->texture_->GetSize().height_*char_param->scale_y_/2; fRect zoomed(char_param->center_.x-half_x,char_param->center_.y-half_y,char_param->center_.x+half_x,char_param->center_.y+half_y); fPoint tmp[4]; tmp[0].x=zoomed.left_; tmp[0].y=zoomed.top_; tmp[1].x=zoomed.right_; tmp[1].y=zoomed.top_; tmp[2].x=zoomed.right_; tmp[2].y=zoomed.bottom_; tmp[3].x=zoomed.left_; tmp[3].y=zoomed.bottom_; float sin_=sin(char_param->angle_.GetAsRadian()); float _sin_=-sin_; float cos_=cos(char_param->angle_.GetAsRadian()); fPoint res[4]; //線形変換による回転 for(int i=0; i<4; i++) { res[i].x= _sin_* tmp[i].y+ cos_* tmp[i].x+ char_param->center_.x; res[i].y= cos_* tmp[i].y+ sin_* tmp[i].x+ char_param->center_.y; } if(!call_alpha) kvarco::SetDrawBlendModeLight(DX_BLENDMODE_NOBLEND,0xFF); DxLib::DrawModiGraph( static_cast<int>(res[0].x),static_cast<int>(res[0].y), static_cast<int>(res[1].x),static_cast<int>(res[1].y), static_cast<int>(res[2].x),static_cast<int>(res[2].y), static_cast<int>(res[3].x),static_cast<int>(res[3].y), char_param->texture_->Get(),(int )Trans); }
/*! \brief Assign a zoom stack In combination with other types of navigation it might be useful to modify to manipulate the complete zoom stack. \param zoomStack New zoom stack \param zoomRectIndex Index of the current position of zoom stack. In case of -1 the current position is at the top of the stack. \note The zoomed signal might be emitted. \sa zoomStack(), zoomRectIndex() */ void QwtPlotZoomer::setZoomStack( const QStack<QRectF> &zoomStack, int zoomRectIndex ) { if ( zoomStack.isEmpty() ) return; if ( d_data->maxStackDepth >= 0 && zoomStack.count() > d_data->maxStackDepth ) { return; } if ( zoomRectIndex < 0 || zoomRectIndex > zoomStack.count() ) zoomRectIndex = zoomStack.count() - 1; const bool doRescale = zoomStack[zoomRectIndex] != zoomRect(); d_data->zoomStack = zoomStack; d_data->zoomRectIndex = uint( zoomRectIndex ); if ( doRescale ) { rescale(); Q_EMIT zoomed( zoomRect() ); } }
/*! Expand the selected rectangle to minZoomSize() and zoom in if accepted. \note The zoomed signal is emitted. \sa QwtPlotZoomer::accept()a, QwtPlotZoomer::minZoomSize() */ bool QwtPlotZoomer::end(bool ok) { ok = QwtPlotPicker::end(ok); if (!ok) return false; QwtPlot *plot = QwtPlotZoomer::plot(); if ( !plot ) return false; const SelectedPoints &pa = selection(); if ( pa.count() < 2 ) return false; QRect rect = QRect(pa[0], pa[int(pa.count() - 1)]); #if QT_VERSION < 0x040000 rect = rect.normalize(); #else rect = rect.normalized(); #endif QwtDoubleRect zoomRect = invTransform(rect).normalized(); const QwtDoublePoint center = zoomRect.center(); zoomRect.setSize(zoomRect.size().expandedTo(minZoomSize())); zoomRect.moveCenter(center); zoom(zoomRect); emit zoomed(zoomRect); return true; }
void qtauMeterBar::wheelEvent(QWheelEvent *event) { if (event->modifiers() & Qt::ControlModifier) emit zoomed(event->delta()); else emit scrolled(event->delta()); }
void VectorPlot::commit() { if(zoomer == 0) { zoomer = new QwtPlotZoomer(QwtPlot::xBottom, QwtPlot::yLeft, plot->canvas()); zoomer->setRubberBand(QwtPicker::RectRubberBand); zoomer->setRubberBandPen(QColor(Qt::green)); zoomer->setTrackerMode(QwtPicker::ActiveOnly); zoomer->setTrackerPen(QColor(Qt::white)); connect(zoomer, SIGNAL(zoomed(QwtDoubleRect)), this, SIGNAL(zoomed(QwtDoubleRect))); zoomer->setEnabled(true); } plot->replot(); }
void drawHere(SkCanvas* canvas, SkFilterQuality filter, SkScalar dx, SkScalar dy) { SkCanvas* origCanvas = canvas; SkAutoCanvasRestore acr(canvas, true); SkISize size = SkISize::Make(fImage->width(), fImage->height()); SkAutoTUnref<SkSurface> surface; if (fShowFatBits) { // scale up so we don't clip rotations SkImageInfo info = SkImageInfo::MakeN32(fImage->width() * 2, fImage->height() * 2, kOpaque_SkAlphaType); surface.reset(make_surface(canvas, info)); canvas = surface->getCanvas(); canvas->drawColor(SK_ColorWHITE); size.set(info.width(), info.height()); } else { canvas->translate(SkScalarHalf(fCell.width() - fImage->width()), SkScalarHalf(fCell.height() - fImage->height())); } this->drawTheImage(canvas, size, filter, dx, dy); if (surface) { SkAutoTUnref<SkImage> orig(surface->newImageSnapshot()); SkAutoTUnref<SkImage> zoomed(zoom_up(orig)); origCanvas->drawImage(zoomed, SkScalarHalf(fCell.width() - zoomed->width()), SkScalarHalf(fCell.height() - zoomed->height())); } }
void ConfigDlg::zoomOutSLOT( double fac ) { m_scale->zoomOutSLOT( fac ); emit zoomed(); }
/** * Returns the rectangle of the proportionally zoomed bitmap. */ CRect CPreviewRect::doGetZoomedBitmapRect(CBitmap* pBitmap, const CRect& FitInto) { // start with empty rect CRect zoomed(0, 0, 0, 0); // return empty rect if (FitInto.IsRectEmpty()) return zoomed; BITMAP bmpInfo; // get bitmap information if (pBitmap->GetObject(sizeof(bmpInfo), &bmpInfo) == 0) { // return empty rect return zoomed; } // return empty rect if (bmpInfo.bmWidth <= 0) return zoomed; if (bmpInfo.bmHeight <= 0) return zoomed; // calculate zoom factors double xfac = FitInto.Width() / static_cast<double>(bmpInfo.bmWidth); double yfac = FitInto.Height() / static_cast<double>(bmpInfo.bmHeight); // use smaller factor double zfac = (xfac < yfac) ? (xfac) : (yfac); // get zoomed size zoomed.right = static_cast<int>(zfac * bmpInfo.bmWidth + 0.5); // round = add 0.5 first and cut off zoomed.bottom = static_cast<int>(zfac * bmpInfo.bmHeight + 0.5); // round = add 0.5 first and cut off return zoomed; }
void QwtPlotZoomer::zoom( const QRectF &rect ) { if ( d_data->maxStackDepth >= 0 && int( d_data->zoomRectIndex ) >= d_data->maxStackDepth ) { return; } const QRectF zoomRect = rect.normalized(); if ( zoomRect != d_data->zoomStack[d_data->zoomRectIndex] ) { for ( uint i = d_data->zoomStack.count() - 1; i > d_data->zoomRectIndex; i-- ) { ( void )d_data->zoomStack.pop(); } d_data->zoomStack.push( zoomRect ); d_data->zoomRectIndex++; rescale(); Q_EMIT zoomed( zoomRect ); } }
Plot::Plot(QWidget* parent) : QwtPlot(parent), controlIsPressed(false), exportSize(100, 100), resolution(150), xBase(0, 1000, 100), yBase(0, 1000, 100) { setAutoFillBackground( true ); grid = new Grid(this); legend = new LegendItem(this); canvas = new Canvas(this); setAxisAutoScale(xBottom, false); setAxisAutoScale(yLeft, false); connect(canvas, SIGNAL(zoomed()), SIGNAL(zoomed())); }
void ScrollZoomer::scrollBarMoved(Qt::Orientation o, double min, double) { if (o == Qt::Horizontal) move(QPoint(min, zoomRect().top())); // move(min, zoomRect().top()); else move(QPoint(zoomRect().left(), min)); // move(zoomRect().left(), min); emit zoomed(zoomRect()); }
void DrawZoom(const CharParamPtrX& char_param,bool trans,bool call_alpha) { CharParam::Type half_x=char_param->texture_->GetSize().width_ *char_param->scale_x_/2; CharParam::Type half_y=char_param->texture_->GetSize().height_*char_param->scale_y_/2; fRect zoomed(char_param->center_.x-half_x,char_param->center_.y-half_y,char_param->center_.x+half_x,char_param->center_.y+half_y); if(!call_alpha) kvarco::SetDrawBlendModeLight(DX_BLENDMODE_NOBLEND,0xFF); DxLib::DrawExtendGraph(zoomed.left_,zoomed.top_,zoomed.right_,zoomed.bottom_,char_param->texture_->Get(),char_param->trans_); }
void Graphics_view_zoom::gentle_zoom(double factor) { _view->scale(factor, factor); _view->centerOn(target_scene_pos); QPointF delta_viewport_pos = target_viewport_pos - QPointF(_view->viewport()->width() / 2.0, _view->viewport()->height() / 2.0); QPointF viewport_center = _view->mapFromScene(target_scene_pos) - delta_viewport_pos; _view->centerOn(_view->mapToScene(viewport_center.toPoint())); emit zoomed(); }
void HaikuWindowProxy::Zoom(BPoint pos, float width, float height) { m_zoomInProgress = true; BWindow::Zoom(pos, width, height); // Only notify about Zoom invocations from the Haiku windowing system if (!m_qtCalledZoom) Q_EMIT zoomed(); }
void PetriNetViewZoom::gentleZoom(double factor) { mView->scale(factor, factor); mView->centerOn(mTargetScenePos); QPointF delta_viewport_pos = mTargetViewportPos - QPointF(mView->viewport()->width() / 2.0, mView->viewport()->height() / 2.0); QPointF viewport_center = mView->mapFromScene(mTargetScenePos) - delta_viewport_pos; mView->centerOn(mView->mapToScene(viewport_center.toPoint())); emit zoomed(); }
void Plot::autoscale() { canvas->setZoomBase(); setAxisAutoScale(xBottom); setAxisAutoScale(yLeft); replot(); setAxisAutoScale(xBottom, false); setAxisAutoScale(yLeft, false); emit zoomed(); }
void ScrollZoomer::scrollBarMoved( Qt::Orientation o, double min, double max ) { Q_UNUSED( max ); if ( o == Qt::Horizontal ) moveTo( QPointF( min, zoomRect().top() ) ); else moveTo( QPointF( zoomRect().left(), min ) ); Q_EMIT zoomed( zoomRect() ); }
//-------------------------------------------------------------------------------- void QGLImageGpuWidget::wheelEvent(QWheelEvent *event) { int num_degrees = event->delta() / 8; int num_steps = num_degrees / 15; float fact = 1.0f; if (zoom_>1.0f) fact += float(num_steps)/(10.0f*sqrtf(zoom_)); else fact += float(num_steps)/(10.0f); float cur_zoom = zoom_*fact; emit zoomed(fact); this->resize(image_->width()*cur_zoom, image_->height()*cur_zoom); emit zoomChanged(zoom_); event->accept(); }
/*! \brief Zoom in or out Activate a rectangle on the zoom stack with an offset relative to the current position. Negative values of offest will zoom out, positive zoom in. A value of 0 zooms out to the zoom base. \param offset Offset relative to the current position of the zoom stack. \note The zoomed signal is emitted. \sa zoomRectIndex() */ void QwtPlotZoomer::zoom(int offset) { if ( offset == 0 ) d_data->zoomRectIndex = 0; else { int newIndex = d_data->zoomRectIndex + offset; newIndex = qwtMax(0, newIndex); newIndex = qwtMin(int(d_data->zoomStack.count()) - 1, newIndex); d_data->zoomRectIndex = uint(newIndex); } rescale(); emit zoomed(zoomRect()); }
int QwtPlotZoomer::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QwtPlotPicker::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: zoomed((*reinterpret_cast< const QwtDoubleRect(*)>(_a[1]))); break; case 1: moveBy((*reinterpret_cast< double(*)>(_a[1])),(*reinterpret_cast< double(*)>(_a[2]))); break; case 2: move((*reinterpret_cast< double(*)>(_a[1])),(*reinterpret_cast< double(*)>(_a[2]))); break; case 3: zoom((*reinterpret_cast< const QwtDoubleRect(*)>(_a[1]))); break; case 4: zoom((*reinterpret_cast< int(*)>(_a[1]))); break; } _id -= 5; } return _id; }
void ScrollZoomer::scrollBarMoved( Qt::Orientation o, double min, double max ) { Q_UNUSED( max ); #if QWT_VERSION < 0x060000 if ( o == Qt::Horizontal ) move(min, zoomRect().top()); else move(zoomRect().left(), min); #else if ( o == Qt::Horizontal ) moveTo( QPointF( min, zoomRect().top() ) ); else moveTo( QPointF( zoomRect().left(), min ) ); #endif Q_EMIT zoomed( zoomRect() ); }
void PlotZoomer::zoomToFit(bool replot) { if (zoomRectIndex() <= 0) { // Force zoom signal for synchronisation. zoom(0); emit zoomed(zoomRect()); } else { zoom(0); } if (QwtPlot *plotter = plot()) { plotter->setAxisAutoScale(AxisX); plotter->setAxisAutoScale(AxisY); plotter->updateAxes(); } setZoomBase(replot); }
/*! \brief Zoom in or out Activate a rectangle on the zoom stack with an offset relative to the current position. Negative values of offset will zoom out, positive zoom in. A value of 0 zooms out to the zoom base. \param offset Offset relative to the current position of the zoom stack. \note The zoomed signal is emitted. \sa zoomRectIndex() */ void QwtPlotZoomer::zoom( int offset ) { int newIndex; if ( offset == 0 ) { newIndex = 0; } else { newIndex = d_data->zoomRectIndex + offset; newIndex = qBound( 0, newIndex, d_data->zoomStack.count() - 1 ); } if ( newIndex != static_cast<int>( d_data->zoomRectIndex ) ) { d_data->zoomRectIndex = newIndex; rescale(); Q_EMIT zoomed( zoomRect() ); } }
void Viewport::mousePressEvent(QMouseEvent *e) { if (e->buttons() & Qt::LeftButton) { if (zoomRegion.contains(e->pos())) { emit zoomed(zoomRegion); zoomRegion = QRect(0,0,0,0); } else { zoomRegion.setTopLeft(e->pos()); zoomRegion.setBottomRight(e->pos()); update(); } } else if (e->buttons() & Qt::RightButton) { mouseLastPos = e->pos(); } }
QHaikuWindow::QHaikuWindow(QWindow *window) : QPlatformWindow(window) , m_window(Q_NULLPTR) , m_windowState(Qt::WindowNoState) { const QRect rect = initialGeometry(window, window->geometry(), DefaultWindowWidth, DefaultWindowHeight); HaikuWindowProxy *haikuWindow = new HaikuWindowProxy(window, rect, Q_NULLPTR); connect(haikuWindow, SIGNAL(moved(QPoint)), SLOT(haikuWindowMoved(QPoint))); connect(haikuWindow, SIGNAL(resized(QSize,bool)), SLOT(haikuWindowResized(QSize,bool))); connect(haikuWindow, SIGNAL(windowActivated(bool)), SLOT(haikuWindowActivated(bool))); connect(haikuWindow, SIGNAL(minimized(bool)), SLOT(haikuWindowMinimized(bool))); connect(haikuWindow, SIGNAL(zoomed()), SLOT(haikuWindowZoomed())); connect(haikuWindow, SIGNAL(quitRequested()), SLOT(haikuWindowQuitRequested()), Qt::BlockingQueuedConnection); m_window = haikuWindow; if (!m_window) qFatal("QHaikuWindow: failed to create window"); setGeometry(rect); setWindowFlags(window->flags()); }
void WGraphFrame::mouseReleaseEvent(QMouseEvent *e) { if (zoomEnabled && (e->button()==LeftButton)) { if (zoomRect.isNull()) { parent->resetZoom(); emit zoomReset(); } else { zoomRect=zoomRect.normalize(); float x1,x2,y1,y2; parent->mapFromViewCoords(zoomRect.bottomLeft(),x1,y1); parent->mapFromViewCoords(zoomRect.topRight(),x2,y2); parent->setAutoScale(false); parent->setXVisRange(WRange(x1,x2)); parent->setYVisRange(WRange(y1,y2)); emit zoomed(); zoomRect=QRect(); } update(); } else if (panEnabled && (e->button()==LeftButton)) { QWidget::setCursor(panCursor); } else e->ignore(); }
void PlotMagnifier::rescale(double factor) { emit zoomed(); QwtPlotMagnifier::rescale(factor); }
void QxrdImagePlot::init(QxrdImagePlotSettingsWPtr settings) { QcepPlot::init(settings); m_ImagePlotSettings = settings; QxrdImagePlotSettingsPtr set(m_ImagePlotSettings); delete m_Zoomer; m_Zoomer = new QxrdImagePlotZoomer(canvas(), this); m_Zoomer -> setStateMachine(new QwtPickerDragRectMachine()); m_Zoomer -> setTrackerMode(QwtPicker::AlwaysOn); m_Zoomer -> setRubberBand(QwtPicker::RectRubberBand); m_Zoomer -> setMousePattern(QwtEventPattern::MouseSelect2, Qt::LeftButton, Qt::ControlModifier | Qt::ShiftModifier); m_Zoomer -> setMousePattern(QwtEventPattern::MouseSelect3, Qt::LeftButton, Qt::ControlModifier); m_Zoomer -> setEnabled(true); m_Rescaler = new QwtPlotRescaler(canvas(), QwtPlot::yLeft, QwtPlotRescaler::Expanding); m_Rescaler -> setEnabled(true); m_Rescaler -> setExpandingDirection(QwtPlotRescaler::ExpandBoth); m_Slicer = new QxrdPlotSlicer(canvas(), this); m_Slicer -> setEnabled(false); m_Measurer = new QxrdImagePlotMeasurer(canvas(), this); m_Measurer -> setEnabled(false); m_HistogramSelector = new QxrdHistogramSelector(canvas(), this); m_HistogramSelector -> setEnabled(false); m_Legend -> setFrameStyle(QFrame::Box|QFrame::Sunken); m_Legend -> setDefaultItemMode(QwtLegendData::Checkable); // insertLegend(m_Legend, QwtPlot::BottomLegend); m_DataImage = new QwtPlotSpectrogram(); m_DataImage -> attach(this); m_MaskImage = new QwtPlotSpectrogram(); m_MaskImage -> setAlpha(set && set->get_MaskShown() ? m_MaskAlpha : 0); m_MaskImage -> attach(this); m_OverflowImage = new QwtPlotSpectrogram(); m_OverflowImage -> setAlpha(set && set->get_OverflowShown() ? m_OverflowAlpha : 0); m_OverflowImage -> attach(this); m_CenterFinderPicker = new QxrdCenterFinderPicker(this); m_CenterMarker = new QwtPlotMarker(); m_CenterMarker -> setLineStyle(QwtPlotMarker::Cross); m_CenterMarker -> attach(this); m_Circles = new QxrdCircularMaskPicker(canvas(), this); m_Circles -> setEnabled(false); m_Polygons = new QxrdPolygonalMaskPicker(canvas(), this); m_Polygons -> setEnabled(false); m_PowderPointPicker = new QxrdPowderPointPicker(this); m_PowderPointPicker -> setEnabled(false); set100Range(); setGrayscale(); if (set) { connect(m_Zoomer, SIGNAL(zoomed(QRectF)), this, SLOT(onImageScaleChanged())); connect(set->prop_ImageShown(), SIGNAL(valueChanged(bool,int)), this, SLOT(changeImageShown(bool))); connect(set->prop_MaskShown(), SIGNAL(valueChanged(bool,int)), this, SLOT(changeMaskShown(bool))); connect(set->prop_OverflowShown(), SIGNAL(valueChanged(bool,int)), this, SLOT(changeOverflowShown(bool))); connect(set->prop_DisplayMinimumPct(), SIGNAL(valueChanged(double,int)), this, SLOT(recalculateDisplayedRange())); connect(set->prop_DisplayMaximumPct(), SIGNAL(valueChanged(double,int)), this, SLOT(recalculateDisplayedRange())); connect(set->prop_DisplayMinimumVal(), SIGNAL(valueChanged(double,int)), this, SLOT(recalculateDisplayedRange())); connect(set->prop_DisplayMaximumVal(), SIGNAL(valueChanged(double,int)), this, SLOT(recalculateDisplayedRange())); connect(set->prop_DisplayMinimumPctle(), SIGNAL(valueChanged(double,int)), this, SLOT(recalculateDisplayedRange())); connect(set->prop_DisplayMaximumPctle(), SIGNAL(valueChanged(double,int)), this, SLOT(recalculateDisplayedRange())); connect(set->prop_DisplayScalingMode(), SIGNAL(valueChanged(int,int)), this, SLOT(recalculateDisplayedRange())); connect(set->prop_InterpolatePixels(), SIGNAL(valueChanged(bool,int)), this, SLOT(onInterpolateChanged(bool))); connect(set->prop_MaintainAspectRatio(), SIGNAL(valueChanged(bool,int)), this, SLOT(onMaintainAspectChanged(bool))); connect(set->prop_DisplayColorMap(), SIGNAL(valueChanged(int,int)), this, SLOT(setColorMap(int))); connect(set->prop_DisplayLog(), SIGNAL(valueChanged(bool,int)), this, SLOT(redoColorMap())); changeImageShown(set->get_ImageShown()); changeMaskShown(set->get_MaskShown()); changeOverflowShown(set->get_OverflowShown()); recalculateDisplayedRange(); onInterpolateChanged(set->get_InterpolatePixels()); onMaintainAspectChanged(set->get_MaintainAspectRatio()); setColorMap(set->get_DisplayColorMap()); redoColorMap(); } enableZooming(); onImageScaleChanged(); }
CRectf CZoomPos::imgToCaneva(const CRectf &r) const { return CRectf( imgToCaneva(r.pos()), zoomed(r.size()) ); }