예제 #1
0
/**
 * 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);
}
예제 #2
0
/**
 * @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)
                      )
                     );
}