Skip to main content

ImageCentered

ImageCentered (Statement)

Format

imagecentered image, x, y
imagecentered image, x, y, scale
imagecentered image, x, y, scale, radians
imagecentered image, x, y, scale, radians, opacity

Description

Draws an image held in memory onto the graphics output so that its center is at (x, y), optionally scaled, rotated, and made partly transparent. Unlike ImageDraw (which positions by the top-left corner and alters nothing), this centers the picture on the point — convenient for sprites, dials, and anything you rotate about its middle. The stored image is not changed.

  • scale — size multiplier (1.0 = original size). Defaults to 1.0.
  • radians — rotation about the center, in radians (see Radians). Defaults to 0.
  • opacity — 0.0 (invisible) to 1.0 (opaque). Defaults to 1.0.

Smoothing of the scaled/rotated result follows ImageSmooth.

Example

a = imageload("wheel.png")
for angle = 0 to 350 step 10
clg
imagecentered a, 150, 150, 1.0, radians(angle)
refresh
pause 0.05
next angle

See Also

ImageAutoCrop, ImageCentered, ImageCopy, ImageCrop, ImageDraw, ImageFlip, ImageHeight, ImageLoad, ImageNew, ImagePixel, ImageResize, ImageRotate, ImageSetPixel, ImageSmooth, ImageTransformed, ImageWidth, Unload

Availability

BASIC-256 2.0 and later. Documented from the BASIC-256 v2.1 continuation project.