Reference for JVM 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.
com.spvessel.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 (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, float h, float x, float y)
 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, float height, int x, int y)
 Make a rectangle with roundness corners. More...
 
static List< float[]> getRoundSquare (float width, float height, float radius, int x, int y)
 Make a rectangle with roundness corners. More...
 
static List< float[]> getStar (float R, float r, int n)
 Making a star figure with specified outer radius, inner radius and number of points. More...
 
static List< float[]> getRegularPolygon (float r, int n)
 Making a regular polygon with specified radius and number of edges. More...
 
static List< float[]> getEllipse (float r, int n)
 Making an ellipse with two equal radii (i. More...
 
static List< float[]> getEllipse (float w, float h, int x, int y, int n)
 Make an ellipse. More...
 
static List< float[]> getTriangle (float w, float h, int x, int y, int angle)
 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, float h, float x, float y)
 Making folder icon shape. More...
 
static List< float[]> getRoundSquareBorder (float width, float height, float radius, float thickness, int x, int y)
 Make a rectangle border with roundness corners. More...
 
static List< float[]> getRoundSquareBorder (CornerRadius cornerRadius, float width, float height, float thickness, int x, int y)
 Make a rectangle border with roundness corners. More...
 
static BufferedImage scaleBitmap (BufferedImage img, int w, int h)
 Smooth scaling the specified image by new size. More...
 
static Color colorTransform (int r, int g, int b)
 Making java.awt.Color from specified byte RGB format. More...
 
static Color colorTransform (int r, int g, int b, int a)
 Making java.awt.Color from specified byte RGBA format. More...
 
static Color colorTransform (float r, float g, float b)
 Making java.awt.Color from specified float RGB format. More...
 
static Color colorTransform (float r, float g, float b, float a)
 Making java.awt.Color from specified float RGBA format. More...
 
static Font changeFontSize (int size, Font oldFont)
 Changing font size. More...
 
static Font changeFontStyle (int style, Font oldFont)
 Changing font style. More...
 
