Graphics

GTARGET DrawingTargetPage

Specifying the graphic drawing target page

Argument

DrawingTargetPage

0 to 5 GRP0 to GRP5

Example

GTARGET 0

GTARGET()

Get the current graphics drawing target page

Return Value

Drawing target page

Example

WP=GTARGET()

GCOLOR ColorCode

Specify graphic drawing color

Argument

ColorCode

・The color is expressed as an 8-digit hexadecimal number.
・Specify 2 digits each A, R, G and B like &HAARRGGBB.
・Specify 0 to 255 (&H00 to &HFF): A for transparency, R for red, G for green, and B for blue.
・A (transparency) of 0 is completely transparent and 255 is completely opaque.
・It can be specified easily using RGB functions or color constants starting with #C_.

Example

GCOLOR &HFF0A141E
GCOLOR RGB(255,10,20,30)
GCOLOR #C_BLUE

GCOLOR()

Get graphics drawing color

Return Value

Graphic drawing color

Example

C = GCOLOR()

RGB(R,G,B)
RGB(A,R,G,B)

Calculate color code from RGB values

Arguments

A

Transparency: 0 to 255
・255 is the default.

R,G,B

Color elements: R, G, B each 0 to 255

・Color examples

Black RGB(0,0,0)
White RGB(255,255,255)
Light Gray RGB(224,224,224)
Gray RGB(128,128,128)
Dark Gray RGB(64,64,64)
Red RGB(255,0,0)
Pink RGB(255,96,208)
Purple RGB(160,32,255)
Light Blue RGB(80,208,255)
Blue RGB(0,32,255)
Yellow Green RGB(96,255,128)
Green RGB(0,192,0)
Yellow RGB(255,224,32)
Orange RGB(255,160,16)
Brown RGB(160,128,96)
Light Red RGB(255,208,160)

Return Value

Color code calculated from the argument

Example

C1=RGB(0,100,200)
C2=RGB(128,0,100,200)

RGB(ColorCode,[A],[R],[G],[B])

Replace each component of the color code

Arguments

ColorCode

Replacement source color code

A,R,G,B

Replace color component
・Specify a value between 0 and 255.
・If each one is not specified, the corresponding component of the replacement source color code is used as it is.

Return Value

Color code calculated from the argument

Example

