[Previous] [Contents] [Index] [Next]

PtBkgd

A color-gradient, image, or bitmap background

Class hierarchy:

PtWidget --> PtBasic --> PtContainer --> PtPane --> PtBkgd

For more information, see the diagram of the widget hierarchy.

PhAB icon:

PtBkgd button in PhAB

Public header:

<photon/PtBkgd.h>

Description:

The PtBkgd widget provides various background layouts.


PtBkgd


A background image.


You can choose from the following background types:

New resources:

Resource C type Pt type Default
Pt_ARG_BKGD_BRT_FROM ushort_t Scalar 0
Pt_ARG_BKGD_BRT_TO ushort_t Scalar 255
Pt_ARG_BKGD_HUE_FROM ushort_t Scalar 0
Pt_ARG_BKGD_HUE_TO ushort_t Scalar 44000
Pt_ARG_BKGD_IMAGE PhImage_t * Alloc NULL
Pt_ARG_BKGD_MIX ushort_t Scalar 1
Pt_ARG_BKGD_ORIENTATION ushort_t Scalar Pt_BKGD_VERTICAL
Pt_ARG_BKGD_PIXCOLORS PgColor_t, short Array NULL
Pt_ARG_BKGD_PIXMAP char * Alloc NULL
Pt_ARG_BKGD_PIX_HEIGHT ushort_t Scalar 20
Pt_ARG_BKGD_PIX_WIDTH ushort_t Scalar 20
Pt_ARG_BKGD_SAT_FROM ushort_t Scalar 0
Pt_ARG_BKGD_SAT_TO ushort_t Scalar 255
Pt_ARG_BKGD_SPACING ushort_t Scalar 0
Pt_ARG_BKGD_STEPS ushort_t Scalar 10
Pt_ARG_BKGD_TILE ushort_t Scalar Pt_BKGD_GRID
Pt_ARG_BKGD_TYPE ushort_t Scalar Pt_BKGD_BRIGHTNESS

Pt_ARG_BKGD_BRT_FROM, Pt_ARG_BKGD_BRT_TO

C type Pt type Default
ushort_t Scalar 0
255

These define a brightness range using the standard HSB (hue/saturation/brightness) model. Values range from 0 to 255.


Note: The HSB model is also known as the HSV (hue/saturation/value) model. For more information, see PgHSV().

Pt_ARG_BKGD_HUE_FROM, Pt_ARG_BKGD_HUE_TO

C type Pt type Default
ushort_t Scalar 0
44000

These define a hue range using the standard HSB (hue/saturation/brightness) model. Values range from 0 to 65535. The hue determines the color background.

Pt_ARG_BKGD_IMAGE

C type Pt type Default
PhImage_t * Alloc NULL

This resource points to a PhImage_t structure that defines an image to be displayed. For more information, see PhImage_t, PgDrawImage() and PxLoadImage() in the Photon Library Reference.

Set the flags member of the PhImage_t structure to:

Ph_RELEASE_IMAGE | Ph_RELEASE_PALETTE |
Ph_RELEASE_TRANSPARENCY_MASK | Ph_RELEASE_GHOST_BITMAP
      

before providing the image to the widget. If you do this, the memory used for the image is released when the widget is unrealized or destroyed.


Note: Remember that this is an Alloc resource. When you set this resource, the widget copies the PhImage_t structure but not the data pointed to by the members of the structure. After setting this resource, you can free() the PhImage_t if you don't need it, but don't free() the members of it.

Pt_ARG_BKGD_MIX

C type Pt type Default
ushort_t Scalar 1

For the Pt_BKGD_HUE, Pt_BKGD_SATURATION, and Pt_BKGD_BRIGHTNESS background types. This resource determines whether or not color dithering is used in the gradient. By default, it's turned on.

Pt_ARG_BKGD_ORIENTATION

C type Pt type Default
ushort_t Scalar Pt_BKGD_VERTICAL

For the Pt_BKGD_HUE, Pt_BKGD_SATURATION, and Pt_BKGD_BRIGHTNESS background types. This resource sets the gradient orientation. By default the orientation is horizontal. Possible values:

Pt_ARG_BKGD_PIXCOLORS

C type Pt type Default
PgColor_t Array NULL

For the Pt_BKGD_PIXMAP background type. An array of bitmap colors that correspond to the planes defined in Pt_ARG_BKGD_PIXMAP.

Pt_ARG_BKGD_PIXMAP

C type Pt type Default
char * Alloc NULL

For the Pt_BKGD_PIXMAP background type. A sequence of planes provided in the format described in PgDrawBitmap().

Pt_ARG_BKGD_PIX_HEIGHT, Pt_ARG_BKGD_PIX_WIDTH

C type Pt type Default
ushort_t Scalar 20

For the Pt_BKGD_PIXMAP background type. These resources indicate the height and width of the bitmap in pixels.

Pt_ARG_BKGD_SAT_FROM, Pt_ARG_BKGD_SAT_TO

C type Pt type Default
ushort_t Scalar 0
255

These define a saturation range using the standard HSB (hue/saturation/brightness) model. Values range from 0 to 255. The saturation determines the amount of color to be used. A high value makes the color bright; a low one makes it look dim or gray.

