/* Copyright (c) 2022 Alex Diener This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. Alex Diener alex@ludobloom.com */ #ifndef __UIDrawingInterface_H__ #define __UIDrawingInterface_H__ #ifdef __cplusplus extern "C" { #endif typedef struct UIDrawingInterface UIDrawingInterface; #define UIDrawingInterface_superclass StemObject #include "gamemath/Rect4f.h" #include "gamemath/Vector2f.h" #include "renderer/Drawing.h" #include "renderer/VertexIO.h" #include "stemobject/StemObject.h" #include "uitoolkit/UITextLayout.h" #include "uitoolkit/UITypeface.h" #include "uitoolkit/UITypes.h" #define UIDrawingInterface_ivars \ StemObject_ivars \ \ bool drawFocusedElementInRolloverState; \ bool drawMouseRolloverState; \ float scaleFactor; \ bool alphaPremultiplied; #define UIDrawingInterface_vtable(self_type) \ StemObject_vtable(self_type) \ \ void (* drawQuad)(self_type * self, Rect4f vertexBounds, Rect4f textureBounds, Color4f color, VertexIO * vertexIO); \ void (* drawQuadWithTransform)(self_type * self, Rect4f vertexBounds, Rect4f textureBounds, quadTransformBits transformBits, Color4f color, VertexIO * vertexIO); \ void (* drawQuadWithSeparateColors)(self_type * self, Rect4f vertexBounds, Rect4f textureBounds, Color4f colorBottomLeft, Color4f colorBottomRight, Color4f colorTopLeft, Color4f colorTopRight, VertexIO * vertexIO); \ void (* drawSlicedQuad3x3)(self_type * self, Rect4f vertexBounds, Rect4f textureBounds, UISliceGrid3x3 slices, Color4f color, VertexIO * vertexIO); \ void (* drawSlicedQuad3x1)(self_type * self, Rect4f vertexBounds, Rect4f textureBounds, UISliceGrid3x1 slices, Color4f color, VertexIO * vertexIO); \ void (* drawSlicedQuad1x3)(self_type * self, Rect4f vertexBounds, Rect4f textureBounds, UISliceGrid1x3 slices, Color4f color, VertexIO * vertexIO); \ void (* drawSlicedQuad3x3WithAlternatingRowColors)(self_type * self, Rect4f vertexBounds, Rect4f textureBounds, UISliceGrid3x3 slices, float inset, float rowHeight, Color4f evenColor, Color4f oddColor, VertexIO * vertexIO); \ void (* drawIndexedVertices_p2f_t2f_c4f)(self_type * self, unsigned int vertexCount, const struct vertex_p2f_t2f_c4f * vertices, unsigned int indexCount, const uint32_t * indexes, VertexIO * vertexIO); \ void (* drawString)(self_type * self, compat_type(UITypeface *) typeface, String string, Vector2f offset, Vector2f relativeOrigin, float textScale, Color4f color, VertexIO * vertexIO); \ void (* drawTextLayout)(self_type * self, compat_type(UITextLayout *) textLayout, Vector2f offset, Vector2f relativeOrigin, float textScale, Color4f color, VertexIO * vertexIO); stemobject_declare(UIDrawingInterface) bool UIDrawingInterface_init(UIDrawingInterface * self); void UIDrawingInterface_dispose(UIDrawingInterface * self); void UIDrawingInterface_drawQuad(UIDrawingInterface * self, Rect4f vertexBounds, Rect4f textureBounds, Color4f color, VertexIO * vertexIO); void UIDrawingInterface_drawQuadWithTransform(UIDrawingInterface * self, Rect4f vertexBounds, Rect4f textureBounds, quadTransformBits transformBits, Color4f color, VertexIO * vertexIO); void UIDrawingInterface_drawQuadWithSeparateColors(UIDrawingInterface * self, Rect4f vertexBounds, Rect4f textureBounds, Color4f colorBottomLeft, Color4f colorBottomRight, Color4f colorTopLeft, Color4f colorTopRight, VertexIO * vertexIO); void UIDrawingInterface_drawSlicedQuad3x3(UIDrawingInterface * self, Rect4f vertexBounds, Rect4f textureBounds, UISliceGrid3x3 slices, Color4f color, VertexIO * vertexIO); void UIDrawingInterface_drawSlicedQuad3x1(UIDrawingInterface * self, Rect4f vertexBounds, Rect4f textureBounds, UISliceGrid3x1 slices, Color4f color, VertexIO * vertexIO); void UIDrawingInterface_drawSlicedQuad1x3(UIDrawingInterface * self, Rect4f vertexBounds, Rect4f textureBounds, UISliceGrid1x3 slices, Color4f color, VertexIO * vertexIO); void UIDrawingInterface_drawSlicedQuad3x3WithAlternatingRowColors(UIDrawingInterface * self, Rect4f vertexBounds, Rect4f textureBounds, UISliceGrid3x3 slices, float inset, float rowHeight, Color4f evenColor, Color4f oddColor, VertexIO * vertexIO); void UIDrawingInterface_drawIndexedVertices_p2f_t2f_c4f(UIDrawingInterface * self, unsigned int vertexCount, const struct vertex_p2f_t2f_c4f * vertices, unsigned int indexCount, const uint32_t * indexes, VertexIO * vertexIO); void UIDrawingInterface_drawString(UIDrawingInterface * self, compat_type(UITypeface *) typeface, String string, Vector2f offset, Vector2f relativeOrigin, float textScale, Color4f color, VertexIO * vertexIO); void UIDrawingInterface_drawTextLayout(UIDrawingInterface * self, compat_type(UITextLayout *) textLayout, Vector2f offset, Vector2f relativeOrigin, float textScale, Color4f color, VertexIO * vertexIO); #ifdef __cplusplus } #endif #endif