void StrokePreview::preview(const dpcore::Point& from, const dpcore::Point& to, const dpcore::Brush& brush) { Preview::preview(from, to, brush); setLine(from.x(), from.y(), to.x(), to.y()); show(); }
void CanvasView::updateOutline(const dpcore::Point& point) { if(_enableoutline && _showoutline && !_locked) { QList<QRectF> rect; rect.append(QRectF(_prevpoint.x() - _outlinesize, _prevpoint.y() - _outlinesize, _dia, _dia)); rect.append(QRectF(point.x() - _outlinesize, point.y() - _outlinesize, _dia, _dia)); updateScene(rect); } }
/** * Convert a dpcore::Point to network format. The * reverse operation for this is in statetracker.cpp * @param p * @return */ protocol::PenPoint pointToProtocol(const dpcore::Point &p) { // The two least significant bits of the coordinate // are the fractional part. // The rest is the integer part with a bias of 128 uint16_t x = (qMax(0, p.x() + 128) << 2) | (uint16_t(p.xFrac()*4) & 3); uint16_t y = (qMax(0, p.y() + 128) << 2) | (uint16_t(p.yFrac()*4) & 3); return protocol::PenPoint(x, y, p.pressure() * 255); }
void EditorView::updateOutline(const dpcore::Point& point) { if(enableoutline_ && showoutline_) { QList<QRectF> rect; rect.append(QRectF(prevpoint_.x() - outlinesize_, prevpoint_.y() - outlinesize_, dia_, dia_)); rect.append(QRectF(point.x() - outlinesize_, point.y() - outlinesize_, dia_, dia_)); updateScene(rect); } }
/** * @param point stroke coordinates to send */ void SessionState::sendStrokePoint(const dpcore::Point& point) { host_->sendPacket(protocol::StrokePoint( host_->localuser_, point.x(), point.y(), point.xFrac(), point.yFrac(), qRound(point.pressure()*255) ) ); }
void RectanglePreview::moveTo(const dpcore::Point& to) { Preview::moveTo(to); qreal x,w; if(from().x() < to.x()) { x = from().x(); w = to.x() - from().x(); } else { x = to.x(); w = from().x() - to.x(); } qreal y,h; if(from().y() < to.y()) { y = from().y(); h = to.y() - from().y(); } else { y = to.y(); h = from().y() - to.y(); } setRect(x,y,w,h); }
void RectanglePreview::preview(const dpcore::Point& from, const dpcore::Point& to, const dpcore::Brush& brush) { Preview::preview(from, to, brush); qreal x,w; if(from.x() < to.x()) { x = from.x(); w = to.x() - from.x(); } else { x = to.x(); w = from.x() - to.x(); } qreal y,h; if(from.y() < to.y()) { y = from.y(); h = to.y() - from.y(); } else { y = to.y(); h = from.y() - to.y(); } setRect(x,y,w,h); show(); }
void StrokePreview::moveTo(const dpcore::Point& to) { Preview::moveTo(to); setLine(from().x(), from().y(), to.x(), to.y()); }