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
Name | Type | Short description |
X | Property | The x coordinate of the picture |
Y | Property | The y coordinate of the picture |
Width | Property | The width of the picture |
Height | Property | The height of the picture |
Magnification | Property | The magnification of the picture |
Transparency | Property | The transparency of the picture |
Red | Property | The red coloration of the picture |
Green | Property | The green coloration of the picture |
Blue | Property | The blue coloration of the picture |
Chroma | Property | The chroma of the picture |
Action | Property | The action of the picture |
ActionStrength | Property | The action strength of the picture |
ActionValue | Property | The current action value of the picture |
MapMove | Property | The move with map property of the picture |
MapX | Property | The relative x coordinate of the picture on the map |
MapY | Property | The relative y coordinate of the picture on the map |
Pixel | Property | A pixel of the picture at a specific position |
Palette | Property | A specified palette entry |
UseMaskColor | Property | The "use mask color" property of the picture |
DrawLine | Method | Draws a line into the picture |
FillRect | Method | Draws a filles rectangular into the picture |
CopyRect | Method | Copies a rectangular from one picture into an other |
BltRect | Method | Copies a rectangular from on picture into an other an skips a specific color |
FlushPalette | Method | Applies changes of the palette |
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
Data type
Double
Type
Property
Example
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).
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
Data type
Double
Type
Property
Example
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).
Description
This is the width of the picture.
Syntax
Data type
Dword
Type
Property, read-only
Example
1
2
$
v[1] = Picture[1].Width
Description
This is the height of the picture.
Syntax
Data type
Dword
Type
Property, read-only
Example
1
2
$
v[1] = Picture[1].Height
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
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
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
Data type
Dword
Type
Property
Example
1
2
$
v[1] = Picture[1].Red
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
Data type
Dword
Type
Property
Example
1
2
$
v[1] = Picture[1].Green
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
Data type
Dword
Type
Property
Example
1
2
$
v[1] = Picture[1].Blue
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
Data type
Dword
Type
Property
Example
1
2
$
v[1] = Picture[1].Chroma
Description
Syntax
Data type
Dword
Type
Property
Range
0 to 2
Example
1
2
$
v[1] = Picture[1].Action
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
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.
Description
If this property is true then the move with map property of the picture is used.
Syntax
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).
Description
This is x coordinate used in the show picture command for pictures with activated move with map option.
Syntax
Data type
Double
Type
Property
Example
1
2
$
f[1] = Picture[1].MapX
Description
This is the y coordinate used in the show picture command for pictures with activated move with map option.
Syntax
Data type
Double
Type
Property
Example
1
2
$
f[1] = Picture[1].MapY
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.
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.
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.
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).
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).
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.
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.
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.