Skip to content

Commit

Permalink
Add ISerialization serialization interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Philosoph228 committed Oct 17, 2024
1 parent 685a260 commit 48a332e
Show file tree
Hide file tree
Showing 47 changed files with 831 additions and 69 deletions.
4 changes: 4 additions & 0 deletions cpp.hint
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Hint files help the Visual Studio IDE interpret Visual C++ identifiers
// such as names of functions and macros.
// For more information see https://go.microsoft.com/fwlink/?linkid=865984
#define DECLARE_$NEW(T, __VA_ARGS__) T* T##_$new(E) { void* pObject = malloc(sizeof(T)); if (pObject) { memset(pObject, 0, sizeof(T)); T##_$init((T*)pObject, __VA_ARGS__); } return (T*)pObject; }
36 changes: 36 additions & 0 deletions panitent.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,78 @@ Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
MinSizeRel|x64 = MinSizeRel|x64
MinSizeRel|x86 = MinSizeRel|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
RelWithDebInfo|x64 = RelWithDebInfo|x64
RelWithDebInfo|x86 = RelWithDebInfo|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F95C4EF5-0539-455C-B247-96029C28E36D}.Debug|x64.ActiveCfg = Debug|x64
{F95C4EF5-0539-455C-B247-96029C28E36D}.Debug|x64.Build.0 = Debug|x64
{F95C4EF5-0539-455C-B247-96029C28E36D}.Debug|x86.ActiveCfg = Debug|Win32
{F95C4EF5-0539-455C-B247-96029C28E36D}.Debug|x86.Build.0 = Debug|Win32
{F95C4EF5-0539-455C-B247-96029C28E36D}.MinSizeRel|x64.ActiveCfg = Release|x64
{F95C4EF5-0539-455C-B247-96029C28E36D}.MinSizeRel|x64.Build.0 = Release|x64
{F95C4EF5-0539-455C-B247-96029C28E36D}.MinSizeRel|x86.ActiveCfg = Release|Win32
{F95C4EF5-0539-455C-B247-96029C28E36D}.MinSizeRel|x86.Build.0 = Release|Win32
{F95C4EF5-0539-455C-B247-96029C28E36D}.Release|x64.ActiveCfg = Release|x64
{F95C4EF5-0539-455C-B247-96029C28E36D}.Release|x64.Build.0 = Release|x64
{F95C4EF5-0539-455C-B247-96029C28E36D}.Release|x86.ActiveCfg = Release|Win32
{F95C4EF5-0539-455C-B247-96029C28E36D}.Release|x86.Build.0 = Release|Win32
{F95C4EF5-0539-455C-B247-96029C28E36D}.RelWithDebInfo|x64.ActiveCfg = Release|x64
{F95C4EF5-0539-455C-B247-96029C28E36D}.RelWithDebInfo|x64.Build.0 = Release|x64
{F95C4EF5-0539-455C-B247-96029C28E36D}.RelWithDebInfo|x86.ActiveCfg = Release|Win32
{F95C4EF5-0539-455C-B247-96029C28E36D}.RelWithDebInfo|x86.Build.0 = Release|Win32
{290557A9-3D88-4047-AE9C-F84118A13ADE}.Debug|x64.ActiveCfg = Debug|x64
{290557A9-3D88-4047-AE9C-F84118A13ADE}.Debug|x64.Build.0 = Debug|x64
{290557A9-3D88-4047-AE9C-F84118A13ADE}.Debug|x86.ActiveCfg = Debug|Win32
{290557A9-3D88-4047-AE9C-F84118A13ADE}.Debug|x86.Build.0 = Debug|Win32
{290557A9-3D88-4047-AE9C-F84118A13ADE}.MinSizeRel|x64.ActiveCfg = Release|x64
{290557A9-3D88-4047-AE9C-F84118A13ADE}.MinSizeRel|x64.Build.0 = Release|x64
{290557A9-3D88-4047-AE9C-F84118A13ADE}.MinSizeRel|x86.ActiveCfg = Release|Win32
{290557A9-3D88-4047-AE9C-F84118A13ADE}.MinSizeRel|x86.Build.0 = Release|Win32
{290557A9-3D88-4047-AE9C-F84118A13ADE}.Release|x64.ActiveCfg = Release|x64
{290557A9-3D88-4047-AE9C-F84118A13ADE}.Release|x64.Build.0 = Release|x64
{290557A9-3D88-4047-AE9C-F84118A13ADE}.Release|x86.ActiveCfg = Release|Win32
{290557A9-3D88-4047-AE9C-F84118A13ADE}.Release|x86.Build.0 = Release|Win32
{290557A9-3D88-4047-AE9C-F84118A13ADE}.RelWithDebInfo|x64.ActiveCfg = Release|x64
{290557A9-3D88-4047-AE9C-F84118A13ADE}.RelWithDebInfo|x64.Build.0 = Release|x64
{290557A9-3D88-4047-AE9C-F84118A13ADE}.RelWithDebInfo|x86.ActiveCfg = Release|Win32
{290557A9-3D88-4047-AE9C-F84118A13ADE}.RelWithDebInfo|x86.Build.0 = Release|Win32
{DC50FB1F-44E3-478C-9CE3-C82F809309AD}.Debug|x64.ActiveCfg = Debug|x64
{DC50FB1F-44E3-478C-9CE3-C82F809309AD}.Debug|x64.Build.0 = Debug|x64
{DC50FB1F-44E3-478C-9CE3-C82F809309AD}.Debug|x86.ActiveCfg = Debug|Win32
{DC50FB1F-44E3-478C-9CE3-C82F809309AD}.Debug|x86.Build.0 = Debug|Win32
{DC50FB1F-44E3-478C-9CE3-C82F809309AD}.MinSizeRel|x64.ActiveCfg = Release|x64
{DC50FB1F-44E3-478C-9CE3-C82F809309AD}.MinSizeRel|x64.Build.0 = Release|x64
{DC50FB1F-44E3-478C-9CE3-C82F809309AD}.MinSizeRel|x86.ActiveCfg = Release|Win32
{DC50FB1F-44E3-478C-9CE3-C82F809309AD}.MinSizeRel|x86.Build.0 = Release|Win32
{DC50FB1F-44E3-478C-9CE3-C82F809309AD}.Release|x64.ActiveCfg = Release|x64
{DC50FB1F-44E3-478C-9CE3-C82F809309AD}.Release|x64.Build.0 = Release|x64
{DC50FB1F-44E3-478C-9CE3-C82F809309AD}.Release|x86.ActiveCfg = Release|Win32
{DC50FB1F-44E3-478C-9CE3-C82F809309AD}.Release|x86.Build.0 = Release|Win32
{DC50FB1F-44E3-478C-9CE3-C82F809309AD}.RelWithDebInfo|x64.ActiveCfg = Release|x64
{DC50FB1F-44E3-478C-9CE3-C82F809309AD}.RelWithDebInfo|x64.Build.0 = Release|x64
{DC50FB1F-44E3-478C-9CE3-C82F809309AD}.RelWithDebInfo|x86.ActiveCfg = Release|Win32
{DC50FB1F-44E3-478C-9CE3-C82F809309AD}.RelWithDebInfo|x86.Build.0 = Release|Win32
{5427E0AA-9701-4AD6-B223-7404B614BA04}.Debug|x64.ActiveCfg = Debug|x64
{5427E0AA-9701-4AD6-B223-7404B614BA04}.Debug|x64.Build.0 = Debug|x64
{5427E0AA-9701-4AD6-B223-7404B614BA04}.Debug|x86.ActiveCfg = Debug|Win32
{5427E0AA-9701-4AD6-B223-7404B614BA04}.Debug|x86.Build.0 = Debug|Win32
{5427E0AA-9701-4AD6-B223-7404B614BA04}.MinSizeRel|x64.ActiveCfg = Release|x64
{5427E0AA-9701-4AD6-B223-7404B614BA04}.MinSizeRel|x64.Build.0 = Release|x64
{5427E0AA-9701-4AD6-B223-7404B614BA04}.MinSizeRel|x86.ActiveCfg = Release|Win32
{5427E0AA-9701-4AD6-B223-7404B614BA04}.MinSizeRel|x86.Build.0 = Release|Win32
{5427E0AA-9701-4AD6-B223-7404B614BA04}.Release|x64.ActiveCfg = Release|x64
{5427E0AA-9701-4AD6-B223-7404B614BA04}.Release|x64.Build.0 = Release|x64
{5427E0AA-9701-4AD6-B223-7404B614BA04}.Release|x86.ActiveCfg = Release|Win32
{5427E0AA-9701-4AD6-B223-7404B614BA04}.Release|x86.Build.0 = Release|Win32
{5427E0AA-9701-4AD6-B223-7404B614BA04}.RelWithDebInfo|x64.ActiveCfg = Release|x64
{5427E0AA-9701-4AD6-B223-7404B614BA04}.RelWithDebInfo|x64.Build.0 = Release|x64
{5427E0AA-9701-4AD6-B223-7404B614BA04}.RelWithDebInfo|x86.ActiveCfg = Release|Win32
{5427E0AA-9701-4AD6-B223-7404B614BA04}.RelWithDebInfo|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
22 changes: 22 additions & 0 deletions panitent.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
<ClCompile Include="src\floatingwindowcontainer.c" />
<ClCompile Include="src\glwindow.c" />
<ClCompile Include="src\grimstroke\bresenhamshapestrategy.c" />
<ClCompile Include="src\grimstroke\msaa.c" />
<ClCompile Include="src\grimstroke\msaaplotterproxy.c" />
<ClCompile Include="src\grimstroke\pixelbuffer.c" />
<ClCompile Include="src\grimstroke\plotter.c" />
<ClCompile Include="src\grimstroke\polygon.c" />
Expand All @@ -72,6 +74,10 @@
<ClCompile Include="src\pntxml.c" />
<ClCompile Include="src\propgriddialog.c" />
<ClCompile Include="src\rbhashmapviz.c" />
<ClCompile Include="src\s11n\bsonserializer.c" />
<ClCompile Include="src\s11n\jsonserializer.c" />
<ClCompile Include="src\s11n\serializable_example.c" />
<ClCompile Include="src\s11n\xmlserializer.c" />
<ClCompile Include="src\settings.c" />
<ClCompile Include="src\settings_dialog.c" />
<ClCompile Include="src\settings_wnd.c" />
Expand Down Expand Up @@ -142,7 +148,11 @@
<ClInclude Include="src\flexible.h" />
<ClInclude Include="src\floatingwindowcontainer.h" />
<ClInclude Include="src\glwindow.h" />
<ClInclude Include="src\grimstroke\basic_plotter.h" />
<ClInclude Include="src\grimstroke\bresenhamshapestrategy.h" />
<ClInclude Include="src\grimstroke\msaa.h" />
<ClInclude Include="src\grimstroke\msaaplotterproxy.h" />
<ClInclude Include="src\grimstroke\path.h" />
<ClInclude Include="src\grimstroke\pixelbuffer.h" />
<ClInclude Include="src\grimstroke\plotter.h" />
<ClInclude Include="src\grimstroke\polygon.h" />
Expand Down Expand Up @@ -173,7 +183,13 @@
<ClInclude Include="src\propgriddialog.h" />
<ClInclude Include="src\rbhashmapviz.h" />
<ClInclude Include="src\resource.h" />
<ClInclude Include="src\s11n\bsonserializer.h" />
<ClInclude Include="src\s11n\tentany.h" />
<ClInclude Include="src\s11n\jsonserializer.h" />
<ClInclude Include="src\s11n\xmlserializer.h" />
<ClInclude Include="src\sdk\panitent.h" />
<ClInclude Include="src\s11n\propertytree.h" />
<ClInclude Include="src\s11n\serializable_example.h" />
<ClInclude Include="src\settings.h" />
<ClInclude Include="src\settings_dialog.h" />
<ClInclude Include="src\settings_wnd.h" />
Expand All @@ -188,6 +204,8 @@
<ClInclude Include="src\splittercontainer.h" />
<ClInclude Include="src\swatch.h" />
<ClInclude Include="src\swatch2.h" />
<ClInclude Include="src\swatchstorage.h" />
<ClInclude Include="src\swatchstoragebase.h" />
<ClInclude Include="src\test.h" />
<ClInclude Include="src\tool.h" />
<ClInclude Include="src\toolbox.h" />
Expand All @@ -213,7 +231,11 @@
<ClInclude Include="src\util\pntstring.h" />
<ClInclude Include="src\util\queue.h" />
<ClInclude Include="src\util\rbhashmap.h" />
<ClInclude Include="src\s11n\serializable.h" />
<ClInclude Include="src\s11n\serializer.h" />
<ClInclude Include="src\util\stack.h" />
<ClInclude Include="src\util\tentobj.h" />
<ClInclude Include="src\util\tenttypes.h" />
<ClInclude Include="src\util\tree.h" />
<ClInclude Include="src\util\utf.h" />
<ClInclude Include="src\util\vector.h" />
Expand Down
16 changes: 16 additions & 0 deletions panitent.vcxproj.user
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,20 @@
<PropertyGroup>
<ShowAllFiles>true</ShowAllFiles>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerCommandArguments>--enable-experimental-dock</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerCommandArguments>--enable-experimental-dock</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerCommandArguments>--enable-experimental-dock</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerCommandArguments>--enable-experimental-dock</LocalDebuggerCommandArguments>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>
3 changes: 3 additions & 0 deletions panitent_test.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
<Project>{f95c4ef5-0539-455c-b247-96029c28e36d}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="cpp.hint" />
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
Expand Down
2 changes: 1 addition & 1 deletion panitent_test/test_application.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ void TestApplication_Init(TestApplication* app)
Application_Init(&app->base);