static Font changeFontFamily (String 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, List< 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 com.spvessel.spacevil.Core.Area. More...
 
static List< float[]> moveShape (List< float[]> triangles, float x, float y, Area area, List< 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 com.spvessel.spacevil.GraphicsMathService.changeFontFamily ( String  fontFamily,
Font  oldFont 
)
static

Changing font family.

Parameters
fontFamilyNew font family of the font.
oldFontFont as java.awt.Font.
Returns
New font as java.awt.Font.

◆ changeFontSize()

static Font com.spvessel.spacevil.GraphicsMathService.changeFontSize ( int  size,
Font  oldFont 
)
static

Changing font size.

Parameters
sizeNew size of the font.
oldFontFont as java.awt.Font.
Returns
New sized font as java.awt.Font.

◆ changeFontStyle()

static Font com.spvessel.spacevil.GraphicsMathService.changeFontStyle ( int  style,
Font  oldFont 
)
static

Changing font style.

Parameters
styleNew style of the font.
oldFontFont as java.awt.Font.
Returns
New styled font as java.awt.Font.

◆ cloneColor()

static Color com.spvessel.spacevil.GraphicsMathService.cloneColor ( Color  color)
static

Getting clone of the specified color.

Parameters
colorColor for cloning as java.awt.Color.
Returns
Copy of specified color as java.awt.Color.

◆ colorTransform() [1/4]

static Color com.spvessel.spacevil.GraphicsMathService.colorTransform ( float  r,
float  g,
float  b 
)
static

Making java.awt.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 java.awt.Color.

◆ colorTransform() [2/4]

static Color com.spvessel.spacevil.GraphicsMathService.colorTransform ( float  r,
float  g,
float  b,
float  a 
)
static

Making java.awt.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 java.awt.Color.

◆ colorTransform() [3/4]

static Color com.spvessel.spacevil.GraphicsMathService.colorTransform ( int  r,
int  g,
int  b 
)
static

Making java.awt.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 java.awt.Color.

◆ colorTransform() [4/4]

static Color com.spvessel.spacevil.GraphicsMathService.colorTransform ( int  r,
int  g,
int  b,
int  a 
)
static

Making java.awt.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 java.awt.Color.

◆ getArrow()

static List<float[]> com.spvessel.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[]> com.spvessel.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[]> com.spvessel.spacevil.GraphicsMathService.getEllipse ( float  r,
int  n 
)
static

Making an ellipse with two equal radii (i.

e. circle).

Parameters
rRadius of a circle.
nPoints count on the ellipse border.
Returns
Points list of the shape as List of float[2] array.

◆ getEllipse() [2/2]

static List<float[]> com.spvessel.spacevil.GraphicsMathService.getEllipse ( float  w,
float  h,
int  x,
int  y,
int  n 
)
static

Make an ellipse.

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

◆ getFigureBounds()

static Area com.spvessel.spacevil.GraphicsMathService.getFigureBounds ( List< float[]>  triangles)
static

Getting a shape's bounds as com.spvessel.spacevil.Core.Area.

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

◆ getFolderIconShape()

static List<float[]> com.spvessel.spacevil.GraphicsMathService.getFolderIconShape ( float  w,
float  h,
float  x,
float  y 
)
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[]> com.spvessel.spacevil.GraphicsMathService.getRectangle ( float  w,
float  h,
float  x,
float  y 
)
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[]> com.spvessel.spacevil.GraphicsMathService.getRegularPolygon ( float  r,
int  n 
)
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[]> com.spvessel.spacevil.GraphicsMathService.getRoundSquare ( CornerRadius  cornerRadius,
float  width,
float  height,
int  x,
int  y 
)
static

Make a rectangle with roundness corners.

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

◆ getRoundSquare() [2/2]

static List<float[]> com.spvessel.spacevil.GraphicsMathService.getRoundSquare ( float  width,
float  height,
float  radius,
int  x,
int  y 
)
static

Make a rectangle with roundness corners.

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

◆ getRoundSquareBorder() [1/2]

static List<float[]> com.spvessel.spacevil.GraphicsMathService.getRoundSquareBorder ( CornerRadius  cornerRadius,
float  width,
float  height,
float  thickness,
int  x,
int  y 
)
static

Make a rectangle border with roundness corners.

Parameters
cornerRadiusRadius values for all corners as com.spvessel.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[]> com.spvessel.spacevil.GraphicsMathService.getRoundSquareBorder ( float  width,
float  height,
float  radius,
float  thickness,
int  x,
int  y 
)
static

Make 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[]> com.spvessel.spacevil.GraphicsMathService.getStar ( float  R,
float  r,
int  n 
)
static

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

  • Parameters
    RCircumscribed circle radius.
    rIncircle radius.
    nVertices count.
    Returns
    Points list of the shape as List of float[2] array.

◆ getTriangle()

static List<float[]> com.spvessel.spacevil.GraphicsMathService.getTriangle ( float  w,
float  h,
int  x,
int  y,
int  angle 
)
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.
hTriangle height.
xTriangle X offset.
yTriangle Y offset.
angleRotation angle for the triangle in degrees.
Returns
Points list of the shape as List of float[2] array.

◆ mixColors()

static Color com.spvessel.spacevil.GraphicsMathService.mixColors ( Color...  colors)
static

Mixing two or more colors into one.

Parameters
colorsSequence of colors as java.awt.Color.
Returns
Mixed color as java.awt.Color.

◆ moveShape() [1/2]

static List<float[]> com.spvessel.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[]> com.spvessel.spacevil.GraphicsMathService.moveShape ( List< float[]>  triangles,
float  x,
float  y,
Area  area,
List< 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 com.spvessel.spacevil.Core.Area.
alignmentsAlignment as com.spvessel.spacevil.Flags.ItemAlignment.
Returns
Points list of the shape as List of float[2] array.

◆ rotateShape()

static List<float[]> com.spvessel.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 BufferedImage com.spvessel.spacevil.GraphicsMathService.scaleBitmap ( BufferedImage  img,
int  w,
int  h 
)
static

Smooth scaling the specified image by new size.

Parameters
imgImage as java.awt.image.BufferedImage.
wNew width of the image.
hNew height of the image.
Returns
Scaled image as java.awt.image.BufferedImage.

◆ updateShape() [1/2]

static List<float[]> com.spvessel.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[]> com.spvessel.spacevil.GraphicsMathService.updateShape ( List< float[]>  triangles,
int  w,
int  h,
Area  area,
List< 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 com.spvessel.spacevil.Core.Area
alignmentsNew shape alignments as List of com.spvessel.spacevil.Flags.ItemAlignment.
Returns
Points list of the shape as List of float[2] array.

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