Reference for .Net version of SpaceVIL  0.3.5.8
SpaceVIL (Space of Visual Items Layout) is a cross-platform and multilingual framework for creating GUI client applications for .NET Standard, .NET Core and JVM. SpaceVIL is based on OpenGL graphic technology and GLFW. Using this framework in conjunction with .Net Core or with a JVM, you can work and create graphical client applications on Linux, Mac OS X and Windows.
SpaceVIL.GraphicsMathService Class Reference

GraphicsMathService is a static class with static methods for working with colors, fonts, shapes and images. More...

Static Public Member Functions

static Color MixColors (params Color[] colors)
 Mixing two or more colors into one. More...
 
static Color CloneColor (Color color)
 Getting clone of the specified color. More...
 
static List< float[]> GetRectangle (float w=100, float h=100, float x=0, float y=0)
 Making a rectangle as two triangles by its width, height and top left corner position (x, y). More...
 
static List< float[]> GetRoundSquare (CornerRadius cornerRadius, float width=100, float height=100, int x=0, int y=0)
 Making a rectangle with roundness corners. More...
 
static List< float[]> GetRoundSquare (float width=100, float height=100, float radius=0.0f, int x=0, int y=0)
 Making a rectangle with roundness corners. More...
 
static List< float[]> GetStar (float R=100, float r=50, int n=5)
 Making a star figure with specified outer radius, inner radius and number of points. More...
 
static List< float[]> GetRegularPolygon (float r=100, int n=6)
 Making a regular polygon with specified radius and number of edges. More...
 
static List< float[]> GetEllipse (float r=100, int n=32)
 Making an ellipse with two equal radii (i. e. circle). More...
 
static List< float[]> GetEllipse (float w, float h, int x=0, int y=0, int n=32)
 Making an ellipse. More...
 
static List< float[]> GetTriangle (float w=100, float h=100, int x=0, int y=0, int angle=0)
 Making a triangle with corners in (x + w/2, y), (x, y + h), (x + w, y + h), rotated on angle degrees. More...
 
static List< float[]> GetCross (float w, float h, float thickness, int alpha)
 Making cross shape with specified width, height, thickness and rotation angle. More...
 
static List< float[]> RotateShape (float w, float h, float angle, List< float[]> triangles)
 Rotating the specified shape. More...
 
static List< float[]> GetArrow (float w, float h, float thickness, int alpha)
 Making an arrow shape. More...
 
static List< float[]> MoveShape (List< float[]> shape, float x, float y)
 Moving the specified shape by X or/and Y direction. More...
 
static List< float[]> GetFolderIconShape (float w=20.0f, float h=15.0f, float x=0, float y=0)
 Making folder icon shape. More...
 
static List< float[]> GetRoundSquareBorder (float width, float height, float radius, float thickness, int x, int y)
 Making a rectangle border with roundness corners. More...
 
static List< float[]> GetRoundSquareBorder (CornerRadius cornerRadius, float width, float height, float thickness, int x, int y)
 Making a rectangle border with roundness corners. More...
 
static Bitmap ScaleBitmap (Bitmap img, int w, int h)
 Smooth scaling the specified image by new size. More...
 
static Color ColorTransform (int r, int g, int b)
 Making System.Drawing.Color from specified byte RGB format. More...
 
static Color ColorTransform (int r, int g, int b, int a)
 Making System.Drawing.Color from specified byte RGBA format. More...
 
static Color ColorTransform (float r, float g, float b)
 Making System.Drawing.Color from specified float RGB format. More...
 
static Color ColorTransform (float r, float g, float b, float a)
 Making System.Drawing.Color from specified float RGBA format. More...
 
static Font ChangeFontSize (int size, Font oldFont)
 Changing font size. More...
 
static Font ChangeFontStyle (FontStyle style, Font oldFont)
 Changing font style. More...
 
static Font ChangeFontFamily (FontFamily fontFamily, Font oldFont)
 Changing font family. More...
 
static List< float[]> UpdateShape (List< float[]> triangles, int w, int h)
 Updating the specified shape by its new size (streching by new size). More...
 
static List< float[]> UpdateShape (List< float[]> triangles, int w, int h, Area area, ItemAlignment alignments)
 Updating the specified shape by its new size (streching by new size). More...
 
static Area GetFigureBounds (List< float[]> triangles)
 Getting a shape's bounds as SpaceVIL.Core.Area. More...
 
