Skip to content

Viewport

Narta Xaymar Dirks edited this page Oct 28, 2026 · 5 revisions

Blitz3DBlitzPlusBlitzBasic

Viewport

Viewport:Void x:Int32, y:Int32, width:Int32, height:Int32
Parameter Mode Type Default Description
x In Int32 required Horizontal position of the left side of the viewport.
y In Int32 required Vertical position of the top of the viewport.
width In Int32 required Width in pixels.
height In Int32 required Height in pixels.

Description

Limits all drawing to a part of the buffer. Anything outside it is cut off, and Cls only clears the inside. The part that sticks out of the buffer is cut off as well. Call Viewport 0, 0, GraphicsWidth(), GraphicsHeight() to reset it.

Examples

Graphics 320, 240, 0, 2
SetBuffer BackBuffer()
Cls
Color 60, 60, 60
Rect 0, 0, 320, 240, 1
Viewport 60, 60, 200, 120
Color 255, 120, 0
Oval 0, 0, 320, 240, 1
Flip
WaitKey

Media

Viewport

Related Commands

Rect, ScanLine

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally