Migrate from GitHub to SourceForge with this tool. Check out all of SourceForge's recent improvements.
Close

Snowmix Libraries - Basic Shapes

Peter Maersk-Moller

Snowmix Libraries - basic-shapes.slib

As of version 0.4.4 of Snowmix, the following applies.

The basic-shapes.slib library defines a basic set of shapes that can be used freely by other libraries and in ini files. The scenes.slib uses settings from this library.

You include this library by adding the following line to you ini file:

include ../slib/basic-shapes.slib

The basic shapes named Unit Something all have the size of 1x1 pixel meaning that they are designed to fit within a single pixel. When using the basic Unit shapes, these can be scaled to any size desired independently in X and in Y.

Shape Coordinate System

In the shape coordinate system, negative X values are to the left and positive to the right. Negative Y values are up and positive are down.

Basic Shapes

In the table below, the following applies:

Shape ID is the ID number of the shape.

Shape name is the name given to the shape.

Placing of the shape can be Absolute or Relative. If the Placing is Relative, then the shape may need an Absolute placement, before a drawing through stroke or fill will take effect. Shape 4 is a Relative placed shape. It will need an absolute Placing through including moveto or lineto etc. This is shown in the example below:

shape add 45 My Test Square
shape moveto 45 0 0
shape inshape 45 4
shape rgba 45 1 0 0 1
shape fill 45

The first line creates shape 45. The second moves the shape to start at absolute 0,0. When shape 45 is used in a placed shape and this placed shape is placed at X,Y, then 0,0 in the moveto line means X,Y and the shape will be drawn with size or scale of the placed shape. In the third line, the drawing primitives of shape 4 is added. In the fourth line, the color is set to be red 1,0,0 and alpha is set to 1. In the fifth line, the shape is to be filled with the color defined in the previous line. The color defined in the fourth line override the color settings that the shape will inherit from a placed shape, when the shape is used for a placed shape. As such, it might be a good idea to avoid it, as it is easier to change the color through changing the color of a placed shape instead of changing the definition of shape 45.

The shape 4 used in shape 45 is defined in the basic-shapes.slib as:

shape add 4 Unit Square
shape moverel 4 -0.5 -0.5
shape linerel 4 1.0 0.0
shape linerel 4 0.0 1.0
shape linerel 4 -1.0 0.0

Arcs, rectangle, curveto, lineto and moveto are absolute placed. Shapes without these can be relative if they contain one or more of the following: curverel, linerel and moverel. Shapes without any of the mentioned elements are really neither absolute nor relative.

The first line creates shape 45. The second moves the shape to start at absolute 0,0. When used for a placed shape, 0,0 will be at the position where the placed shape will be and it will have the size the placed shape is given. In the third line, the drawing primitives of shape 4 is added. In the fourth line, the color is set to be red 1,0,0 and alpha is set to 1. In the fifth line, the shape is to be filled with the color defined in the previous line.

Description contains a brief description of the shape.

Shape ID Shape Name Placing Description
1 Unit Circle Absolute A circle.
2 Unit Rectangle Absolute A square using the rectangle drawing primitive.
3 Unit Diamond Absolute A diamond with the top in x=0. Effectively it is a rectangle rotated 45 degrees
4 Unit Square Relative A square using the moverel and linrel drawing primitives
5 Unit Triangle Relative A triangle with the base -0.5,0.5 to 0.5,0.5 and the angle is at 0,-0.5.
6 Unit Star-4 Absolute A four point star with curved lines. Top point at 0,0.5
7 Unit Square Round Relative A square with round corners
8 Unit Round Line Relative A horizontal line with round ends.
9 Unit Freehand Relative Unused. Reserved.
10 - - -
11 Unit Loading Absolute Supporting shape for shape 12. It uses shape 8.
12 Unit Loading Symbol Absolute A typical movie loading symbol with fading small line segments together forming a circle. It is using shape 11 recursively for repetition slightly angled for every repetition.
Examples

Loading movie: The following example places the movie loading shape at 50,50 and scales it to 75,75. The symbol is then set to rotate for a long time. For the shape to appear on screen ,the shape must be overlayed/mixed as part of the command macro set with the command overlay finish.

shape place 1 12 50 50 75 75 0.0 0 0 0 1
shape place move rotation 1 -0.075 1000000
Basic Patterns

None so far.


Related

Wiki: Snowmix Libraries
Wiki: Snowmix Tutorials - Scenes