示例#1
0
bool RasterRect::intersects (BoxObj& userb, Graphic* gs) {
    Transformer* t = gs->GetTransformer();
    Coord xmax = _raster->Width();
    Coord ymax = _raster->Height();
    Coord tx0, ty0, tx1, ty1;
    
    if (t != nil && t->Rotated()) {
	Coord x[4], tx[5];
	Coord y[4], ty[5];
    
	x[0] = x[3] = y[0] = y[1] = 0;
	x[2] = x[1] = xmax;
	y[2] = y[3] = ymax;
	transformList(x, y, 4, tx, ty, gs);
	tx[4] = tx[0];
	ty[4] = ty[0];
	FillPolygonObj fp (tx, ty, 5);
	return fp.Intersects(userb);
    
    } else if (t != nil) {
	t->Transform(0, 0, tx0, ty0);
	t->Transform(xmax, ymax, tx1, ty1);
	BoxObj b1 (tx0, ty0, tx1, ty1);
	return b1.Intersects(userb);

    } else {
	BoxObj b2 (0, 0, xmax, ymax);
	return b2.Intersects(userb);
    }
}
示例#2
0
boolean TextGraphic::intersects (BoxObj& userb, Graphic* gs) {
    Transformer* t = gs->GetTransformer();
    boolean intersects;
    
    if (t != nil && t->Rotated()) {
        intersects = RotatedIntersects(userb, gs);
        
    } else if (t != nil) {
        intersects = TransformedIntersects(userb, gs);

    } else {
        intersects = UntransformedIntersects(userb, gs);
    }
    return intersects;
}