SCREEN


 [Features] Display of each screen is designated by 0 or 1.

 [Format] SCREEN [T],[G],[S],[B]

 [Explanation]
    The omitted will keep the previous values.
    This Basic has the following four kinds of screens.
     T - Text screen.
     G - Graphic screen.
     S - Sprite screen.
     B - Back ground Graphics screen.
    In addition, it has a graphic buffer(Undisplayed) used by Sprite and BG Graphics.
    The size of the graphics buffer is the same size as the screen in the initial state.

    (Initial state) screen 1,1,1,0

 [e.g.]
   screen 1,1,0,0 :'Text & Graphic



  PRIORITY


 [Features] The priority displayed each screen is determined.

 [Format] PRIORITY "TGSB"

 [Explanation]
    Sequence of "TGSB" is rearranged from what has a high priority. (priority: left side)
    T - Text screen.
    G - Graphic screen.
    S - Sprite screen.
    B - Back ground Graphics screen.

 [e.g.]
  priority "TSG" :'Priorities Text>Sprite>Graphic



  PSET


 [Features] A point is drawn on graphic screen (x,y) in specified 'color'.

 [Format] PSET(x,y) [,color]

 [Explanation]
    Color code range:(-2147483648~2147483647)
    Colorcode=0 is the transparent color(Black).

 [e.g.]
  pset(100,100),rgb(20,20,200)



  LINE


 [Features] A line is drawn on graphic screen (x1,y1)-(x2,y2) in specified 'color'.

 [Format] LINE(x1,y1)-(x2,y2) [,color] [,|b or bf|]

 [Explanation]
    If 'b' is specified, A box is drawn.
    If 'bf' is specified, A filled box is drawn.

 [e.g.]
  line(50,50)-(200,400),hsv(160,25,80),b


  CIRCLE


 [Features] A circle of the 'radius' is drawn on graphic screen in the center(x,y), specified 'color'.

 [Format] CIRCLE(x,y) ,radius [,color]

 [Explanation]

 [e.g.]
  circle(100,100),80,col(5)



  OVAL


 [Features] An oval is drawn in a graphic screen.

 [Format] OVAL x,y,x2,y2 [,color] [,f]

 [Explanation]
    An oval is drawn in a graphic screen,
     in the range(x,y)(x2,y2), specified 'color'.
    When switch 'f' is specified, the oval inside is filled in the color.

 [e.g.]
     oval 100,100,400,250



  PAINT


 [Features] To paint-out in specified 'color' from the coordinates(x,y).

 [Format] PAINT(x,y) [,color] [,boundary]

 [Explanation]
    If 'boundary'color is specified, be clipped in the color.
    When omitted, be clipped in colors other than the (x,y) grounding color.
    *In 'Line','Circle' drawing by 'Antialias ON mode',
     Because blurred color(code) other than specified is used,
     it isn't distinguished as line of boundary.
     Please draw it by 'Antialias OFF mode' for drawing used as boundary.

 [e.g.]
  circle(100,100),80,col(5)
  paint(100,100),col(2),col(5)



  SYMBOL


 [Features] The "text" is drawn on graphic screen (x,y) specified 'color' and 'fontsize'.

 [Format] SYMBOL(x,y),"text",fontsize [,color]

 [Explanation]

 [e.g.]
  symbol(20,20),"Test",32,col(15)



  GET@


 [Features] Graphic data is stored from graphic screen to graphic buffer.

 [Format] GET@(x1,y1),w1,h1,(x2,y2)[,w2,h2]

 [Explanation]
    This Basic has a Graphic buffer other than display screen.
    It is used by Sprite and Back ground graphics.
    Statement(GET@PUT@) can carry out direct access between Graphic screen and Graphic buffer.
    GET@ Statement is drawn from Graphic screen(1nd_Coordinate) to Graphic buffer(2st_Coordinate).
    w1,w2=width size    h1,h2=height size
    When mutual size is different, it is drawn by scaling.
    The compositing method can be set with 'pen' command.

 [e.g.]
  get@ (32,32),16,16,(64,64)



  PUT@


 [Features] Graphic data is pulled out from graphic buffer to graphic screen.

 [Format] PUT@(x1,y1),w1,h1,(x2,y2)[,[w2],[h2][,mode]]

 [Explanation]
    PUT@ Statement is drawn from Graphic buffer(2nd_Coordinate) to Graphic screen(1st_Coordinate).
    w1,w2=width size    h1,h2=height size
    When mutual size is different, it is drawn by scaling.
    Drawing mode can be chosen by specifying 'mode'.
    The compositing method can be set with 'pen' command.
     0. From Graphic buffer to Graphic screen.
     1. From Graphic screen to Graphic screen.
     2. From Graphic buffer to Graphic buffer.
    When increase drawing speed of screen, to set as [init"dpsw:g2"] (or g0).
    When smooth the enlarged image, to set as [init"dpsw:g1"].

 [e.g.]
  put@(0,0),32,32,(64,64),16,16  :'zoom x2



  ROLL


 [Features] To make graphics screen scroll.

 [Format] ROLL [x],[y],[vx],[vy]

 [Explanation]
    The moving amount of scrolling by software drawing is specified in [x][y].
    Graphic screen is rewritten in the actual drawing.(Occur drawing load)
    If [x][y] is omitted, drawing is not done.
    It is recommended [x][y] omitted when specifying the [vx][vy].
    The part disappearing on the screen edge by spherical scroll, it appear from the reverse side.

    Specifying [vx][vy], it is virtual hardware scroll function
     to change a display starting position.
    To specify coordinates that display start.
    It specify which portion of graphic screen is displayed into BG screen frame.
    The portion protruded from graphic screen size is displayed black.
    Beforehand, to execute 'bg_view ,,,,,1'. (BGscreen synchronization mode:ON)
    The range displayed become the same frame as BG screen.
    Expansion rate also synchronize.
    The expression to superposition scroll with BG screen is possible.

 [e.g.]
   for i=1 to 128
   roll 0,-1
   pause 16
   next

  Sample: Superposition scroll with BG screen.
  [smp_2roll.bas]

   100 cls 3:screen 0,0,0,0
   110 for i=0 to 15
   120 line(0,i)-(15,i),rgb(64+i*8,64+i*8,64+i*8)
   130 next
   140 get@(0,0),16,16,(16,0)
   150 for j=0 to 4
   160 for i=0 to 63
   170 line(i+j*64,0)-(i+j*64,320),rgb(64,64,64+i*2)
   180 next
   190 next
   200 bg_scale 2,2
   210 for i=1 to 256
   220 bg_fill 1,int(rnd(1)*32),int(rnd(1)*32)
   230 next
   240 if size(0)+size(1)>800 then sz=2 else sz=1
   250 bg_view (size(0)-256*sz)\2,0,256,256,sz,1
   260 bg_scene 0,0:screen 0,1,0,1
   270 for i=0 to 4000
   280 bg_roll 0,1
   290 roll ,,i\2 mod 64,0
   300 vsync
   310 next



  GLOAD


 [Features] A picture is loaded to the specification coordinates of a screen.

 [Format] GLOAD "filename",[n][,(x1,y1)]

 [Explanation]
    A picture is loaded to the specification coordinates of a screen.
     n=0  load to Graphic screen. (Default)
     n=1  load to Graphic buffer.
    In a graphic buffer, it can read a picture of up to 2048x2048.
     And if read a picture larger than initial buffer size,
    graphic buffer size will be expanded to fit also.
    Support format .png .jpeg(jpg)

    About loadding of the system internal material "mt**_sys.png"
    Each material files are not (visible)real file.
    Form"mt**_sys.png"(** is number) are, as the file name that is reserved by system,
     it is determined as internal material automatically, and read from system.
    Each material be able to load each of the specified coordinate position.
    In spite of where the present location of current folder,
     be able to load the materials with the specified no-path"mt**_sys.png".
    When the number is 1-digit, add '0' and specify it with 2-digit notation.(ex:"mt03_sys.png")

    Material number correspondence chart.
    04 Playing-cards(72x96pixel 13x4cards)
    05 Chess,Reversi(64x64pixel horizontal7)
    06 Shogi[J-chess](64x64pixel horizontal8)
    07 Mahjong(32x48pixel horizontal9+x landscape-tiles48x32p UpperViewPai32x24p)
      (Point-bar start[296,0] 10(16)x118p ls-start[360,0])
    31 Walking characters (1chara 32x48pixel 4way 16pattern)
    32 Monsters Real type (128x128pixel horizontal 6 bodies)
    33 Monsters Anime type (96x96pixel horizontal 8 bodies)
    Map chip detail.
    41 treasure-box etc, 42 door, 43 seat space, 44 bronze-statue tree,
    45 world map, 46 town, 47 villages, 48 snow-town, 49 castle,
    50 forest, 51 fairy forest, 52 waterfront forest, 53 temple, 54 snow, 55 desert,
    56 volcanoes, 57 canals, 58 caves, 59 darkness cave, 50 ice cave,
    61 caves etc parts, 62 each separated parts (castle town cave room etc),
    63 magma river sea parts, 64 each separated parts (forest cave etc),
    65 world map parts

 [e.g.]
     gload "image.png"
     gload "mt46_sys.png",1,(80,40) :'material-town



  GSAVE


 [Features] The picture of the specification coordinates of a screen is saved.

 [Format] GSAVE "filename",[n][,(x1,y1)-(x2,y2)]

 [Explanation]
    When not specified, the range is the whole.
     n=0  Graphic screen is saved. (Default)
     n=1  Graphic buffer is saved.
    Support format .png .jpeg(jpg)

 [e.g.]
  gsave "gd01.jpg",,(100,100)-(200,200)



  POINT


 [Features] To get the color code of a Graphic screen of the specification coordinates.    (Following, Function)

 [Format] POINT(x,y)

 [Explanation]

 [e.g.]
  c=point(x,y)



  PEN


 [Features] Pensize for drawing is set up.

 [Format] PEN [pensize][,drawing mode]

 [Explanation]
    [pensize] Pen size is set up.
    The larger the value becomes, the width of the pen will also be large.
    Drawing: [ PSET,LINE,LINE B,CIRCLE ] be affected.

    [drawing mode]
    In the drawing mode called 'PorterDuff',
     to select compositing method for Source-image and Destination-image.
    Drawing: [ GET@ PUT@ ] be affected.
    Please see this official explanation for details of 'PorterDuff'.
    https://developer.android.com/reference/android/graphics/PorterDuff.Mode
    There are other more intelligible information so,
     to be recommended to search by 'PorterDuff'.

    To specify a number from 0 to 17 from the following.
     0.CLEAR        1.SRC            2.DST          3.SRC_OVER
     4.DST_OVER 5.SRC_IN      6.DST_IN   7.SRC_OUT
     8.DST_OUT   9.SRC_ATOP 10.DST_ATOP 11.XOR
     12.DARKEN  13.LIGHTEN  14.ADD     15.MULTIPLY
     16.SCREEN   17.OVERLAY

    It's processed including alpha value.
    Basically, color0-black is treated as transparent.
    There are many types, it specify 1(default) or 3 in usual use.

    To introduce some typical ones that degree of use is high.
    1.SRC
    Source-image is drawn as it is.
    3.SRC_OVER
    Drawing that overlap from above.
    11.XOR
    Drawing that use 'XOR' of logical operations.
    14.ADD
    Drawing that use 'OR' of logical operations.
    15.MULTIPLY
    Drawing that use 'AND' of logical operations.

 [e.g.]
     pen 8
     line(50,50)-(200,400)
     pen ,3
     put@(100,100),16,16,(200,200),,,1



  SIZE


 [Features] The size of a screen is acquired.

 [Format] SIZE(n)

 [Explanation]
    n=0 The horizontal size of graphics pixels is obtained.
    n=1 The vertical size of graphics pixels is obtained.
    n=2 The horizontal size of text is obtained.
    n=3 The vertical size of text is obtained.
    n=4 The text font size is obtained.



  LAY


 [Features] To return model-independent coordinate values in the layout.

 [Format] LAY(n)

 [Explanation]
    To return model-independent coordinate values in the layout.
    Pixel of 1/100 of the screen shorter side is made 1 unit.
    For example, in the case of 1080x1920 model, 'lay(1)' return a value of 108 Pixel.
    Every model can draw in the same ratio by description using 'lay()' function.
    This is particularly useful for specifying button coordinates in 'ui_button' command.

 [Explanation]    Square drawing from 20% to 60% of screen
     line(lay(20),lay(20))-(lay(60),lay(60)),col(15),b


  COL


 [Features] To get a color code from the simple-color-set.

 [Format] COL(n)

 [Explanation]
    n:value
    0:Transparent(Black)  1:Dark-blue  2:Dark-red  3:Dark-purple  4:Dark-green  5:Dark-cyan  6:Dark-yellow  7:Dark-Gray
    8:Gray  9:Blue  10:Red  11:Purple  12:Green  13:Cyan  14:Yellow  15:White

 [e.g.]
     circle(240,200),80,col(5)



  RGB


 [Features] To get a color code from trichromatic luminosity.

 [Format] RGB(red,geen,blue [,alpha])

 [Explanation]
    The range is 0 to 255.
    It's possible to specify alpha value as the 4th parameter.
    (Alpha value: compositing transparency)

 [e.g.]
     line(50,50)-(120,80),rgb(200,40,100)



  HSV


 [Features] To get a color code from Hue,Saturation and Value(Brightness).

 [Format] HSV(hue,saturation,value)

 [Explanation]
    hue (0-360)
    saturation (0-100)
    value (0-100)



  GETBITMAP


 [Features] Graphic screen is taken into Bitmap arrangement.

 [Format] GETBITMAP

 [Explanation]
    Outline - Graphic screen processing by Bitmap arrangement.
    This function could work a series of ...
    Graphic screen is taken into internal Bitmap arrangement,
     to process it together, and it return to Graphic screen.

    [GETBITMAP]:the command to take in screen, [PIX_()]:function to get color in pixels,
    [PIXEL]:the command to set color in pixels, [SETBITMAP]:the command to return to screen,
     and, to consist of loop command[FOR~NEXT] that enclose them.

 [e.g.]
    c.f. PIXC



  SETBITMAP


 [Features] Bitmap arrangement is returned and drawn to Graphic screen.

 [Format] SETBITMAP

 [Explanation]

 [e.g.]
    c.f. PIXC GETBITMAP



  PIXEL


 [Features] The Color-code data is written in the specification coordinates of Bitmap arrangement.

 [Format] PIXEL color [,x,y]

 [Explanation]
    In 'PIXEL' and 'PIX_()', these can omit the coordinates xy.
    (Speed?will increase by omitting it)
    When coordinates are specified, the position of Graphic pointer is set up,
     when omitted next time, operation is performed to the position of Graphic pointer.

    Moreover, after 'PIXEL' command, Graphic pointer moves to the next coordinates automatically.
    The Pointer move to right 1 pixel everytime, if it comes to right edge,
     it will drop by one step and will be from left edge again.
    Moreover, at the time of the first 'for' statement,
     Graphic pointer is set as the upper left of coordinates(0,0).
    Detailed usage, please refer to the sample of specifying coordinates and omission at the bottom.

 [e.g.]
    c.f. PIXC



  PIXC  PIXR  PIXG  PIXB


 [Features] The Color-code data is read in the specification coordinates of Bitmap arrangement.

 [Format] PIXC([x,y])

 [Explanation]
    There is function of acquisition, the color code itself and independent [red green blue].
     PIXC() Color-code is acquired.
     PIXR() Red element of Color-code is acquired.  (0~255)
     PIXG() Green element of Color-code is acquired.(0~255)
     PIXB() Blue element of Color-code is acquired. (0~255)

    Coordinates are omissible. (Speed increases)
    When it omit, it becomes reading from the position of Graphic pointer.

 [e.g.]  Bitmap arrangement sample.
    'Specifying coordinates.
    100 cls 3:gload"sample.png"
   110xx=size(0)-1:yy=size(1)-1
    120 getbitmap
    130 for y=0 to yy
    140 for x=0 to xx
    150 p=pixg(x,y)
    160 pixel rgb(0,0,p),x,y
    170 next
    180 next
    190 setbitmap

    '[smp_bmp_ary.bas]
    'Omitted. (Speed increases)
    100 cls 3:gload"sample.png"
    110 k=size(0)*size(1)-1
    120 getbitmap
    130 for i=0 to k
    140 pixel rgb(0,0,pixg())
    150 next
    160 setbitmap

   Explanation.
    This is the sample to draw for blue plain by acquiring the elements of green.
    (It is necessary to prepare picture"sample.png")
    It begin in 'getbitmap' and end up with 'setbitmap'.
    These are processed within 'for~next' loop.
    In 'sample omitted', there are no specification of coordinates,
     the pointer is moving automatically at the time of 'PIXEL' command.
    The pointer is set as (0,0) in the first 'for' statement.
    The loop count required at omitted becomes the same as surface pixels of screen.
    The way which does not go via variable on the way goes up speed. 
    As for a result, picture of blue mono-color is displayed.