9.16 Picture object

Description

You can get/set the properties of a picture with the Picture object. Additionally you can edit its content. The Picture object requires an index to specify which picture is responded. This index is the picture id.

List of methods/properties

NameTypeShort description
XPropertyThe x coordinate of the picture
YPropertyThe y coordinate of the picture
WidthPropertyThe width of the picture
HeightPropertyThe height of the picture
MagnificationPropertyThe magnification of the picture
TransparencyPropertyThe transparency of the picture
RedPropertyThe red coloration of the picture
GreenPropertyThe green coloration of the picture
BluePropertyThe blue coloration of the picture
ChromaPropertyThe chroma of the picture
ActionPropertyThe action of the picture
ActionStrengthPropertyThe action strength of the picture
ActionValuePropertyThe current action value of the picture
MapMovePropertyThe move with map property of the picture
MapXPropertyThe relative x coordinate of the picture on the map
MapYPropertyThe relative y coordinate of the picture on the map
PixelPropertyA pixel of the picture at a specific position
PalettePropertyA specified palette entry
UseMaskColorPropertyThe "use mask color" property of the picture
DrawLineMethodDraws a line into the picture
FillRectMethodDraws a filles rectangular into the picture
CopyRectMethodCopies a rectangular from one picture into an other
BltRectMethodCopies a rectangular from on picture into an other an skips a specific color
FlushPaletteMethodApplies changes of the palette

X

Description

This is the current x coordinate of the picture (in pixel). The RPG-Maker 2000 relates this coordinate to the center of the picture. If this value is too huge then the RPG_RT could crash. A more specific description can be found at the known bugs.

Syntax

1
Picture[Index].X

Data type

Double

Type

Property

Example

1
2
$
f[1] = Picture[1].X
At the end f[1] whould contain the x coordinate of the first picture (e. g. at the position 160:120 this whould be 160).

Y

Description

This is the current y coordinate of the picture (in pixel). The RPG-Maker 2000 relates this coordinate to the center of the picture. If this value is too huge then the RPG_RT could crash. A more specific description can be found at the known bugs.

Syntax

1
Picture[Index].Y

Data type

Double

Type

Property

Example

1
2
$
f[1] = Picture[1].Y
At the end f[1] whould contain the y coordinate of the first picture (e. g. at the position 160:120 this whould be 120).

Width

Description

This is the width of the picture.

Syntax

1
Picture[Index].Width

Data type

Dword

Type

Property, read-only

Example

1
2
$
v[1] = Picture[1].Width

Height

Description

This is the height of the picture.

Syntax

1
Picture[Index].Height

Data type

Dword

Type

Property, read-only

Example

1
2
$
v[1] = Picture[1].Height

Magnification

Description

This is the magnification of the picture. This value is in percent (e. g. 100 equals to 100% what whould be the normal size). This value should be in the range of 1 to 2000.

Syntax

1
Picture[Index].Magnification

Data type

Dword

Type

Property

Example

1
2
$
v[1] = Picture[1].Magnification

Transparency

Description

This is the transparency of the picture. This value is in percent (e. g. 0 means that the picture is not transparent). This value should be in the range of 0 to 100.

Syntax

1
Picture[Index].Transparency

Data type

Dword

Type

Property

Example

1
2
$
v[1] = Picture[1].Transparency

Red

Description

This is the red coloration of the picture. This value is in percent (e. g. 100 is the default view). This value should be in the range of 0 to 200.

Syntax

1
Picture[Index].Red

Data type

Dword

Type

Property

Example

1
2
$
v[1] = Picture[1].Red

Green

Description

This is the green coloration of the picture. This value is in percent (e. g. 100 is the default view). This value should be in the range of 0 to 200.

Syntax

1
Picture[Index].Green

Data type

Dword

Type

Property

Example

1
2
$
v[1] = Picture[1].Green

Blue

Description

This is the blue coloration of the picture. This value is in percent (e. g. 100 is the default view). This value should be in the range of 0 to 200.

Syntax

1
Picture[Index].Blue

Data type

Dword

Type

Property

Example

1
2
$
v[1] = Picture[1].Blue

Chroma

Description

This is the chrominance of the picture. This value is in percent (e. g. 100 is the default view). This value should be in the range of 0 to 200.