app->palette = Palette_Create();
app->mainWindow = TestWindow_Create(app);
app->mainWindow = TestWindow_$new(app);
}

TestApplication* TestApplication_Create()
Expand Down
16 changes: 9 additions & 7 deletions panitent_test/test_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@

#include "test_application.h"
#include "../src/palette_window.h"
#include "../src/util/tentobj.h"

static const WCHAR szClassName[] = L"TestWindowClass";

TestWindow* TestWindow_Create(struct Application* app);
void TestWindow_Init(TestWindow*, Application*);
/* Forward declarations */
DECLARE_$NEW(TestWindow)
void TestWindow_$init(TestWindow*, Application*);

void TestWindow_PreRegister(LPWNDCLASSEX);
void TestWindow_PreCreate(LPCREATESTRUCT);
Expand All @@ -17,21 +19,21 @@ void TestWindow_OnSize(TestWindow*, UINT, int, int);
void TestWindow_OnPaint(TestWindow*);
LRESULT CALLBACK TestWindow_UserProc(struct Window*, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);

TestWindow* TestWindow_Create(struct Application* app)
TestWindow* TestWindow_$new()
{
TestWindow* pTestWindow = (TestWindow*)malloc(sizeof(TestWindow));
if (pTestWindow)
{
memset(pTestWindow, 0, sizeof(TestWindow));
TestWindow_Init(pTestWindow, app);
TestWindow_$init(pTestWindow);
}

return pTestWindow;
}

