Shape Array Extended Specification - nonkit/Anime GitHub Wiki

Documentation > Shape Array Extended Specification

Shape Array Extended Specification

Version 1.0.6 Nonki Takahashi

Purpose

This specification defines the polygon extension for shape array in Microsoft Small Basic programming language. The typical application of the polygon extension is the Anime editor. But the function is not implemented yet.

Requirements

This specification assumes following systems.

  • Small Basic v1.2
  • LitDev Extension

Definitions

This specification defines the additional data format of the shape array and subroutines to manipulate the array. The new function is poly. And function tri has extended to define general triangle instead of isosceles triangle. This is because LitDev Extension enables to flip any type of shapes.

Data Format

The Array

The name of the array is shape.

Indices

In the shape array, following indices are used.

  • func - functions are tri (triangle) and poly (polygon).
  • x - the x co-ordinate on the left of the shape.
  • y - the y co-ordinate on the top of the shape.
  • x1 - the x co-ordinate of arbitrarily selected first vertex of the triangle.
  • y1 - the y co-ordinate of arbitrarily selected first vertex of the triangle.
  • x2 - the x co-ordinate of arbitrarily selected second vertex of the triangle.
  • y2 - the y co-ordinate of arbitrarily selected second vertex of the triangle.
  • x2 - the x co-ordinate of arbitrarily selected third vertex of the triangle.
  • y2 - the y co-ordinate of arbitrarily selected third vertex of the triangle.
  • width - the width of the shape.
  • height - the height of the shape.
  • pt - pairs of the x and y co-ordinate for the polygon vertices such as "100,100 200,100, 200,200 100,200". The minimum number of vertices is 3.
  • pw - the width of the pen.
  • pc - the color of the pen such as "#000000".
  • bc - the color of the brush such as "#FFFF00".
  • fr - fill rule for the polygon. The value is "EvenOdd" or "NonZero". The default value is "NonZero".
  • name - the user defined name of the shape.
  • obj - (internal use only) the system provided shape name.
  • rx - (internal use only) the x co-ordinate of the shape for rotated or zoomed sprite.
  • ry - (internal use only) the y co-ordinate of the shape for rotated or zoomed sprite.

polygon

Virtual Functions (Read Only)

These functions are read only and converted other functions above.

  • func - function is only path.
  • d - path definition just like SVG.

Subroutines

  • Shapes_Init - initializes the shape array and the offset shX and shY.
  • Shapes_CalcWidthAndHeight - (internal use only) calculates total width and height of shapes.
  • Shapes_CalcRotateZoomPos - (internal use only) calculates position for rotated and zoomed shape.
  • Sprite_Add - adds the shapes into sprite array with a name.
  • Sprite_Flip - flips the sprite by angle [degree] around the center line.
  • Sprite_Hide - hides the sprite.
  • Sprite_Move - moves the sprite to (x, y).
  • Sprite_Remove - removes the sprite.
  • Sprite_Rotate - rotates the sprite by angle [degree] clockwise.
  • Sprite_Show - shows a sprite of shapes
  • Sprite_Zoom - zooms the sprite ScaleX times in x axis and ScaleY times in y axis.

See Also

Other Languages