static List< float[]> MoveShape (List< float[]> triangles, float x, float y, Area area, ItemAlignment alignments)
 Moving the specified shape relative to the specified area, specifiedalignment and specified shifts. More...
 

Detailed Description

GraphicsMathService is a static class with static methods for working with colors, fonts, shapes and images.

Member Function Documentation

◆ ChangeFontFamily()

static Font SpaceVIL.GraphicsMathService.ChangeFontFamily ( FontFamily  fontFamily,
Font  oldFont 
)
static

Changing font family.

Parameters
fontFamilyNew font family of the font.
oldFontFont as System.Drawing.Font.
Returns
New font as System.Drawing.Font.

◆ ChangeFontSize()

static Font SpaceVIL.GraphicsMathService.ChangeFontSize ( int  size,
Font  oldFont 
)
static

Changing font size.

Parameters
sizeNew size of the font.
oldFontFont as System.Drawing.Font.
Returns
New sized font as System.Drawing.Font.

◆ ChangeFontStyle()

static Font SpaceVIL.GraphicsMathService.ChangeFontStyle ( FontStyle  style,
Font  oldFont 
)
static

Changing font style.

Parameters
styleNew style of the font.
oldFontFont as System.Drawing.Font.
Returns
New styled font as System.Drawing.Font.

◆ CloneColor()

static Color SpaceVIL.GraphicsMathService.CloneColor ( Color  color)
static

Getting clone of the specified color.

Parameters
colorColor for cloning as System.Drawing.Color.
Returns
Copy of specified color as System.Drawing.Color.

◆ ColorTransform() [1/4]

static Color SpaceVIL.GraphicsMathService.ColorTransform ( float  r,
float  g,
float  b 
)
static

Making System.Drawing.Color from specified float RGB format.

Parameters
rRed color component. Range: (0.0f - 1.0f)
gGreen color component. Range: (0.0f - 1.0f)
bBlue color component. Range: (0.0f - 1.0f)
Returns
Color as System.Drawing.Color.

◆ ColorTransform() [2/4]

static Color SpaceVIL.GraphicsMathService.ColorTransform ( float  r,
float  g,
float  b,
float  a 
)
static

Making System.Drawing.Color from specified float RGBA format.

Parameters
rRed color component. Range: (0.0f - 1.0f)
gGreen color component. Range: (0.0f - 1.0f)
bBlue color component. Range: (0.0f - 1.0f)
aAlpha color component. Range: (0.0f - 1.0f)
Returns
Color as System.Drawing.Color.

◆ ColorTransform() [3/4]

static Color SpaceVIL.GraphicsMathService.ColorTransform ( int  r,
int  g,
int  b 
)
static

Making System.Drawing.Color from specified byte RGB format.

Parameters
rRed color component. Range: (0 - 255)
gGreen color component. Range: (0 - 255)
bBlue color component. Range: (0 - 255)
Returns
Color as System.Drawing.Color.

◆ ColorTransform() [4/4]

static Color SpaceVIL.GraphicsMathService.ColorTransform ( int  r,
int  g,
int  b,
int  a 
)
static

Making System.Drawing.Color from specified byte RGBA format.

Parameters
rRed color component. Range: (0 - 255)
gGreen color component. Range: (0 - 255)
bBlue color component. Range: (0 - 255)
aAlpha color component. Range: (0 - 255)
Returns
Color as System.Drawing.Color.

◆ GetArrow()

static List<float[]> SpaceVIL.GraphicsMathService.GetArrow ( float  w,
float  h,
float  thickness,
int  alpha 
)
static

Making an arrow shape.

Parameters
wArrow width.
hArrow height.
thicknessArrow thickness.
alphaRotation angle in degrees.
Returns
Points list of the shape as List of float[2] array.

◆ GetCross()

static List<float[]> SpaceVIL.GraphicsMathService.GetCross ( float  w,
float  h,
float  thickness,
int  alpha 
)
static

Making cross shape with specified width, height, thickness and rotation angle.

Parameters
wCross width.
hCross height.
thicknessCross parts thickness.
alphaCross rotation angle in degrees.
Returns
Points list of the shape as List of float[2] array.

◆ GetEllipse() [1/2]

static List<float[]> SpaceVIL.GraphicsMathService.GetEllipse ( float  r = 100,
int  n = 32 
)
static

Making an ellipse with two equal radii (i. e. circle).