Syntax

1
Picture[Index].Chroma

Data type

Dword

Type

Property

Example

1
2
$
v[1] = Picture[1].Chroma

Action

Description

This is the action of the picture. You can use the action constants for this.

Syntax

1
Picture[Index].Action

Data type

Dword

Type

Property

Range

0 to 2

Example

1
2
$
v[1] = Picture[1].Action

ActionStrength

Description

This is the action strength of the value of the picture.

Syntax

1
Picture[Index].ActionStrength

Data type

Dword

Type

Property

Range

-10 to 10

Example

1
2
$
v[1] = Picture[1].ActionStrength

ActionValue

Description

This is the current action value of the picture.

Syntax

1
Picture[Index].ActionValue

Data type

Double

Type

Property

Example

1
2
$
f[1] = Picture[1].ActionValue
At the end f[1] whould contain the action value (if the action whould be rotation then this whould be the angle in RPG format) of the first picture.

MapMove

Description

If this property is true then the move with map property of the picture is used.

Syntax

1
Picture[Index].MapMove

Data type

Switch

Type

Property

Example

1
2
$
Picture[1].MapMove = True
At the end the move with map property of the first picture whould be activated (the picture whould scroll with the map).

MapX

Description

This is x coordinate used in the show picture command for pictures with activated move with map option.

Syntax

1
Picture[Index].MapX

Data type

Double

Type

Property

Example

1
2
$
f[1] = Picture[1].MapX

MapY

Description

This is the y coordinate used in the show picture command for pictures with activated move with map option.

Syntax

1
Picture[Index].MapY

Data type

Double

Type

Property

Example

1
2
$
f[1] = Picture[1].MapY

Pixel

Description

You cann access pixels with this property. This property requires a two dimensional index. The first value is the x coordinate and the second value is the y coordinate. The first pixel is at [0, 0] and the last pixel is at [width - 1, height - 1]. The boundaries may not be exceeded. The value of a pixel is the index of the used palette entry (0 to 255).

Syntax

1
Picture[Index].Pixel[X, Y]

Data type

Byte

Type

Property

Example

1
2
$
v[1] = Picture[1].Pixel[0, 0]
At the end v[1] whould be the index of the palette entry used for the pixel in the upper left corner of the first picture.

Palette

Description

You can access the color values used in a picture's palette with this property. This option requires an index which responded to the palette entry in the range of 0 to 255. If you change one or more palette entries you must call FlushPalette to apply the changes.

Syntax

1
Picture[Index].Palette[Color]

Data type

Dword

Type

Property

Example

1
2
$
v[1] = Picture[1].Palette[0]
At the end v[1] whould contain the RGB color of the first palette entry of the first picture.

UseMaskColor

Description

If this property is true then the mask color will not be drawn.

Syntax

1
Picture[Index].UseMaskColor

Data type

Switch

Type

Property

Example

1
2
$
Picture[1].UseMaskColor = True
At the end the mask color of the first picture whouldn't be drawn.

DrawLine

Description

With this option you can draw a one pixel thick line. The start coordinates are X1 and Y1. The end coordinates are (these are not always reached) are X2 and Y2. The color for this line is the index for the palette entry.

Syntax

1
Picture[Index].DrawLine(X1, Y1, X2, Y2, Color)

Return value

None

Type

Method

Parameter: X1

Description

The x coordinate where the line begins.

Data type

Dword

Parameter: Y1

Description

The y coordinate where the line begins.

Data type

Dword

Parameter: X2

Description

The x coordinate where the line ends.

Data type

Dword

Parameter: Y2

Description

The y coordinate where the line ends.

Data type

Dword

Parameter: Color

Description

The used palette entry for the color of the line.

Data type

Byte

Example

1
2
$
Picture[1].DrawLine(0, 0, 24, 24, 1)
At the end there whould be a line drawn from 0, 0 to 24, 24 in the color of the second palette entry (= index 1).

FillRect

Description

You can draw a filled rectangle with this method. The start coordinates are left and top. The end coordinates (these are never reached) are right and bottom. The color for this rectangle is the index for the palette entry.

Syntax

1
Picture[Index].FillRect(Left, Top, Right, Bottom, Color)

Return value

None

Type

Method

Parameter: Left

Description

