Exemplo n.º 1
0
PenMove *PenMove::deserialize(uint8_t ctx, const uchar *data, uint len)
{
	if(len<10 || len%10)
		return nullptr;
	PenPointVector pp;

	int points = len/10;
	pp.reserve(points);
	while(points--) {
		pp.append(PenPoint(
			qFromBigEndian<qint32>(data),
			qFromBigEndian<qint32>(data+4),
			qFromBigEndian<quint16>(data+8)
		));
		data += 10;
	}
	return new PenMove(ctx, pp);
}
Exemplo n.º 2
0
PenMove *PenMove::deserialize(const uchar *data, uint len)
{
	if(len<11 || (len-1)%10)
		return 0;
	PenPointVector pp;

	uint8_t ctx = *(data++);

	int points = (len-1)/10;
	pp.reserve(points);
	while(points--) {
		pp.append(PenPoint(
			qFromBigEndian<qint32>(data),
			qFromBigEndian<qint32>(data+4),
			qFromBigEndian<quint16>(data+8)
		));
		data += 10;
	}
	return new PenMove(ctx, pp);
}
Exemplo n.º 3
0
PenMove *PenMove::deserialize(const uchar *data, uint len)
{
	if(len<6)
		return 0;
	uint8_t id = *data;
	PenPointVector pp;

	const int points = (len-1)/5;
	pp.reserve(points);
	++data;
	for(int i=0;i<points;++i) {
		pp.append(PenPoint(
			qFromBigEndian<quint16>(data),
			qFromBigEndian<quint16>(data+2),
			*(data+4)
		));
		data += 5;
	}
	return new PenMove(id, pp);
}