Exemplo n.º 1
0
void
VectorPath::ApplyTransform(const Transformable& transform)
{
	if (transform.IsIdentity())
		return;

	for (int32 i = 0; i < fPointCount; i++) {
		transform.Transform(&(fPath[i].point));
		transform.Transform(&(fPath[i].point_out));
		transform.Transform(&(fPath[i].point_in));
	}

	_NotifyPathChanged();
}
Exemplo n.º 2
0
// DrawString
BRect
Painter::DrawString(const char* utf8String, uint32 length,
					BPoint baseLine, const escapement_delta* delta)
{
	BRect bounds(0.0, 0.0, -1.0, -1.0);
	fPatternHandler->SetPattern(B_SOLID_HIGH);

	if (fBuffer) {

		Transformable transform;
		transform.ShearBy(B_ORIGIN, (90.0 - fFont.Shear()) * PI / 180.0, 0.0);
		transform.RotateBy(B_ORIGIN, -fFont.Rotation() * PI / 180.0);
		transform.TranslateBy(baseLine);
		transform.ScaleBy(B_ORIGIN, fScale, fScale);
		transform.TranslateBy(fOrigin);

		BRect clippingFrame;
		if (fClippingRegion)
			clippingFrame = _Transform(fClippingRegion->Frame());

		bounds = fTextRenderer->RenderString(utf8String,
											 length,
											 fFontRendererSolid,
											 fFontRendererBin,
											 transform,
											 clippingFrame,
											 false,
											 &fPenLocation);
		// pen location is not transformed in quite the same way,
		// or transformations would add up
		transform.Reset();
		transform.RotateBy(B_ORIGIN, -fFont.Rotation());
		transform.TranslateBy(baseLine);
		transform.Transform(&fPenLocation);
	}
	return _Clipped(bounds);
}