The left border of the rectangle.

Data type

Dword

Parameter: Top

Description

The upper border of the rectangle.

Data type

Dword

Parameter: Right

Description

The right border + 1 of the rectangle (= left + width).

Data type

Dword

Parameter: Bottom

Description

The lower border + 1 of the rectangle (= top + height).

Data type

Dword

Parameter: Color

Description

The used palette entry for the color of the rectangle.

Data type

Byte

Example

1
2
$
Picture[1].FillRect(0, 0, 24, 24, 1)
At the end there whould be a rectangle drawn from 0, 0 to (including) 23, 23 in the color of the second palette entry (= index 1).

CopyRect

Description

With this method you can copy a rectangular area from one picture into an other. The palette entries will not be adjusted. So if the source picture has the color red as palette entry 0 and the destination picture has the color green as palette entry 0 then all red pixels (that refer to palette entry 0) will be green in the destination picture. X and Y specify the position where the area should be drawn in the current picture. The source id must be a valid picture id of an other (!) picture. The parameters Left, Top, Right and Bottom describe the range and the coordinates of the area in the source picture.

Syntax

1
2
Picture[Index].CopyRect(X, Y,
Source-ID, Left, Top, Right, Bottom)

Return value

None

Type

Method

Parameter: X

Description

The x coordinate where the area shall be drawn to.

Data type

Dword

Parameter: Y

Description

The y coordinate where the area shall be drawn to.

Data type

Dword

Parameter: Source-ID

Description

The id of the source picture. This value may not the same as the destination picture.

Data type

Dword

Parameter: Left

Description

The left border of the area in the source picture.

Data type

Dword

Parameter: Top

Description

The upper border of the area in the source picture.

Data type

Dword

Parameter: Right

Description

The right border + 1 of the area in the source picture (= left + width).

Data type

Dword

Parameter: Bottom

Description

The lower border + 1 of the area in the source picture (= top + height).

Data type

Dword

Example

1
2
$
Picture[1].CopyRect(0, 0, 2, 0, 0, 24, 24)
At the end there whould be a rectangular area copied from the second picture to the first which is at 0, 0 and has a size of 24 x 24 pixels.

BltRect

Description

With this method you can copy a rectangular area from one picture into an other, but the specified mask color will be skipped. The palette entries will not be adjusted. So if the source picture has the color red as palette entry 0 and the destination picture has the color green as palette entry 0 then all red pixels (that refer to palette entry 0) will be green in the destination picture. X and Y specify the position where the area should be drawn in the current picture. The source id must be a valid picture id of an other (!) picture. The parameters Left, Top, Right and Bottom describe the range and the coordinates of the area in the source picture.

Syntax

1
2
Picture[Index].CopyRect(X, Y,
Source-ID, Left, Top, Right, Bottom, MaskColor)

Return value

None

Type

Method

Parameter: X

Description

The x coordinate where the area shall be drawn to.

Data type

Dword

Parameter: Y

Description

The y coordinate where the area shall be drawn to.

Data type

Dword

Parameter: Source-ID

Description

The id of the source picture. This value may not the same as the destination picture.

Data type

Dword

Parameter: Left

Description

The left border of the area in the source picture.

Data type

Dword

Parameter: Top

Description

The upper border of the area in the source picture.

Data type

Dword

Parameter: Right

Description

The right border + 1 of the area in the source picture (= left + width).

Data type

Dword

Parameter: Bottom

Description

The lower border + 1 of the area in the source picture (= top + height).

Data type

Dword

Parameter: MaskColor

Description

Specifies the palette entry whose pixels shall not be copied.

Data type

Byte

Example

1
2
$
Picture[1].BltRect(0, 0, 2, 0, 0, 24, 24, 0)
At the end there whould be a rectangular area copied from the second picture to the first skipping the color 0. The area is drawn at 0, 0 and has a size of 24 x 24 pixels.

FlushPalette

Description

With this method you can apply changes of a palette.

Syntax

1
Picture[Index].FlushPalette()

Return value

None

Type

Method

Example

1
2
3
$
Picture[1].Palette[0] = 0xFF00FF;
Picture[1].FlushPalette()
At the end the color of the first palette entry whould have been changed to magenta (Color code #FF00FF) and used to draw the picture.