void KisToolMultihand::paint(QPainter& gc, const KoViewConverter &converter) { if(m_setupAxesFlag) { int diagonal = (currentImage()->height() + currentImage()->width()); QPainterPath path; path.moveTo(m_axesPoint.x()-diagonal*cos(m_angle), m_axesPoint.y()-diagonal*sin(m_angle)); path.lineTo(m_axesPoint.x()+diagonal*cos(m_angle), m_axesPoint.y()+diagonal*sin(m_angle)); path.moveTo(m_axesPoint.x()-diagonal*cos(m_angle+M_PI_2), m_axesPoint.y()-diagonal*sin(m_angle+M_PI_2)); path.lineTo(m_axesPoint.x()+diagonal*cos(m_angle+M_PI_2), m_axesPoint.y()+diagonal*sin(m_angle+M_PI_2)); paintToolOutline(&gc, pixelToView(path)); } else { KisToolFreehand::paint(gc, converter); if(m_showAxes){ int diagonal = (currentImage()->height() + currentImage()->width()); QPainterPath path; path.moveTo(m_axesPoint.x()-diagonal*cos(m_angle), m_axesPoint.y()-diagonal*sin(m_angle)); path.lineTo(m_axesPoint.x()+diagonal*cos(m_angle), m_axesPoint.y()+diagonal*sin(m_angle)); path.moveTo(m_axesPoint.x()-diagonal*cos(m_angle+M_PI_2), m_axesPoint.y()-diagonal*sin(m_angle+M_PI_2)); path.lineTo(m_axesPoint.x()+diagonal*cos(m_angle+M_PI_2), m_axesPoint.y()+diagonal*sin(m_angle+M_PI_2)); paintToolOutline(&gc, pixelToView(path)); } } }
void KisToolDyna::initStroke(KoPointerEvent *event) { QRectF imageSize = QRectF(QPointF(0.0,0.0),currentImage()->size()); QRectF documentSize = currentImage()->pixelToDocument(imageSize); m_surfaceWidth = documentSize.width(); m_surfaceHeight = documentSize.height(); setMousePosition(event->point); m_mouse.init(m_mousePos.x(), m_mousePos.y()); KisToolFreehand::initStroke(event); }
/*! Sets the current image for this rock to the next image in the animation sequence. The way it computes which image is next is a bit obscure. It skips over some. \internal */ void KRock::advanceImage() { if (cskip_-- <= 0) { setImage((currentImage()+step_+frameCount()) % frameCount()); cskip_ = qAbs(skip_); } }
void StickerPreviewWidget::showPreview(DocumentData *sticker) { if (sticker && !sticker->isAnimation() && !sticker->sticker()) sticker = 0; if (sticker) { _cache = QPixmap(); if (isHidden() || _a_shown.animating()) { if (isHidden()) show(); a_shown.start(1); _a_shown.start(); } else { update(); } } else if (isHidden()) { return; } else { if (_gif) _cache = currentImage(); a_shown.start(0); _a_shown.start(); } _doc = sticker; if (_gif) { if (gif()) { delete _gif; } _gif = 0; } _cacheStatus = CacheNotLoaded; }
void MediaPreviewWidget::hidePreview() { if (isHidden()) { return; } if (_gif) _cache = currentImage(); a_shown.start(0); _a_shown.start(); _photo = nullptr; _document = nullptr; resetGifAndCache(); }
void KisToolDyna::timeoutPaint() { Q_ASSERT(currentPaintOpPreset()->settings()->isAirbrushing()); if (currentImage() && m_painter) { paintAt(m_previousPaintInformation); QRegion r = m_painter->takeDirtyRegion(); dbgPlugins << "Timeout paint dirty region:" << r; currentNode()->setDirty(r); } }
void KisToolDyna::initPaint(KoPointerEvent *e) { m_rate = currentPaintOpPreset()->settings()->rate(); QRectF imageSize = QRectF(QPointF(0.0,0.0),currentImage()->size()); QRectF documentSize = currentImage()->pixelToDocument(imageSize); m_surfaceWidth = documentSize.width(); m_surfaceHeight = documentSize.height(); setMousePosition(e->point); m_mouse.init(m_mousePos.x(), m_mousePos.y()); KisToolFreehand::initPaint(e); if (!m_painter) { warnKrita << "Didn't create a painter! Something is wrong!"; return; } if (currentPaintOpPreset()->settings()->isAirbrushing()) { m_timer->start(m_rate); } }
void KisToolPolylineBase::paint(QPainter& gc, const KoViewConverter &converter) { Q_UNUSED(converter); if (!canvas() || !currentImage()) return; QPointF start, end; QPointF startPos; QPointF endPos; QPainterPath path; if (m_dragging && !m_points.empty()) { startPos = pixelToView(m_dragStart); endPos = pixelToView(m_dragEnd); path.moveTo(startPos); path.lineTo(endPos); } for (vQPointF::iterator it = m_points.begin(); it != m_points.end(); ++it) { if (it == m_points.begin()) { start = (*it); } else { end = (*it); startPos = pixelToView(start); endPos = pixelToView(end); path.moveTo(startPos); path.lineTo(endPos); start = end; } } if (m_closeSnappingActivated) { QPointF basePoint = pixelToView(m_points.first()); path.addEllipse(basePoint, SNAPPING_HANDLE_RADIUS, SNAPPING_HANDLE_RADIUS); } paintToolOutline(&gc, path); KisToolPaint::paint(gc,converter); }
void MainWindow::updateImage() { sensor_msgs::Image msg = qnode.image; QImage currentImage(&(msg.data[0]), msg.width, msg.height, QImage::Format_RGB888); // change bgr to rgb image ui.image_show->setPixmap(QPixmap::fromImage(currentImage.rgbSwapped())); }
void Canvas::slotModified() { d->canvasItem->setImage(currentImage()); emit signalChanged(); }
void MainWindow::on_actionText_format_triggered() { if(currentImage()) currentImage()->saveFile(PNM::ASCII); }
void MainWindow::on_actionBinary_format_triggered() { if(currentImage()) currentImage()->saveFile(PNM::Binary); }
STHDRImage* recover_hdr(vector<Photo>& photos, CameraResponse& response) { int width,height; STImage *tmpImage = new STImage(photos[0].filename); width = tmpImage->GetWidth(); height = tmpImage->GetHeight(); delete tmpImage; STHDRImage *newImage = new STHDRImage(width,height); vector< vector<STColor3f> > Ls; vector< vector<STColor3f> > ws; vector< vector<STColor3f> > Lw; for (int i=0;i<width;i++) { vector<STColor3f> row; for (int j=0;j<height;j++) { STColor3f zero(0); row.push_back(zero); } Ls.push_back(row); ws.push_back(row); Lw.push_back(row); } for (int k=0;k<photos.size();k++) { //open photo STImage currentImage(photos[k].filename); //perform calculations for (int i=0;i<width;i++) { for (int j=0;j<height;j++) { STColor4ub currentPixel = currentImage.GetPixel(i, j); Ls[i][j].r += (response.Weight(currentPixel).r * (response.GetExposure(currentPixel).r - logf(photos[k].shutter) ) ); Ls[i][j].g += (response.Weight(currentPixel).g * (response.GetExposure(currentPixel).g - logf(photos[k].shutter) ) ); Ls[i][j].b += (response.Weight(currentPixel).b * (response.GetExposure(currentPixel).b - logf(photos[k].shutter) ) ); ws[i][j] += response.Weight(currentPixel); } } for (int i=0;i<width;i++) { for (int j=0;j<height;j++) { Lw[i][j].r = expf(Ls[i][j].r / ws[i][j].r); Lw[i][j].g = expf(Ls[i][j].g / ws[i][j].g); Lw[i][j].b = expf(Ls[i][j].b / ws[i][j].b); newImage->SetPixel(i, j, Lw[i][j]); } } } return newImage; }