IMS2
Pre-Alpha
An Orbiter add-on to allow on-runtime construction of spacecraft from predefined modules
|
This class contains drawing functions for the GUI. More...
Static Public Member Functions | |
static SURFHANDLE | createElementBackground (GUI_ElementStyle *style, int width, int height) |
Allocates a drawing surface and fills it with a background color. More... | |
static void | DrawRectangle (RECT rectangle, Sketchpad *skp, GUI_ElementStyle *style, bool hilight=false) |
Draws a filled rectangle in the passed style. More... | |
static void | DrawLine (int x0, int y0, int x1, int y1, Sketchpad *skp, GUI_ElementStyle *style) |
Draws a line. More... | |
static void | DrawPolygon (IVECTOR2 *vertexlist, int numvertices, Sketchpad *skp, GUI_ElementStyle *style, bool highlight=false) |
Draws an arbitrary filled polygon. More... | |
static void | ColorFill (RECT rectangle, SURFHANDLE srf, GUI_COLOR color) |
Fills a a rectangle with the designated color. More... | |
static DWORD | getDwordColor (GUI_COLOR color) |
converts a GUI_COLOR to a DWORD formatted for sketchpad operations More... | |
static DWORD | getAlphaCorrectedColor (float alpha, GUI_COLOR &color, GUI_COLOR &bgcolor) |
takes an alpha value, a color and a background color and returns the DWORD value of color when it is blended More... | |
Static Private Member Functions | |
static IVECTOR2 * | createRoundedRectVertexList (RECT rectangle, int corner_radius, int &OUT_numvertices, DWORD corners) |
creates a vertex list to draw a rounded rectangle More... | |
static IVECTOR2 * | createRoundedCornerVertexList (IVECTOR2 center, int corner_radius, CORNERS corner, int &OUT_numvertices, IVECTOR2 *previousvertices=NULL) |
creates a list of points on a rounded corner (I.E. a quarter circle). More... | |
static IVECTOR2 * | addVertexToVertexList (IVECTOR2 vert, int &IN_OUT_numvertices, IVECTOR2 *vertexlist) |
Appends a vertex to a vertex list. More... | |
This class contains drawing functions for the GUI.
Note that these drawing functions are relatively slow: they are intended to be used to draw GUI elements once into video memory, while drawing the actual visuals to the panel is done by blitting these pre-drawn textures
also note that this is still very much a mock implementation it just uses the default Sketchpad commands to draw shapes, which is unsatisfactory because the Sketchpad algorithms' suck increases proportional with line width. A future implementation should aim at a complete and well-working drawing implementation on a per-pixel basis using Sketchpad's Pixel()
|
staticprivate |
Appends a vertex to a vertex list.
vert | The new vertex to be added to the list |
IN_OUT_numvertices | returns number of vertices in the list. Expects length of vertexlist as input |
vertexlist | The vertex list vert should be appended to. Will be initialised if NULL. |
|
static |
Fills a a rectangle with the designated color.
rectangle | The rectangle to fill, relative to srf |
srf | The drawing surface on which to perform the color fill |
color | The color to fill rectangle with |
|
static |
Allocates a drawing surface and fills it with a background color.
style | The style defining the background color of the element |
width | The width of the surface in pixel |
height | the height of the surface in pixel |
|
staticprivate |
creates a list of points on a rounded corner (I.E. a quarter circle).
center | The position of the center of the corner radius |
corner_radius | the radius of the corner in pixel |
corner | The designation for the corner |
OUT_numvertices | Contains the number of vertices in the returned array after the function finishes. |
previousvertices | A list of vertices these vertices should be appended to. If not NULL, the function will return previousvertices with the new vertices appended, with OUT_numvertices containing the total amount of vertices |
|
staticprivate |
creates a vertex list to draw a rounded rectangle
rectangle | The position and dimensions of the rectangle |
corner_radius | In pixel |
OUT_numvertices | contains the number of vertices in the list after the operation finishes |
corners | Bitmask describing which corners to round |
|
static |
Draws a line.
x0 | The x-coordinate (surface relative) of the starting point |
y0 | The y-coordinate (surface relative) of the starting point |
x1 | The x-coordinate (surface relative) of the end point |
y1 | The y-coordinate (surface relative) of the end point |
skp | The sketchpad to draw the line with |
style | The style determining linewidth and color |
|
static |
Draws an arbitrary filled polygon.
vertexlist | Pointer to an array of vertices. The caller is responsible for freeing the list after use! |
numvertices | The number of vertices in vertexlist |
skp | The sketchpad to draw with |
style | The style determining border color and width as well as fill color. Border radius is ignored. |
highlight | If true, the styles hilightcolor will be used as fill color, otherwise the styles fill color |
|
static |
Draws a filled rectangle in the passed style.
Allows corner radiuses. If you don't want a border, set border-width of the style to 0.
rectangle | Position and Dimensions of the rectangle |
style | Pointer to the style the background should be drawn in |
skp | Pointer to the sketchpad doing the drawing |
style | The style defining the visuals of the rectangle |
hilight | If true, the rectangle will be filled with the styles hilight color, otherwise with its fillcolor |
|
static |
takes an alpha value, a color and a background color and returns the DWORD value of color when it is blended
alpha | The alpha value for which to calculate (transparency if you will) |
color | the overlying color |
bgcolor | The background color |
|
static |
converts a GUI_COLOR to a DWORD formatted for sketchpad operations
color | The color to convert |