diff options
author | Fox Caminiti <fox@foxcam.net> | 2023-01-06 10:26:43 -0500 |
---|---|---|
committer | Fox Caminiti <fox@foxcam.net> | 2023-01-06 10:26:43 -0500 |
commit | 1de48570b220acc1ca7063e2a9cda1e89178c0f9 (patch) | |
tree | 1edd38bd7ad7f95f865793a9d0e54c62aa3bf37e /src/include | |
parent | eebbdd012b0d156e9e92369585c6ad82ed3de371 (diff) |
bad shape positioning
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/debug.h | 2 | ||||
-rw-r--r-- | src/include/functions.h | 8 | ||||
-rw-r--r-- | src/include/layer.h | 2 | ||||
-rw-r--r-- | src/include/main.h | 9 | ||||
-rw-r--r-- | src/include/nanovg.h | 29 |
5 files changed, 44 insertions, 6 deletions
diff --git a/src/include/debug.h b/src/include/debug.h index e1d8ccc..3ddbdc8 100644 --- a/src/include/debug.h +++ b/src/include/debug.h @@ -27,7 +27,7 @@ struct debug_temp struct project_debug { debug_temp Temp; - bool32 ToggleWindow = 1; + bool32 ToggleWindow = 0; bool32 ReloadUI = true; bool32 NoThreading = 0; bool32 DisableAlpha = 0; diff --git a/src/include/functions.h b/src/include/functions.h index e7b5e44..32737ea 100644 --- a/src/include/functions.h +++ b/src/include/functions.h @@ -18,11 +18,15 @@ static void Bezier_Interact_Evaluate(project_state *State, bezier_poin static void Bezier_Add(memory *Memory, memory_table_list TableName, property_channel *Property, bezier_point PointData, uint16 *ArrayLocation); static void Bezier_Add(memory *Memory, memory_table_list TableName, uint16 *Block_Bezier_Index, uint16 *Block_Bezier_Count, uint16 *PointCount, bezier_point PointData); -uint32 Bezier_CubicCalcPoints(v2 p1, v2 p2, v2 p3, v2 p4, void *Data, uint32 Size); +void * Bezier_CubicCalcPoints(v2 p1, v2 p2, v2 p3, v2 p4, void *Data, uint32 Size); + +static layer_transforms Transform_Inverse(layer_transforms T); + +static v2 T_CompPosToLayerPos(layer_transforms T, uint32 FileWidth, uint32 FileHeight, uint32 SourceWidth, uint32 SourceHeight, real32 X, real32 Y); static void GL_RasterizeShape(gl_effect_layer *TestL, gl_effect_layer *TestM, void *StrokeData, void *FillData, uint32 StrokeCount, uint32 FillCount, - layer_transforms T, int Width, int Height, int BytesPerPixel, void *EffectBitmapAddress, int L_Width, int L_Height, v4 Col, int RenderMode); + layer_transforms T, int Width, int Height, int BytesPerPixel, void *EffectBitmapAddress, int L_Width, int L_Height, v4 FillCol, v4 StrokeCol, int RenderMode); static void ImGui_ProcessInputs(project_data *File, project_state *State, ui *UI, memory *Memory, ImGuiIO io, sorted_file Sorted); static void ImGui_PropertiesPanel(project_data *File, project_state *State, ui *UI, memory *Memory, ImGuiIO io, sorted_comp_array *SortedCompArray, sorted_layer_array *SortedLayerArray, sorted_property_array *SortedPropertyStart, uint16 *SortedKeyframeArray); diff --git a/src/include/layer.h b/src/include/layer.h index 85d980d..bf32aca 100644 --- a/src/include/layer.h +++ b/src/include/layer.h @@ -12,7 +12,7 @@ Layer_GetTopOffset(project_data *File, memory *Memory); static void Layer_UpdateMasksEffects(project_state *State, block_layer *Layer, memory *Memory, void *EffectBitmapAddress, - int Width, int Height, int BytesPerPixel); + int Width, int Height, int BytesPerPixel, int CompWidth, int CompHeight); static void Layer_ToggleChannel(project_data *File, memory *Memory, int32 a); diff --git a/src/include/main.h b/src/include/main.h index a39fe45..db384ce 100644 --- a/src/include/main.h +++ b/src/include/main.h @@ -183,11 +183,14 @@ struct sorted_file uint64 Source_SortSize; }; + struct shape_options { int Visibility; v4 FillCol = {1, 1, 1, 1}; - v4 StrokeCol = {1, 1, 1, 1}; - float StrokeWidth = 50; + v4 StrokeCol = {0, 1, 0, 1}; + float StrokeWidth = 10; + nvg_line_cap LineJoinType = NVG_ROUND; + nvg_line_cap LineCapType = NVG_ROUND; }; struct shape_layer { @@ -196,6 +199,8 @@ struct shape_layer { uint16 Point_Count; bool32 IsClosed; bool32 Contiguous = 1; // No points have been deleted/added, so sorting isn't needed. + // NOTE(fox): This is kinda lazily done atm, there may be situations where + // this isn't the correct value. int Width; int Height; shape_options Opt; diff --git a/src/include/nanovg.h b/src/include/nanovg.h new file mode 100644 index 0000000..c6df6b4 --- /dev/null +++ b/src/include/nanovg.h @@ -0,0 +1,29 @@ + +enum nvg_line_cap { + NVG_BUTT, + NVG_ROUND, // join and line type + NVG_SQUARE, + NVG_BEVEL, // join type + NVG_MITER, // join type +}; + +enum nvg_point_flags +{ + NVG_PT_CORNER = 0x01, + NVG_PT_LEFT = 0x02, + NVG_PT_BEVEL = 0x04, + NVG_PR_INNERBEVEL = 0x08, +}; + +struct nvg_point +{ + real32 x; + real32 y; + real32 dx; + real32 dy; + real32 Length; + real32 dmx; + real32 dmy; + uint8 Flags; +}; + |