Re: ipeqt::Canvas clipping
Otfried Cheong <[email protected]>
| Newsgroups | gmane.comp.graphics.ipe.general |
|---|---|
| Organization | Ipe Headquarters |
| Message-ID | <[email protected]> |
On 11/05/2010 11:48 AM, Dmitriy Morozov wrote: > Is it possible in C++ to get ipeqt::Canvas to clip itself? I don't > want it to draw anything outside of its limits (i.e. draw only on the > white background, not on the gray global background). I can't find > anything in the documentation, but I hope I'm missing something. As far as I can tell, you are the first to want to use ipeqt::Canvas outside of Ipe. ipeqt::Canvas does not provide an option to clip the objects to the paper. You could add that easily, though, by inserting something like this at the beginning of Canvas::drawObjects(cairo_t *cc) (I haven't checked it, but this should work): const Layout *l = iCascade->findLayout(); cairo_rectangle(cc, -l->iOrigin.x, -l->iOrigin.y, l->iPaperSize.x, l->iPaperSize.y); cairo_clip(cc) I would be happy to add this to the Canvas class (with an option to turn it on or off, of course) if it fills a need and you are actually reusing ipeqt::Canvas in your code. Cheers, Otfried