PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

CGapiSurface::DrawLine doesn't clip?

I wanted to use DrawLine to draw lines between vertices in my simple polygons. However, the polygons may be partly offscreen.

I thought that they would just clip off screen. However, I find that if either end point of the line is off screen, the line does not draw at all.

How can I get clipping behaviour?
mlepage · 25 May 2003, 06:07 UTC — Clipping a Line
Don't worry, I know how to clip a line like I want, I have the Foley graphics book right beside me.

I just want to know if the library provides this functionality before I write my own line drawing functions that clip.
Hi,

GapiDraw does not clip anything. You have to this manually. This is by design and will not change in future versions of the library.
mlepage · 26 May 2003, 17:51 UTC — Cohen-Sutherland Clipping Algorithm
OK thanks, just wanted to be sure.

I have the Foley book, Computer Graphics Principles and Practice (Second Edition in C), it is the best.

The Cohen-Sutherland Line Clipping Algorithm is right there in section 3.12.3.