PxSubImage

PxSubImage — returns a sub-image of a passed image.

Syntax

PxSubImage (image, x, y, width, height)

		

Arguments

image

An image as a buffer.

x

The starting x coordinate.

y

The starting y coordinate.

width

The width (in pixels) of the sub-image to take.

height

The height (in pixels) of the sub-image to take.

Returns

A buffer containing the sub-image.

Description

This function returns a sub-image of the image starting at pixel coordinate (x,y) and of the passed width and height.

Example

This example, ex_PxSubImage.g, is included in the product distribution.

#!/usr/cogent/bin/phgamma

require_lisp("PhotonWidgets.lsp");
require_lisp("PhabTemplate.lsp");
PtInit(nil);

win = new(PtWindow);

pic = PxLoadImage("smiley.bmp");

lab = new(PtLabel);
lab.label_type = Pt_IMAGE;
lab.label_data = pic;

lab2 = new(PtLabel);
lab2.SetArea(120,0,100,100);
lab2.label_type = Pt_IMAGE;
lab2.label_data = PxSubImage(pic,50,20,30,60);

PtRealizeWidget(win);
PtMainLoop();

See Also

PxLoadImage, PxReduceImage