PxSubImage

Gamma/Photon: Using Gamma™ with the Photon microGUIŽ, Version 4.0
Prev |  | Next

# `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 `gamma_ph_`#`_examples_1_QNX4.tgz` file available on the Cogent Web Site.

    #!/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

Prev | Home | Next
`PxReduceImage` | Up | `PxThresholdImage`

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.