void
PipelineDirectToScreenWithClipExample::run(IWindow& theWindow)
{
        EDeviceCoordinateSystem coordSystem;
        if (ICoordinateSystem::applicationOrientation() == ICoordinateSystem::originLowerLeft)
        {
                coordSystem = kRightHand;
        }
        else
        {
                coordSystem = kLeftHand;
        }

        IManagedPresSpaceHandle presSpace(&theWindow);
        IExtendedRootGrafPort rootPort(presSpace, coordSystem);

        IGArea clipArea(IGRect2D(140,100,300,300));
        ILinkedGrafPort clipPort(&rootPort, &clipArea);

        IGEllipse2D ellipse(IGRect2D(20,20,220,180));
        rootPort.draw(ellipse);

        IGPolygon2D polygon(IGRect2D(20,20,220,180));
        clipPort.draw(polygon, IFillBundle(IBaseColor::kPaleGray));
}
void
PipelineClippingExample::draw(IGrafPort& port)
{
        IGArea clipArea(IGRect2D(140,100,300,300));
        ILinkedGrafPort clipPort(&port, &clipArea);

        IGEllipse2D ellipse(IGRect2D(20,20,220,180));
        IGrafBundle bundle(kDefaultFillColor, kDefaultFrameColor);

        clipPort.draw(ellipse, bundle);
}
void ElementGeometryClipper::visitArea(const Area &area) {
  auto element = clipArea(clipper_, quadKeyBbox_, area);
  if (element!=nullptr)
    callback_(*element, quadKey_);
}