Parameters
rRadius of a circle (default = 100).
nPoints count on the ellipse border (default = 32).
Returns
Points list of the shape as List of float[2] array.

◆ GetEllipse() [2/2]

static List<float[]> SpaceVIL.GraphicsMathService.GetEllipse ( float  w,
float  h,
int  x = 0,
int  y = 0,
int  n = 32 
)
static

Making an ellipse.

Parameters
wEllipse width.
hEllipse height.
xX position of the left top corner (ellipse center in x + w/2) (default = 0).
yY position of the left top corner (ellipse center in y + h/2) (default = 0).
npoints count on the ellipse border (default = 32).
Returns
Points list of the shape as List of float[2] array.

◆ GetFigureBounds()

static Area SpaceVIL.GraphicsMathService.GetFigureBounds ( List< float[]>  triangles)
static

Getting a shape's bounds as SpaceVIL.Core.Area.

Parameters
trianglesTriangles list of the specified shape.
Returns
Shape's bounds as SpaceVIL.Core.Area.

◆ GetFolderIconShape()

static List<float[]> SpaceVIL.GraphicsMathService.GetFolderIconShape ( float  w = 20.0f,
float  h = 15.0f,
float  x = 0,
float  y = 0 
)
static

Making folder icon shape.

Parameters
wShape width (default = 20).
hShape width (default = 15).
xShape X axis shift (default = 0).
yShape Y axis shift (default = 0).
Returns
Points list of the shape as List of float[2] array.

◆ GetRectangle()

static List<float[]> SpaceVIL.GraphicsMathService.GetRectangle ( float  w = 100,
float  h = 100,
float  x = 0,
float  y = 0 
)
static

Making a rectangle as two triangles by its width, height and top left corner position (x, y).

Parameters
wWidth of rectangle (default = 100).
hHeight of rectangle (default = 100).
xX position of rectangle (default = 0).
yY position of rectangle (default = 0).
Returns
Rectangle points list as List of float[2] array.

◆ GetRegularPolygon()

static List<float[]> SpaceVIL.GraphicsMathService.GetRegularPolygon ( float  r = 100,
int  n = 6 
)
static

Making a regular polygon with specified radius and number of edges.

Parameters
rRadius of regular polygon.
nNumber of edges of regular polygon.
Returns
Points list of the shape as List of float[2] array.

◆ GetRoundSquare() [1/2]

static List<float[]> SpaceVIL.GraphicsMathService.GetRoundSquare ( CornerRadius  cornerRadius,
float  width = 100,
float  height = 100,
int  x = 0,
int  y = 0 
)
static

Making a rectangle with roundness corners.

Parameters
cornerRadiusRadius values for all corners as SpaceVIL.Decorations.CornerRadius.
widthRectangle width (default = 100).
heightRectangle height (default = 100).
xX position (left top corner) of the result object (default = 0).
yY position (left top corner) of the result object (default = 0).
Returns
Points list of the shape with roundness corners as List of float[2] array.

◆ GetRoundSquare() [2/2]

static List<float[]> SpaceVIL.GraphicsMathService.GetRoundSquare ( float  width = 100,
float  height = 100,
float  radius = 0.0f,
int  x = 0,
int  y = 0 
)
static

Making a rectangle with roundness corners.

Parameters
widthRectangle width (default = 100).
heightRectangle height (default = 100).
radiusSame radius value for each corner (default = 0).
xX position (left top corner) of the result object (default = 0).
yY position (left top corner) of the result object (default = 0).
Returns
Points list of the shape with roundness corners as List of float[2] array.

◆ GetRoundSquareBorder() [1/2]

static List<float[]> SpaceVIL.GraphicsMathService.GetRoundSquareBorder ( CornerRadius  cornerRadius,
float  width,
float  height,
float  thickness,
int  x,
int  y 
)
static

Making a rectangle border with roundness corners.

Parameters
cornerRadiusRadius values for all corners as SpaceVIL.Decorations.CornerRadius.
widthRectangle border width.
heightRectangle border height.
thicknessBorder thickness.
xX position (left top corner) of the result shape.
yY position (left top corner) of the result shape.
Returns
Points list of the rectangle border with roundness corners as List of float[2] array

◆ GetRoundSquareBorder() [2/2]

static List<float[]> SpaceVIL.GraphicsMathService.GetRoundSquareBorder ( float  width,
float  height,
float  radius,
float  thickness,
int  x,
int  y 
)
static