void TestWindow_Init(TestWindow* window, struct Application* app)
void TestWindow_$init(TestWindow* window)
{
Window_Init(&window->base, app);
Window_$init(&window->base);

window->base.szClassName = szClassName;

Expand All @@ -41,7 +43,7 @@ void TestWindow_Init(TestWindow* window, struct Application* app)
window->base.OnPaint = TestWindow_OnPaint;
window->base.UserProc = TestWindow_UserProc;

window->paletteWindow = PaletteWindow_Create(window->base.app, ((struct TestApplication*)app)->palette);
window->paletteWindow = PaletteWindow_Create(((struct TestApplication*)app)->palette);
}

LRESULT CALLBACK TestWindow_UserProc(struct Window* window, HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
Expand Down
2 changes: 1 addition & 1 deletion panitent_test/test_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ struct TestWindow {
PaletteWindow* paletteWindow;
};

TestWindow* TestWindow_Create(Application*);
TestWindow* TestWindow_$new(Application*);

#endif /* _TEST_WINDOW_H_INLUCDED */
53 changes: 25 additions & 28 deletions src/canvas.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,30 @@ uint32_t color_opacity(uint32_t color, float opacity)

uint32_t mix(uint32_t base, uint32_t overlay)
{
float baseA = (base >> 24 & 0xFF) / 255.f;
float baseR = (base >> 16 & 0xFF) / 255.f;
float baseG = (base >> 8 & 0xFF) / 255.f;
float baseB = (base & 0xFF) / 255.f;

float overlayA = (overlay >> 24 & 0xFF) / 255.f;
float overlayR = (overlay >> 16 & 0xFF) / 255.f;
float overlayG = (overlay >> 8 & 0xFF) / 255.f;
float overlayB = (overlay & 0xFF) / 255.f;

/*
float blendR = baseR * overlayA + overlayR * (1.f - overlayA);
float blendG = baseG * overlayA + overlayG * (1.f - overlayA);
float blendB = baseB * overlayA + overlayB * (1.f - overlayA);
*/

float resultR = (1.f - overlayA) * baseR + overlayA * overlayR;
float resultG = (1.f - overlayA) * baseG + overlayA * overlayG;
float resultB = (1.f - overlayA) * baseB + overlayA * overlayB;
float resultA = 1.f - (1.f - baseA) * (1.f - overlayA);

uint8_t a = (uint8_t)roundf(resultA * 255.f);
uint8_t r = (uint8_t)roundf(resultR * 255.f);
uint8_t g = (uint8_t)roundf(resultG * 255.f);
uint8_t b = (uint8_t)roundf(resultB * 255.f);

return ARGB(a, r, g, b);
/* extract base color components */
uint8_t baseA = (base >> 24) & 0xFF;
uint8_t baseR = (base >> 16) & 0xFF;
uint8_t baseG = (base >> 8) & 0xFF;
uint8_t baseB = base & 0xFF;

/* Extract overlay color components */
uint8_t overlayA = (overlay >> 24) & 0xFF;
uint8_t overlayR = (overlay >> 16) & 0xFF;
uint8_t overlayG = (overlay >> 8) & 0xFF;
uint8_t overlayB = overlay & 0xFF;

/* Precompute scaled alpha for base and overlay */
uint16_t invOverlayA = 255 - overlayA;

/* Blend the RGB channels directly using integer math */
uint8_t resultR = (uint8_t)((baseR * invOverlayA + overlayR * overlayA) / 255);
uint8_t resultG = (uint8_t)((baseG * invOverlayA + overlayG * overlayA) / 255);
uint8_t resultB = (uint8_t)((baseB * invOverlayA + overlayB * overlayA) / 255);

/* Blend alpha channel (premultiply the inverse alpha blend) */
uint8_t resultA = (uint8_t)(255 - ((255 - baseA) * invOverlayA / 255));

return (resultA << 24) | (resultR << 16) | (resultG << 8) | resultB;
}

void* Canvas_BufferAlloc(Canvas* canvas)
Expand Down Expand Up @@ -456,7 +453,7 @@ void Canvas_DrawLine(const Canvas* pCanvas, int x1, int y1, int x2, int y2)
PlotterData* pPlotterData = (PlotterData*)malloc(sizeof(PlotterData));
ASSERT(pPlotterData);
pPlotterData->canvas = pCanvas;
pPlotterData->color = 0xFF0000FF;
pPlotterData->color = 0xCCFF00CC;
plotter.userData = pPlotterData;
plotter.fn = PixelPlotterCallback;

Expand Down
4 changes: 2 additions & 2 deletions src/dockhost.c
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ void DockHostWindow_UndockToFloating(DockHostWindow* pDockHostWindow, TreeNode*
Window_CreateWindow((Window*)pFloatingWindowContainer, NULL);
FloatingWindowContainer_PinWindow(pFloatingWindowContainer, ((DockData*)pNode->data)->hWnd);

DockHostWindow_Rearrange(pDockHostWindow, pNode);
DockHostWindow_Rearrange(pDockHostWindow);

DestroyWindow(g_hWndDragOverlay);
}
Expand Down Expand Up @@ -996,7 +996,7 @@ void DockHostWindow_PreCreate(LPCREATESTRUCT lpcs)

void DockHostWindow_Init(DockHostWindow* pDockHostWindow, PanitentApp* pPanitentApp)
{
Window_Init(&pDockHostWindow->base, pPanitentApp);
Window_Init(&pDockHostWindow->base);

pDockHostWindow->base.szClassName = szClassName;

Expand Down
2 changes: 1 addition & 1 deletion src/experimental/dockwindow.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void DockHostWindow2_Init(DockHostWindow2* pDockHostWindow2, Application* pAppli
{
memset(pDockHostWindow2, 0, sizeof(DockHostWindow2));

Window_Init(&pDockHostWindow2->base, pApplication);
Window_Init(&pDockHostWindow2->base);

_WindowInitHelper_SetPreCreateRoutine(pDockHostWindow2, (FnWindowPreCreate)DockHostWindow2_PreCreate);
_WindowInitHelper_SetPreRegisterRoutine(pDockHostWindow2, (FnWindowPreRegister)DockHostWindow2_PreRegister);
Expand Down
4 changes: 2 additions & 2 deletions src/floatingwindowcontainer.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ static const WCHAR szClassName[] = L"__FloatingWindowContainer";

/* Private forward declarations */
FloatingWindowContainer* FloatingWindowContainer_Create();
void FloatingWindowContainer_Init(FloatingWindowContainer*);
void FloatingWindowContainer_Init(FloatingWindowContainer*, Application* app);

void FloatingWindowContainer_PreRegister(LPWNDCLASSEX);
void FloatingWindowContainer_PreCreate(LPCREATESTRUCT);
Expand Down Expand Up @@ -272,7 +272,7 @@ FloatingWindowContainer* FloatingWindowContainer_Create(struct Application* app)

void FloatingWindowContainer_Init(FloatingWindowContainer* window, struct Application* app)
{
Window_Init(&window->base, app);
Window_Init(&window->base);

window->base.szClassName = szClassName;

Expand Down
35 changes: 35 additions & 0 deletions src/grimstroke/basic_plotter.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#ifndef PANITENT_GRIMSTROKE_BASICPLOTTER_H
#define PANITENT_GRIMSTROKE_BASICPLOTTER_H

typedef struct BasicPlotter BasicPlotter;

struct BasicPlotter_vtbl {
void (*DrawPixel)(BasicPlotter* plotterContext, float xPos, float yPos);
};

struct BasicPlotter {
struct BasicPlotter_vtbl* pVtbl;
};

void __impl_BasicPlotter_DrawPixel(BasicPlotter* plotterContext, float xPos, float yPos);

struct BasicPlotter_vtbl __g_BasicPlotter_vtbl = {
.DrawPixel = __impl_BasicPlotter_DrawPixel
};

void BasicPlotter_Init(BasicPlotter* plotterContext)
{
plotterContext->pVtbl = &__g_BasicPlotter_vtbl;
}

inline BasicPlotter_DrawPixel(BasicPlotter* plotterContext, float xPos, float yPos)
{
plotterContext->pVtbl->DrawPixel(plotterContext, xPos, yPos);
}

void __impl_BasicPlotter_DrawPixel(BasicPlotter* plotterContext, float xPos, float yPos)
{

}

#endif // PANITENT_GRIMSTROKE_BASICPLOTTER
Loading

0 comments on commit 48a332e

Please sign in to comment.