C1=RGB(#C_RED, 127,,,) 'Translucent red
C2=RGB(#C_BLUE,,255,,) 'Purple

RGB ColorCode OUT R,G,B
RGB ColorCode OUT A,R,G,B

Get RGB components from color code

Argument

ColorCode

ARGB 8-bit color code

・See GCOLOR for a description of color codes.

Return Value

A

Variable that receives the transparency information of the specified color code

・Returns a value between 0 and 255.

R,G,B

Variable that receives the color component information of the specified color code

・Returns values between 0 and 255 respectively.

Example

RGB C OUT R,G,B

RGBF(R,G,B)
RGBF(A,R,G,B)

Calculate color code from floating point RGB values

Arguments

A

Transparency: 0 to 1.0

・1.0 is the default.

R,G,B

Color elements: R, G, B each 0 to 1.0

Return Value

Color code calculated from the argument

RGBF(ColorCode,[A],[R],[G],[B])

Replace each component of the color code

Arguments

ColorCode

Replacement source color code

A,R,G,B

Replace color component

・Specify a value between 0 and 1.0.
・If each one is not specified, the corresponding component of the replacement source color code is used as it is.

Return Value

Color code calculated from the argument

Example

C1=RGBF(#C_RED, 0.5,,,) 'Translucent red
C2=RGBF(#C_BLUE,,1.0,,) 'Purple

RGBF ColorCode OUT R,G,B
RGBF ColorCode OUT A,R,G,B

Get RGB components from color code (floating point version)

Argument

ColorCode

Color code to get the color component

・See GCOLOR for a description of color codes.

Return Value

A

Variable that receives the transparency information of the specified color code

・Returns a value between 0 and 1.0

R,G,B

Variable that receives the color component information of the specified color code

・Returns values between 0 and 1.0 respectively.

HSV(Hue,Saturation,Value[,Transparency])

Calculate color code from HSV value

Arguments

Hue

Color type (H): Positive value

・It is the same as the angle, and if it exceeds 360, it will be treated as the same color as 0.
・As the number increases, the color changes smoothly from red to yellow to green to blue to purple.

Saturation

Color vividness (S): 0 to 255

・The smaller the number, the whitish.

Value

Color brightness (V): 0 to 255

・0 indicates black and 255 indicates the brightest.

Transparency

Transparency to be set in the return color code: 0 to 255

・255 is the default.

Return Value

Color code equivalent to HSV value

Example

GCLS HSV(100,100,100,100)

FOR I=0 TO 360
GPSET I,10,HSV(I,255,255)
NEXT

HSV ColorCode OUT Hue,Saturation,Value[,Transparency]

Convert color code to HSV value

Argument

ColorCode

Color code to convert

・See GCOLOR for a description of color codes.

Return Value

Hue

The hue of the specified color

・Returns a value between 0 and 360.

Saturation

The saturation of the specified color

・Returns a value between 0 and 255.

Value

The brightness of the specified color

・Returns a value between 0 and 255.

Transparency

Transparency of the specified color

・Returns a value between 0 and 255.

Example

HSV RGB(192,128,0) OUT H,S,V
?H,S,V

HSVF(Hue,Saturation,Value[,Transparency])

Calculate color code from HSV value (floating point version)

Arguments

Hue

Color type (H): Positive value

・Specify the color type from 0 to 1.
・As the number increases, the color changes smoothly from red to yellow to green to blue to purple.
・When it exceeds 1, it returns to the same color as 0.

Saturation

Color vividness (S): 0 to 1

・The smaller the number, the whitish.

Value

Color brightness (V): 0 to 1

・0 is black and 1 is the brightest.

Transparency

Transparency to be set in the return color code: 0 to 1

・1 is the default.

Return Value

Color code equivalent to HSV value

Example

GCLS HSVF(0.4,0.4,0.4,0.4)

FOR I=0 TO 360
GPSET I,10,HSVF(I/360,1,1)
NEXT

HSVF ColorCode OUT Hue,Saturation,Value[,Transparency]

Convert color code to HSV value (floating point version)

Argument

ColorCode

Color code to convert

・See GCOLOR for a description of color codes.

Return Value

Hue

The hue of the specified color

・Returns a value between 0 and 1.0.

Saturation

The saturation of the specified color

・Returns a value between 0 and 1.0.

Value

The brightness of the specified color

・Returns a value between 0 and 1.0.

Transparency

Transparency of specified color

・Returns a value between 0 and 1.0.

Example

HSVF RGB(192,128,0) OUT H,S,V
?H,S,V

GCLIP [StartPointX,StartPointY,EndPointX,EndPointY]

Specify the writing clipping area of the graphic page

・When the clipping area is designated, the subsequent graphic drawing commands are operated only within the designated range.
・If all arguments are not specified, the entire graphic page is specified.

Argument

StartPointX,Y

The start point coordinates of the clipping area (both X and Y are 0 to 2047)

EndPointX,Y

The end point coordinates of the clipping area (both X and Y are 0 to 2047)

Example

GCLIP 100,100,200,200

GCLIP OUT StartPointX,StartPointY,EndPointX,EndPointY

Get the writing clipping area of graphic page

Return value

StartPointX,Y

The start point coordinates of the clipping region

EndPointX,Y

The end point coordinates of the clipping region

Example

GCLIP OUT LEFT,TOP,RIGHT,BOTTOM

GCLS [ColorCode]

Fill the graphic page with the specified color

・The range to be filled is the GCLIP setting range.

Argument

ColorCode

Color code used for filling

・See GCOLOR for a description of color codes.
・If not specified, it is filled with 0 (transparent color).

Example

GCLS RGB(32,32,32)

GPGET(CoordinateX,CoordinateY)

Get the color of the specified coordinates on the graphic page

Argument

CoordinateX,Y

The coordinates to get the color of

・If coordinates outside the graphic page range are specified, 0 is returned.

Return Value

Pixel color code at specified coordinates

・See GCOLOR for a description of color codes.

Example

C=GPGET(100,100)

GPSET CoordinateX,CoordinateY[,ColorCode[,DrawingMethod]]

Dots on the graphic page

Arguments

CoordinateX,Y

Coordinates to hit the point

ColorCode

Point color to draw

・See GCOLOR for a description of color codes.
・If not specified, the color set in GCOLOR is used.

DrawingMethod

0 Simple Drawing #G_NORMAL
1 Simple Drawing when transparency is not 0 #G_NORMAL2
2 Translucent Drawing #G_ALPHA
3 Translucent Drawing considering transparency of drawing destination #G_ALPHA2
4 Addition Drawing #G_ADD

・0 is the default.

Example

GPSET 100,50

GLINE StartPointX,StartPointY,EndPointX,EndPointY[,ColorCode[,DrawingMethod]]

Draw a straight line on the graphic page

Arguments

StartPointX,Y

Start point coordinates

EndPointX,Y

End point coordinates

ColorCode

Line color to draw

・See GCOLOR for a description of color codes.
・If not specified, the color set in GCOLOR is used.

DrawingMethod

0 Simple Drawing #G_NORMAL
1 Simple Drawing when transparency is not 0 #G_NORMAL2
2 Translucent Drawing #G_ALPHA
3 Translucent Drawing considering transparency of drawing destination #G_ALPHA2
4 Addition Drawing #G_ADD

・0 is the default.

Example

GLINE 0,0,399,239,RGB(0,255,255)

GCIRCLE CenterPointX,CenterPointY,Radius[,ColorCode [,DrawingMethod]]

Draw a circle on the graphic page

Arguments

CenterPointX,Y

Center point coordinates

Radius

Circle radius (dot) 1 ~

ColorCode

Circle color to draw

・See GCOLOR for a description of color codes.
・If not specified, the color set in GCOLOR is used.

DrawingMethod

0 Simple Drawing #G_NORMAL
1 Simple Drawing when transparency is not 0 #G_NORMAL2
2 Translucent Drawing #G_ALPHA
3 Translucent Drawing considering transparency of drawing destination #G_ALPHA2
4 Addition Drawing #G_ADD

・0 is the default.

Example

GCIRCLE 200,120,30

GCIRCLE CenterPointX,CenterPointY,Radius,StartAngle,EndAngle,Flag[,ColorCode [,DrawingMethod]]

Draw an arc on the graphic page

Arguments

CenterPointX,Y

Center point coordinates

Radius

Circle radius (dot) 1 ~

StartAngle,EndAngle

Start angle and end angle of an arc

・The direction of the clock at 3 o'clock is 0 degree, and the angle advances clockwise.
・Values other than 0 to 360 are fixed to values within 0 to 360. For example, -20 has the same meaning as 340.

Flag

0 Arc
1 Fan

ColorCode

Arc color to draw

・See GCOLOR for a description of color codes.
・If not specified, the color set in GCOLOR is used.

DrawingMethod

0 Simple Drawing #G_NORMAL
1 Simple Drawing when transparency is not 0 #G_NORMAL2
2 Translucent Drawing #G_ALPHA
3 Translucent Drawing considering transparency of drawing destination #G_ALPHA2
4 Addition Drawing #G_ADD

・0 is the default.

Example

GCIRCLE 200,120,30,0,45,1

GBOX StartPointX,StartPointY,EndPointX,EndPointY[,ColorCode[,DrawingMethod]]

Draw a rectangle on the graphic page

Arguments

StartPointX,Y

Start point coordinates

EndPointX,Y

End point coordinates

Color code

Rectangle color to draw

・See GCOLOR for a description of color codes.
・If not specified, the color set in GCOLOR is used.

DrawingMethod

0 Simple Drawing #G_NORMAL
1 Simple Drawing when transparency is not 0 #G_NORMAL2
2 Translucent Drawing #G_ALPHA
3 Translucent Drawing considering transparency of drawing destination #G_ALPHA2
4 Addition Drawing #G_ADD

・0 is the default.

Example

GBOX 0,0,399,239

GFILL StartPointX,StartPointY,EndPointX,EndPointY[,ColorCode[,DrawingMethod]]

Draw a rectangle on the graphic page and fill it

Argument

StartPointX,Y

Start point coordinates

EndPointX,Y

End point coordinates

ColorCode

Rectangle color to draw

・See GCOLOR for a description of color codes.
・If not specified, the color set in GCOLOR is used.

DrawingMethod

0 Simple Drawing #G_NORMAL
1 Simple Drawing when transparency is not 0 #G_NORMAL2
2 Translucent Drawing #G_ALPHA
3 Translucent Drawing considering transparency of drawing destination #G_ALPHA2
4 Addition Drawing #G_ADD

・0 is the default.

Example

GFILL 0,0,399,239

GPAINT StartPointX,StartPointY[,FillColor]
GPAINT StartPointX,StartPointY[,FillColor,BorderColor]

Fill the graphic page

・When the border color is not specified, the color range at the start point coordinates is painted.

Arguments

StartPointX,Y

Coordinates at which to start filling

FillColor

The color to use for the fill

・See GCOLOR for a description of color codes.
・If not specified, the color set in GCOLOR is used.

BorderColor

The color to see as the border of the fill

・If not specified, all colors that are different from the fill color are seen as boundaries.

Example

GPAINT 200,120,RGB(255,0,0),RGB(0,0,0)

GCOPY [SourcePage,]StartPointX,StartPointY,EndPointX,EndPointY,TransferDestinationX,TransferDestinationY,DrawingMethod

Copy images from other graphic pages

Arguments

SourcePage

Default Current Drawing Page
0 to 5 GRP0 to GRP5

StartPointX,Y EndPointX,Y

Start point and end point coordinates of the copy source range

TransferDestinationX,Y

Start point coordinates of the copy destination range

DrawingMethod

0 Simple Drawing #G_NORMAL
1 Simple Drawing when transparency is not 0 #G_NORMAL2
2 Translucent Drawing #G_ALPHA
3 Translucent Drawing considering transparency of drawing destination #G_ALPHA2
4 Addition Drawing #G_ADD

Example

GCOPY 0,0,0,100,100,200,100 ,1

GCOPY SourcePage,StartPointX,StartPointY,EndPointX,EndPointY,TransferDestinationX,TransferDestinationY,ColorCode,DrawingMethod

Copy images from other graphic pages

Arguments

SourcePage

Copy source graphic page: 0 to 5

StartPointX,Y EndPointX,Y

Start point and end point coordinates of the copy source range

TransferDestinationX,Y

Start point coordinates of the copy destination range

ColorCode

Color code to multiply with the source pixel

DrawingMethod

0 Simple Drawing #G_NORMAL
1 Simple Drawing when transparency is not 0 #G_NORMAL2
2 Translucent Drawing #G_ALPHA
3 Translucent Drawing considering transparency of drawing destination #G_ALPHA2
4 Addition Drawing #G_ADD

Example

GCOPY 0,0,0,100,100,200,100,#C_RED,1

GSAVE [SourcePage,][X,Y,Width,Height,]DestinationArray

Copy image to array

Arguments

SourcePage

Default Current Drawing Page
0 to 5 GRP0 to GRP5

X,Y,Width,Height

Start point X, Y coordinate, width, height of the copy source range

・If not specified, the current clipping area is used.

DestinationArray

Array variable that stores the image

・If there are not enough elements in the array, it is automatically added only to the 1D array.

Example

DIM WORK[0]
GSAVE 0,0,0,512,512,WORK

GLOAD [X,Y,Width,Height,]ImageArray,DrawingMethod
GLOAD [X,Y,Width,Height,]ImageArray,ColorCode,DrawingMethod

Copy image data from array to graphic page

Arguments

X,Y,Width,Height

Start point X, Y coordinate, width, height of the copy destination range

・If not specified, the current clipping area is used.

ImageArray

Numeric array that stores image data by GSAVE

ColorCode

Color code to multiply the image data in the image array

・If not specified, the image array is used as it is.

DrawingMethod

0 Simple Drawing #G_NORMAL
1 Simple Drawing when transparency is not 0 #G_NORMAL2
2 Translucent Drawing #G_ALPHA
3 Translucent Drawing considering transparency of drawing destination #G_ALPHA2
4 Addition Drawing #G_ADD

Example

GLOAD 0,0,512,512,WORK,0
GLOAD WORK,#C_RED,0

GLOAD [X,Y,Width,Height,]IndexImageArray,PaletteArray,DrawingMethod
GLOAD [X,Y,Width,Height,]IndexImageArray,PaletteArray,ColorCode,DrawingMethod

Copy image data to graphic page while converting color from index image array

Arguments

X,Y,Width,Height

Start point X, Y coordinate, width, height (dot) of the copy destination range

・If not specified, the current clipping area is used.

IndexImageArray

Numeric array containing images stored in indexed image format

PalletArray

Numeric array containing palette data

・The palette data is a numerical array having more elements than the maximum number used in the index image, and each element contains a color code corresponding to the numerical value in the index image.

ColorCode

Color code to multiply the image data in the image array

・If not specified, the image array is used as it is.

DrawingMethod

0 Simple Drawing #G_NORMAL
1 Simple Drawing when transparency is not 0 #G_NORMAL2
2 Translucent Drawing #G_ALPHA
3 Translucent Drawing considering transparency of drawing destination #G_ALPHA2
4 Addition Drawing #G_ADD

Example

GLOAD 0,0,512,512,WORK,PALETTE,0
GLOAD WORK,PALETTE,#C_BLUE,1

GTRI X1,Y1,X2,Y2,X3,Y3[,ColorCode[,DrawingMethod]]

Draw a triangle on the graphic page and fill it

Arguments

X1,Y1

Vertex 1

X2,Y2

Vertex 2

X3,Y3

Vertex 3

ColorCode

Triangle color to draw

・See GCOLOR for a description of color codes.
・If not specified, the color set in GCOLOR is used.

DrawingMethod

0 Simple Drawing #G_NORMAL
1 Simple Drawing when transparency is not 0 #G_NORMAL2
2 Translucent Drawing #G_ALPHA
3 Translucent Drawing considering transparency of drawing destination #G_ALPHA2
4 Addition Drawing #G_ADD

・0 is the default.

Example

GTRI 200,10,300,200,100,200

GPUTCHR X,Y,"String"[,FontType[,ColorCode[,DrawingMethod]]]
GPUTCHR X,Y,"String",FontType,ScaleX,ScaleY,ColorCode[,DrawingMethod]

Draw characters on the graphic page

Arguments

X,Y

Display coordinates

String

The string to display
・If an Int is specified instead of a string, the value is treated as a character code and calculates the drawing width for one character of the specified code.

FontType

The type of font to reference: 8 or 16 can be specified.

・16 is the default.

ScaleX,Y

Display magnification: 1 to 32767

・If not specified, 1,1 (the same size) is specified.

ColorCode

Text color to draw

・See GCOLOR for a description of color codes.
・If not specified, the color set in GCOLOR is used.

DrawingMethod

0 Simple Drawing #G_NORMAL
1 Simple Drawing when transparency is not 0 #G_NORMAL2
2 Translucent Drawing #G_ALPHA
3 Translucent Drawing considering transparency of drawing destination #G_ALPHA2
4 Addition Drawing #G_ADD

・0 is the default.

Example

GPUTCHR 10,10,"ABC" 
GPUTCHR 20,20,&H60

GPUTCHRP X,Y,"String"[,FontType[,ColorCode[,DrawingMethod]]]
GPUTCHRP X,Y,"String",FontType,ScaleX,ScaleY,ColorCode[,DrawingMethod[,CharacterSpacing]]

Draw proportional characters on graphic pages

Arguments

X,Y

Display coordinates

String

The string to display
・If an Int is specified instead of a string, the value is treated as a character code and calculates the drawing width for one character of the specified code.

FontType

The type of font to reference: 8 or 16 can be specified.

・16 is the default.

ScaleX,Y

Display magnification: 1 to 32767

・If not specified, 1,1 (the same size) is specified.

ColorCode

Text color to draw

・See GCOLOR for a description of color codes.
・If not specified, the color set in GCOLOR is used.

DrawingMethod

0 Simple Drawing #G_NORMAL
1 Simple Drawing when transparency is not 0 #G_NORMAL2
2 Translucent Drawing #G_ALPHA
3 Translucent Drawing considering transparency of drawing destination #G_ALPHA2
4 Addition Drawing #G_ADD

・1 is the default.

CharacterSpacing

Space between characters (in pixels): 0 to 64
・If not specified, it's 1.

Example

GPUTCHRP 10,10,"ABC" 
GPUTCHRP 10,10,&H55

GPUTCHRP("String"[,FontType[,ScaleX[,CharacterSpacing]]])

Calculate the drawing width when drawing a string with GPUTCHRP

Arguments

String

The string to calculate the display width
・If an Int is specified instead of a string, the value is treated as a character code and calculates the drawing width for one character of the specified code.

FontType

The type of font to reference: 8 or 16 can be specified.

・16 is the default.

ScaleX

Display magnification: 1 to 32767

・If not specified, 1 (the same size) is specified.

CharacterSpacing

Space between characters (in pixels): 0 to 64
・If not specified, it's 1.

Return Value

The drawing width (pixels) when drawing with GPUTCHRP

Example

W=GPUTCHRP("ABC")
W2=GPUTCHRP(&H55,16,1,2)

GARRAY(GraphicPage)

Get an Int array representing the contents of a graphic page

・Graphic pages can be directly read and written as an Int type 2D array.
・Use GUPDATE to reflect the written results.

Argument

GraphicPage

・Specify the target page to get the array.

0 to 5 GRP0 to GRP5

Return Value

An Int type 2D array representing the contents of the target page.

Example

G=GARRAY(0)
G[0,0]=#C_WHITE
PRINT HEX$(G[100,100])

GUPDATE GraphicPage[,StartPointX,StartPointY,EndPointX,EndPointY]

Reflect the contents written by GARRAY in the display

・Since normal graphic drawing commands internally perform processing equivalent to GUPDATE, so using GUPDATE after executing drawing commands has no effect.
・Even if you don't use GUPDATE, it will be reflected automatically if you write with other drawing commands near the writing coordinates.

Arguments

GraphicPage

Graphic page to reflect

0 to 5 GRP0 to GRP5

StartPointX,StartPointY,EndPointX,EndPointY

Start and end coordinates of the rectangular area to be reflected (each 0 to 2047)

・Coordinate specification is handled as clue information, and the part that is outside the region may be updated.

Example

G=GARRAY(0)
G[0,0]=#C_WHITE
GUPDATE 0

GSAMPLE GraphicPage,SamplingType

Set the sampling method for graphic pages

・Sampling refers to determining which coordinates on the graphic page are referenced from the UV coordinates when referring to the color from the graphic page on a sprite or text screen.
・It cannot be changed to sprite units, text screen units, or layer units.

Arguments

GraphicPage

Graphic page to set: 0 to 5

SamplingType

0 Border (UV coordinates other than 0 to 2047 are transparent)
1 Repeat (treats the graphic page as if it was repeated outside 0-2047)

GSAMPLE(GraphicPage)

Get sampling method of graphic page

Argument

GraphicPage

Graphic page to retrieve settings: 0 to 5

Return Value

Currently set sampling type