Pt_ARG_BKGD_SPACING

C type Pt type Default
ushort_t Scalar 0

The spacing, in pixels, between tiles.

Pt_ARG_BKGD_STEPS

C type Pt type Default
ushort_t Scalar 10

For the Pt_BKGD_HUE, Pt_BKGD_SATURATION, and Pt_BKGD_BRIGHTNESS background types. This resource determines the number of steps used in the gradient to get from the minimum to the maximum value.

Pt_ARG_BKGD_TILE

C type Pt type Default
ushort_t Scalar Pt_BKGD_GRID

For the Pt_BKGD_PIXMAP and Pt_BKGD_IMAGE background types. This resource determines which type of tiling will be used to display the image. Possible values:

Pt_BKGD_GRID
Repeat the image in grid fashion.
Pt_BKGD_ALT
Repeat the image in alternating grid fashion.
Pt_BKGD_CENTER
Draw the image once and center it within the container.
Pt_BKGD_CENTER_GRID
Center the image within container and then, if the image is smaller than the container, tile the image around the outside.

If you set this resource to zero, tiling will be disabled and the image will be drawn once at the top-left corner.

Pt_ARG_BKGD_TYPE

C type Pt type Default
ushort_t Scalar Pt_BKGD_BRIGHTNESS

Determines which type of background will be displayed. Possible values:

Pt_BKGD_HUE
Pt_BKGD_SATURATION
Pt_BKGD_BRIGHTNESS
These types let you display color gradients. The type you choose affects how the resources are interpreted.

In general, you specify the range of values for the background type you choose and enter only the "to" value for the other resources. So, for example, if you chose Pt_BKGD_HUE, you would enter both the "to" and "from" values for Pt_BKGD_HUE but only the "to" values for Pt_BKGD_SATURATION and Pt_BKGD_BRIGHTNESS.

The smoothness of the gradient is determined by Pt_ARG_BKGD_STEPS and Pt_ARG_BKGD_MIX.

Pt_BKGD_PIXMAP
Pt_BKGD_IMAGE
These types let you display picture backgrounds.

You can use the Pt_BKGD_PIXMAP type for small pictures drawn by hand where you need the background fill color to show through. If you select this type, the widget uses the Pt_ARG_BKGD_PIXMAP resource.

You use the Pt_BKGD_IMAGE type primarily to display images imported from other sources. If you select this type, the widget uses the Pt_ARG_BKGD_IMAGE resource.

Inherited resources:

If the widget modifies an inherited resource, the "Default override" column indicates the new value. This modification affects any subclasses of the widget.

Resource Inherited from Default override
Pt_ARG_ANCHOR_FLAGS PtContainer Pt_LEFT_ANCHORED_LEFT|
Pt_RIGHT_ANCHORED_LEFT|
Pt_TOP_ANCHORED_TOP|
Pt_BOTTOM_ANCHORED_TOP
Pt_ARG_ANCHOR_OFFSETS PtContainer
Pt_ARG_AREA PtWidget
Pt_ARG_BANDWIDTH_THRESHOLD PtBasic Not used by this class.
Pt_ARG_BITMAP_CURSOR PtWidget
Pt_ARG_BORDER_WIDTH PtWidget 0
Pt_ARG_BOT_BORDER_COLOR PtBasic
Pt_ARG_COLOR PtBasic
Pt_ARG_CONTAINER_FLAGS PtContainer
Pt_ARG_CURSOR_COLOR PtWidget
Pt_ARG_CURSOR_TYPE PtWidget
Pt_ARG_DATA PtWidget
Pt_ARG_DIM PtWidget
Pt_ARG_EFLAGS PtWidget Pt_CONSUME_EVENTS
Pt_ARG_FILL_COLOR PtBasic
Pt_ARG_FILL_PATTERN PtBasic
Pt_ARG_FLAGS PtWidget
Pt_ARG_HELP_TOPIC PtWidget
Pt_ARG_HIGHLIGHT_ROUNDNESS PtBasic
Pt_ARG_MARGIN_HEIGHT PtBasic
Pt_ARG_MARGIN_WIDTH PtBasic
Pt_ARG_POS PtWidget
Pt_ARG_RESIZE_FLAGS PtWidget Pt_RESIZE_XY_AS_REQUIRED
Pt_ARG_TOP_BORDER_COLOR PtBasic
Pt_ARG_TRANS_PATTERN PtBasic
Pt_ARG_USER_DATA PtWidget
Pt_CB_ACTIVATE PtBasic
Pt_CB_ARM PtBasic
Pt_CB_BALLOONS PtContainer
Pt_CB_BLOCKED PtWidget
Pt_CB_DESTROYED PtWidget
Pt_CB_DISARM PtBasic
Pt_CB_FILTER PtContainer
Pt_CB_GOT_FOCUS PtBasic
Pt_CB_HOTKEY PtWidget
Pt_CB_LOST_FOCUS PtBasic
Pt_CB_MENU PtBasic
Pt_CB_RAW PtWidget
Pt_CB_REALIZED PtWidget
Pt_CB_REPEAT PtBasic
Pt_CB_RESIZE PtContainer
Pt_CB_UNREALIZED PtWidget

[Previous] [Contents] [Index] [Next]