Making a rectangle border with roundness corners.

Parameters
widthRectangle border width.
heightRectangle border height.
radiusSame radius value for each corner.
thicknessBorder thickness.
xX position (left top corner) of the result shape.
yY position (left top corner) of the result shape.
Returns
Points list of the rectangle border with roundness corners as List of float[2] array.

◆ GetStar()

static List<float[]> SpaceVIL.GraphicsMathService.GetStar ( float  R = 100,
float  r = 50,
int  n = 5 
)
static

Making a star figure with specified outer radius, inner radius and number of points.

Parameters
RCircumscribed circle radius (default = 100).
rIncircle radius (default = 50).
nVertices count (default = 5).
Returns
Points list of the shape as List of float[2] array.

◆ GetTriangle()

static List<float[]> SpaceVIL.GraphicsMathService.GetTriangle ( float  w = 100,
float  h = 100,
int  x = 0,
int  y = 0,
int  angle = 0 
)
static

Making a triangle with corners in (x + w/2, y), (x, y + h), (x + w, y + h), rotated on angle degrees.

Parameters
wTriangle width (default = 100).
hTriangle height (default = 100).
xTriangle X offset (default = 0).
yTriangle Y offset (default = 0).
angleRotation angle for the triangle in degrees (default = 0).
Returns
Points list of the shape as List of float[2] array.

◆ MixColors()

static Color SpaceVIL.GraphicsMathService.MixColors ( params Color[]  colors)
static

Mixing two or more colors into one.

Parameters
colorsSequence of colors as System.Drawing.Color.
Returns
Mixed color as System.Drawing.Color.

◆ MoveShape() [1/2]

static List<float[]> SpaceVIL.GraphicsMathService.MoveShape ( List< float[]>  shape,
float  x,
float  y 
)
static

Moving the specified shape by X or/and Y direction.

Parameters
shapeTriangles list of the specified shape.
xX axis shift.
yY axis shift.
Returns
Points list of the shape as List of float[2] array.

◆ MoveShape() [2/2]

static List<float[]> SpaceVIL.GraphicsMathService.MoveShape ( List< float[]>  triangles,
float  x,
float  y,
Area  area,
ItemAlignment  alignments 
)
static

Moving the specified shape relative to the specified area, specifiedalignment and specified shifts.

Parameters
trianglesTriangles list of the specified shape.
xX axis shift.
yY axis shift.
areaArea as SpaceVIL.Core.Area.
alignmentsAlignment as SpaceVIL.Core.ItemAlignment.
Returns
Points list of the shape as List of float[2] array.

◆ RotateShape()

static List<float[]> SpaceVIL.GraphicsMathService.RotateShape ( float  w,
float  h,
float  angle,
List< float[]>  triangles 
)
static

Rotating the specified shape.

Parameters
wWidth of the shape.
hHeight of the shape.
angleRotation angle in degrees.
trianglesTriangles list of the specified shape.
Returns
Points list of the shape as List of float[2] array.

◆ ScaleBitmap()

static Bitmap SpaceVIL.GraphicsMathService.ScaleBitmap ( Bitmap  img,
int  w,
int  h 
)
static

Smooth scaling the specified image by new size.

Parameters
imgImage as System.Drawing.Bitmap.
wNew width of the image.
hNew height of the image.
Returns
Scaled image as System.Drawing.Bitmap.

◆ UpdateShape() [1/2]

static List<float[]> SpaceVIL.GraphicsMathService.UpdateShape ( List< float[]>  triangles,
int  w,
int  h 
)
static

Updating the specified shape by its new size (streching by new size).

Parameters
trianglesTriangles list of the specified shape.
wNew shape width.
hNew shape height.
Returns
Points list of the shape as List of float[2] array.

◆ UpdateShape() [2/2]

static List<float[]> SpaceVIL.GraphicsMathService.UpdateShape ( List< float[]>  triangles,
int  w,
int  h,
Area  area,
ItemAlignment  alignments 
)
static

Updating the specified shape by its new size (streching by new size).

Parameters
trianglesTriangles list of the specified shape.
wNew shape width.
hNew shape height.
areaNew shape bounds as SpaceVIL.Core.Area.
alignmentsNew shape alignments as List of SpaceVIL.Core.ItemAlignment.
Returns
Points list of the shape as List of float[2] array.

The documentation for this class was generated from the following file: