> SetViewPort (procedure) (Graph unit)
Час быка
Час быка
Карта Интернета
Internet Map


 SetViewPort (procedure)     (Graph unit)

Sets the current output viewport or window for graphics output


 procedure SetViewPort(x1, y1, x2, y2: Integer; Clip: Boolean);


Real, Protected


(X1, Y1) define the upper left corner of the viewport, and (X2, Y2) define the lower right corner (0 <= X1 < X2 and 0 <= Y1 < Y2). The upper left corner of a viewport is (0, 0).

The Boolean parameter Clip determines whether drawings are clipped at the current viewport boundaries. SetViewPort(0, 0, GetMaxX, GetMaxY, True) always sets the viewport to the entire graphics screen. If invalid input is passed to SetViewPort, GraphResult returns grError, and the current view settings will be unchanged.

All graphics commands (for example, GetX, OutText, Rectangle, MoveTo, and so on) are viewport-relative. In the following example, the coordinates of the dot in the middle are relative to the boundaries of the viewport.

If the Boolean parameter Clip is set to True when a call to SetViewPort is made, all drawings will be clipped to the current viewport. Note that the current pointer is never clipped. The following will not draw the complete line requested because the line will be clipped to the current viewport:

 SetViewPort(10, 10, 20, 20, ClipOn);
 Line(0, 5, 15, 5);

The line would start at absolute coordinates (10,15) and terminate at absolute coordinates (25, 15) if no clipping was performed. But because clipping was performed, the actual line that would be drawn would start at absolute coordinates (10, 15) and terminate at coordinates (20, 15).

InitGraph, GraphDefaults, and SetGraphMode all reset the viewport to the entire graphics screen. The current viewport settings are available by calling the procedure GetViewSettings, which accepts a parameter of ViewPortType.

SetViewPort moves the current pointer to (0, 0).


Must be in graphics mode.

See Also

Sample Code

 К началу страницы 
Тэги: SetViewPort

Код для вставки: :: :: :: ГОСТ ::
Поделиться: //

Хостинг предоставлен компанией "Веб Сервис Центр" при поддержке компании "ДокЛаб"