From f94b50fdf0ff3bfa93a345b0bbd52019f2cbc7a5 Mon Sep 17 00:00:00 2001 From: Paul Manias Date: Tue, 31 Dec 2024 12:34:26 +0000 Subject: [PATCH] Cleanup --- include/parasol/modules/core.h | 1 + include/parasol/modules/vector.h | 3 + include/parasol/system/fields.h | 2 + src/core/defs/core.fdl | 1 + src/core/defs/fields.fdl | 2 + src/vector/defs/gradient.cpp | 10 +-- src/vector/filters/filter_image.cpp | 16 ++--- src/vector/utility.cpp | 34 ---------- src/vector/vector.cpp | 102 ++++++++++++++-------------- src/vector/vector.fdl | 3 + src/vector/vector.h | 2 +- 11 files changed, 77 insertions(+), 99 deletions(-) diff --git a/include/parasol/modules/core.h b/include/parasol/modules/core.h index 08a0c51a..61c3fa03 100644 --- a/include/parasol/modules/core.h +++ b/include/parasol/modules/core.h @@ -1696,6 +1696,7 @@ struct FieldValue { constexpr FieldValue(ULONG pFID, CSTRING pValue) : FieldID(pFID), Type(FD_STRING), String(pValue) { }; constexpr FieldValue(ULONG pFID, LONG pValue) : FieldID(pFID), Type(FD_LONG), Long(pValue) { }; constexpr FieldValue(ULONG pFID, LARGE pValue) : FieldID(pFID), Type(FD_LARGE), Large(pValue) { }; + constexpr FieldValue(ULONG pFID, size_t pValue) : FieldID(pFID), Type(FD_LARGE), Large(pValue) { }; constexpr FieldValue(ULONG pFID, DOUBLE pValue) : FieldID(pFID), Type(FD_DOUBLE), Double(pValue) { }; constexpr FieldValue(ULONG pFID, SCALE pValue) : FieldID(pFID), Type(FD_DOUBLE|FD_SCALED), Percent(pValue) { }; constexpr FieldValue(ULONG pFID, const FUNCTION &pValue) : FieldID(pFID), Type(FDF_FUNCTIONPTR), CPointer(&pValue) { }; diff --git a/include/parasol/modules/vector.h b/include/parasol/modules/vector.h index e11b4f9c..d95875f5 100644 --- a/include/parasol/modules/vector.h +++ b/include/parasol/modules/vector.h @@ -3920,6 +3920,9 @@ inline void SET_VECTOR_COLOUR(objVectorColour *Colour, DOUBLE Red, DOUBLE Green, #define SVF_INTERCEPT 0x12b3db33 #define SVF_INVERT 0x04d5a7bd #define SVF_IDENTITY 0x68144eaf +#define SVF_L 0x0002b611 +#define SVF_M 0x0002b612 +#define SVF_N 0x0002b613 #define SVF_LINEAR 0x0b7641e0 #define SVF_TABLE 0x1068fa8d #define SVF_GAMMA 0x0f7deae8 diff --git a/include/parasol/system/fields.h b/include/parasol/system/fields.h index f59bbf32..ec8c83d5 100644 --- a/include/parasol/system/fields.h +++ b/include/parasol/system/fields.h @@ -930,10 +930,12 @@ #define FID_EventCallback 0xfc356c74LL #define FID_EventMask 0x354f38b3LL #define FID_Exponent 0xd4513596LL +#define FID_L 0x0002b611LL #define FID_LoopLimit 0xf4c76a9eLL #define FID_MatrixRows 0x64419145LL #define FID_MatrixColumns 0x54dc215bLL #define FID_Matrix 0x0d3e291aLL +#define FID_N 0x0002b613LL #define FID_OnChange 0xee446f88LL #define FID_PathTimestamp 0x2efda9a6LL #define FID_PreserveAlpha 0xf9b49d57LL diff --git a/src/core/defs/core.fdl b/src/core/defs/core.fdl index 416db7b7..fb1056cc 100644 --- a/src/core/defs/core.fdl +++ b/src/core/defs/core.fdl @@ -753,6 +753,7 @@ struct FieldValue { constexpr FieldValue(ULONG pFID, CSTRING pValue) : FieldID(pFID), Type(FD_STRING), String(pValue) { }; constexpr FieldValue(ULONG pFID, LONG pValue) : FieldID(pFID), Type(FD_LONG), Long(pValue) { }; constexpr FieldValue(ULONG pFID, LARGE pValue) : FieldID(pFID), Type(FD_LARGE), Large(pValue) { }; + constexpr FieldValue(ULONG pFID, size_t pValue) : FieldID(pFID), Type(FD_LARGE), Large(pValue) { }; constexpr FieldValue(ULONG pFID, DOUBLE pValue) : FieldID(pFID), Type(FD_DOUBLE), Double(pValue) { }; constexpr FieldValue(ULONG pFID, SCALE pValue) : FieldID(pFID), Type(FD_DOUBLE|FD_SCALED), Percent(pValue) { }; constexpr FieldValue(ULONG pFID, const FUNCTION &pValue) : FieldID(pFID), Type(FDF_FUNCTIONPTR), CPointer(&pValue) { }; diff --git a/src/core/defs/fields.fdl b/src/core/defs/fields.fdl index 93fb7c93..4ddd6b41 100644 --- a/src/core/defs/fields.fdl +++ b/src/core/defs/fields.fdl @@ -937,10 +937,12 @@ header({ path="system/fields", copyright="Paul Manias © 1996-2024" }, function( "EventCallback", "EventMask", "Exponent", + "L", "LoopLimit", "MatrixRows", "MatrixColumns", "Matrix", + "N", "OnChange", "PathTimestamp", "PreserveAlpha", diff --git a/src/vector/defs/gradient.cpp b/src/vector/defs/gradient.cpp index 2b97f708..bc728376 100644 --- a/src/vector/defs/gradient.cpp +++ b/src/vector/defs/gradient.cpp @@ -248,9 +248,9 @@ static ERR VECTORGRADIENT_SET_CenterY(extVectorGradient *Self, Unit &Value) -FIELD- Colour: The default background colour to use when clipping is enabled. -The colour value in this field is applicable only when a gradient is in clip-mode - by specifying the `VSPREAD::CLIP` -flag in #SpreadMethod. By default, this field has an alpha value of 0 to ensure that nothing is drawn -outside the initial bounds of the gradient. Setting any other colour value here will otherwise +The colour value in this field is applicable only when a gradient is in clip-mode - by specifying the `VSPREAD::CLIP` +flag in #SpreadMethod. By default, this field has an alpha value of 0 to ensure that nothing is drawn +outside the initial bounds of the gradient. Setting any other colour value here will otherwise fill-in those areas. The Colour value is defined in floating-point RGBA format, using a range of 0 - 1.0 per component. @@ -334,7 +334,7 @@ static ERR VECTORGRADIENT_SET_FocalRadius(extVectorGradient *Self, Unit &Value) -FIELD- FocalX: The horizontal focal point for radial gradients. -The `(FocalX, FocalY)` coordinates define the focal point for radial gradients. If left undefined, the focal point +The `(FocalX, FocalY)` coordinates define the focal point for radial gradients. If left undefined, the focal point will match the center of the gradient. *********************************************************************************************************************/ @@ -359,7 +359,7 @@ static ERR VECTORGRADIENT_SET_FocalX(extVectorGradient *Self, Unit &Value) -FIELD- FocalY: The vertical focal point for radial gradients. -The `(FocalX, FocalY)` coordinates define the focal point for radial gradients. If left undefined, the focal point +The `(FocalX, FocalY)` coordinates define the focal point for radial gradients. If left undefined, the focal point will match the center of the gradient. *********************************************************************************************************************/ diff --git a/src/vector/filters/filter_image.cpp b/src/vector/filters/filter_image.cpp index dd039d7d..3a405937 100644 --- a/src/vector/filters/filter_image.cpp +++ b/src/vector/filters/filter_image.cpp @@ -66,17 +66,17 @@ static ERR IMAGEFX_Draw(extImageFX *Self, struct acDraw *Args) if (dmf::hasAnyHeight(Self->Dimensions)) p_height = Self->Height * filter->BoundHeight; } else { - if (dmf::hasScaledX(Self->Dimensions)) p_x = filter->TargetX + (Self->X * filter->TargetWidth); - else if (dmf::hasX(Self->Dimensions)) p_x = Self->X; + if (dmf::hasScaledX(Self->Dimensions)) p_x = filter->TargetX + (Self->X * filter->TargetWidth); + else if (dmf::hasX(Self->Dimensions)) p_x = Self->X; - if (dmf::hasScaledY(Self->Dimensions)) p_y = filter->TargetY + (Self->Y * filter->TargetHeight); - else if (dmf::hasY(Self->Dimensions)) p_y = Self->Y; + if (dmf::hasScaledY(Self->Dimensions)) p_y = filter->TargetY + (Self->Y * filter->TargetHeight); + else if (dmf::hasY(Self->Dimensions)) p_y = Self->Y; - if (dmf::hasScaledWidth(Self->Dimensions)) p_width = filter->TargetWidth * Self->Width; - else if (dmf::hasWidth(Self->Dimensions)) p_width = Self->Width; + if (dmf::hasScaledWidth(Self->Dimensions)) p_width = filter->TargetWidth * Self->Width; + else if (dmf::hasWidth(Self->Dimensions)) p_width = Self->Width; - if (dmf::hasScaledHeight(Self->Dimensions)) p_height = filter->TargetHeight * Self->Height; - else if (dmf::hasHeight(Self->Dimensions)) p_height = Self->Height; + if (dmf::hasScaledHeight(Self->Dimensions)) p_height = filter->TargetHeight * Self->Height; + else if (dmf::hasHeight(Self->Dimensions)) p_height = Self->Height; } DOUBLE xScale = 1, yScale = 1, align_x = 0, align_y = 0; diff --git a/src/vector/utility.cpp b/src/vector/utility.cpp index 5a2c0e45..9b59793d 100644 --- a/src/vector/utility.cpp +++ b/src/vector/utility.cpp @@ -8,40 +8,6 @@ static void read_numseq_zero(CSTRING &, std::initializer_list); //******************************************************************************************************************** -static CSTRING get_effect_name(UBYTE Effect) __attribute__ ((unused)); -static CSTRING get_effect_name(UBYTE Effect) -{ - static const CSTRING effects[] = { - "Null", - "Blend", - "ColourMatrix", - "ComponentTransfer", - "Composite", - "ConvolveMatrix", - "DiffuseLighting", - "DisplacementMap", - "Flood", - "Blur", - "Image", - "Merge", - "Morphology", - "Offset", - "SpecularLighting", - "Tile", - "Turbulence", - "DistantLight", - "PointLight", - "Spotlight" - }; - - if ((Effect >= 0) and (Effect < std::ssize(effects))) { - return effects[Effect]; - } - else return "Unknown"; -} - -//******************************************************************************************************************** - const FieldDef clAspectRatio[] = { { "XMin", ARF::X_MIN }, { "XMid", ARF::X_MID }, diff --git a/src/vector/vector.cpp b/src/vector/vector.cpp index f60bc55b..ac54abd5 100644 --- a/src/vector/vector.cpp +++ b/src/vector/vector.cpp @@ -16,19 +16,19 @@ JUMPTABLE_DISPLAY JUMPTABLE_CORE JUMPTABLE_FONT -OBJECTPTR clVectorScene = NULL, clVectorViewport = NULL, clVectorGroup = NULL, clVectorColour = NULL; -OBJECTPTR clVectorEllipse = NULL, clVectorRectangle = NULL, clVectorPath = NULL, clVectorWave = NULL; -OBJECTPTR clVectorFilter = NULL, clVectorPolygon = NULL, clVectorText = NULL, clVectorClip = NULL; -OBJECTPTR clVectorGradient = NULL, clVectorImage = NULL, clVectorPattern = NULL, clVector = NULL; -OBJECTPTR clVectorSpiral = NULL, clVectorShape = NULL, clVectorTransition = NULL, clImageFX = NULL; -OBJECTPTR clBlurFX = NULL, clColourFX = NULL, clCompositeFX = NULL, clConvolveFX = NULL, clFilterEffect = NULL; -OBJECTPTR clFloodFX = NULL, clMergeFX = NULL, clMorphologyFX = NULL, clOffsetFX = NULL, clTurbulenceFX = NULL; OBJECTPTR clSourceFX = NULL, clRemapFX = NULL, clLightingFX = NULL, clDisplacementFX = NULL; - -static OBJECTPTR modDisplay = NULL; -static OBJECTPTR modFont = NULL; -OBJECTPTR glVectorModule = NULL; -FT_Library glFTLibrary = NULL; +OBJECTPTR clVectorScene = nullptr, clVectorViewport = nullptr, clVectorGroup = nullptr, clVectorColour = nullptr; +OBJECTPTR clVectorEllipse = nullptr, clVectorRectangle = nullptr, clVectorPath = nullptr, clVectorWave = nullptr; +OBJECTPTR clVectorFilter = nullptr, clVectorPolygon = nullptr, clVectorText = nullptr, clVectorClip = nullptr; +OBJECTPTR clVectorGradient = nullptr, clVectorImage = nullptr, clVectorPattern = nullptr, clVector = nullptr; +OBJECTPTR clVectorSpiral = nullptr, clVectorShape = nullptr, clVectorTransition = nullptr, clImageFX = nullptr; +OBJECTPTR clBlurFX = nullptr, clColourFX = nullptr, clCompositeFX = nullptr, clConvolveFX = nullptr, clFilterEffect = nullptr; +OBJECTPTR clFloodFX = nullptr, clMergeFX = nullptr, clMorphologyFX = nullptr, clOffsetFX = nullptr, clTurbulenceFX = nullptr; + +static OBJECTPTR modDisplay = nullptr; +static OBJECTPTR modFont = nullptr; +OBJECTPTR glVectorModule = nullptr; +FT_Library glFTLibrary = nullptr; std::recursive_mutex glVectorFocusLock; std::vector glVectorFocusList; // The first reference is the most foreground object with the focus @@ -115,51 +115,51 @@ static ERR MODExpunge(void) glBitmapFonts.clear(); glFreetypeFonts.clear(); - if (glFTLibrary) { FT_Done_FreeType(glFTLibrary); glFTLibrary = NULL; } + if (glFTLibrary) { FT_Done_FreeType(glFTLibrary); glFTLibrary = nullptr; } - if (modDisplay) { FreeResource(modDisplay); modDisplay = NULL; } - if (modFont) { FreeResource(modFont); modFont = NULL; } + if (modDisplay) { FreeResource(modDisplay); modDisplay = nullptr; } + if (modFont) { FreeResource(modFont); modFont = nullptr; } // Sub-classes - if (clVectorShape) { FreeResource(clVectorShape); clVectorShape = NULL; } - if (clVectorSpiral) { FreeResource(clVectorSpiral); clVectorSpiral = NULL; } - if (clVectorScene) { FreeResource(clVectorScene); clVectorScene = NULL; } - if (clVectorClip) { FreeResource(clVectorClip); clVectorClip = NULL; } - if (clVectorColour) { FreeResource(clVectorColour); clVectorColour = NULL; } - if (clVectorRectangle) { FreeResource(clVectorRectangle); clVectorRectangle = NULL; } - if (clVectorEllipse) { FreeResource(clVectorEllipse); clVectorEllipse = NULL; } - if (clVectorPath) { FreeResource(clVectorPath); clVectorPath = NULL; } - if (clVectorPolygon) { FreeResource(clVectorPolygon); clVectorPolygon = NULL; } - if (clVectorText) { FreeResource(clVectorText); clVectorText = NULL; } - if (clVectorGradient) { FreeResource(clVectorGradient); clVectorGradient = NULL; } - if (clVectorGroup) { FreeResource(clVectorGroup); clVectorGroup = NULL; } - if (clVectorViewport) { FreeResource(clVectorViewport); clVectorViewport = NULL; } - if (clVectorPattern) { FreeResource(clVectorPattern); clVectorPattern = NULL; } - if (clVectorFilter) { FreeResource(clVectorFilter); clVectorFilter = NULL; } - if (clVectorImage) { FreeResource(clVectorImage); clVectorImage = NULL; } - if (clVectorWave) { FreeResource(clVectorWave); clVectorWave = NULL; } - if (clVectorTransition) { FreeResource(clVectorTransition); clVectorTransition = NULL; } - - if (clImageFX) { FreeResource(clImageFX); clImageFX = NULL; } - if (clSourceFX) { FreeResource(clSourceFX); clSourceFX = NULL; } - if (clBlurFX) { FreeResource(clBlurFX); clBlurFX = NULL; } - if (clColourFX) { FreeResource(clColourFX); clColourFX = NULL; } - if (clCompositeFX) { FreeResource(clCompositeFX); clCompositeFX = NULL; } - if (clConvolveFX) { FreeResource(clConvolveFX); clConvolveFX = NULL; } - if (clFloodFX) { FreeResource(clFloodFX); clFloodFX = NULL; } - if (clMergeFX) { FreeResource(clMergeFX); clMergeFX = NULL; } - if (clMorphologyFX) { FreeResource(clMorphologyFX); clMorphologyFX = NULL; } - if (clOffsetFX) { FreeResource(clOffsetFX); clOffsetFX = NULL; } - if (clTurbulenceFX) { FreeResource(clTurbulenceFX); clTurbulenceFX = NULL; } - if (clRemapFX) { FreeResource(clRemapFX); clRemapFX = NULL; } - if (clLightingFX) { FreeResource(clLightingFX); clLightingFX = NULL; } - if (clDisplacementFX) { FreeResource(clDisplacementFX); clDisplacementFX = NULL; } + if (clVectorShape) { FreeResource(clVectorShape); clVectorShape = nullptr; } + if (clVectorSpiral) { FreeResource(clVectorSpiral); clVectorSpiral = nullptr; } + if (clVectorScene) { FreeResource(clVectorScene); clVectorScene = nullptr; } + if (clVectorClip) { FreeResource(clVectorClip); clVectorClip = nullptr; } + if (clVectorColour) { FreeResource(clVectorColour); clVectorColour = nullptr; } + if (clVectorRectangle) { FreeResource(clVectorRectangle); clVectorRectangle = nullptr; } + if (clVectorEllipse) { FreeResource(clVectorEllipse); clVectorEllipse = nullptr; } + if (clVectorPath) { FreeResource(clVectorPath); clVectorPath = nullptr; } + if (clVectorPolygon) { FreeResource(clVectorPolygon); clVectorPolygon = nullptr; } + if (clVectorText) { FreeResource(clVectorText); clVectorText = nullptr; } + if (clVectorGradient) { FreeResource(clVectorGradient); clVectorGradient = nullptr; } + if (clVectorGroup) { FreeResource(clVectorGroup); clVectorGroup = nullptr; } + if (clVectorViewport) { FreeResource(clVectorViewport); clVectorViewport = nullptr; } + if (clVectorPattern) { FreeResource(clVectorPattern); clVectorPattern = nullptr; } + if (clVectorFilter) { FreeResource(clVectorFilter); clVectorFilter = nullptr; } + if (clVectorImage) { FreeResource(clVectorImage); clVectorImage = nullptr; } + if (clVectorWave) { FreeResource(clVectorWave); clVectorWave = nullptr; } + if (clVectorTransition) { FreeResource(clVectorTransition); clVectorTransition = nullptr; } + + if (clImageFX) { FreeResource(clImageFX); clImageFX = nullptr; } + if (clSourceFX) { FreeResource(clSourceFX); clSourceFX = nullptr; } + if (clBlurFX) { FreeResource(clBlurFX); clBlurFX = nullptr; } + if (clColourFX) { FreeResource(clColourFX); clColourFX = nullptr; } + if (clCompositeFX) { FreeResource(clCompositeFX); clCompositeFX = nullptr; } + if (clConvolveFX) { FreeResource(clConvolveFX); clConvolveFX = nullptr; } + if (clFloodFX) { FreeResource(clFloodFX); clFloodFX = nullptr; } + if (clMergeFX) { FreeResource(clMergeFX); clMergeFX = nullptr; } + if (clMorphologyFX) { FreeResource(clMorphologyFX); clMorphologyFX = nullptr; } + if (clOffsetFX) { FreeResource(clOffsetFX); clOffsetFX = nullptr; } + if (clTurbulenceFX) { FreeResource(clTurbulenceFX); clTurbulenceFX = nullptr; } + if (clRemapFX) { FreeResource(clRemapFX); clRemapFX = nullptr; } + if (clLightingFX) { FreeResource(clLightingFX); clLightingFX = nullptr; } + if (clDisplacementFX) { FreeResource(clDisplacementFX); clDisplacementFX = nullptr; } // Base-classes - if (clFilterEffect) { FreeResource(clFilterEffect); clFilterEffect = NULL; } - if (clVector) { FreeResource(clVector); clVector = NULL; } + if (clFilterEffect) { FreeResource(clFilterEffect); clFilterEffect = nullptr; } + if (clVector) { FreeResource(clVector); clVector = nullptr; } return ERR::Okay; } @@ -194,5 +194,5 @@ static STRUCTS glStructures = { { "VectorPoint", sizeof(VectorPoint) } }; -PARASOL_MOD(MODInit, NULL, MODOpen, MODExpunge, MOD_IDL, &glStructures) +PARASOL_MOD(MODInit, nullptr, MODOpen, MODExpunge, MOD_IDL, &glStructures) extern "C" struct ModHeader * register_vector_module() { return &ModHeader; } diff --git a/src/vector/vector.fdl b/src/vector/vector.fdl index d5a2a90d..7c1c1f86 100644 --- a/src/vector/vector.fdl +++ b/src/vector/vector.fdl @@ -1168,6 +1168,9 @@ inline void SET_VECTOR_COLOUR(objVectorColour *Colour, DOUBLE Red, DOUBLE Green, "INTERCEPT", "INVERT", "IDENTITY", + "L", + "M", + "N", "LINEAR", "TABLE", "GAMMA", diff --git a/src/vector/vector.h b/src/vector/vector.h index 501fc430..7b761ec4 100644 --- a/src/vector/vector.h +++ b/src/vector/vector.h @@ -1033,7 +1033,7 @@ void configure_stroke(extVector &Vector, T &Stroke) if (Vector.LineCap) Stroke.line_cap(Vector.LineCap); // butt, square, round if (Vector.InnerJoin) Stroke.inner_join(Vector.InnerJoin); // miter, round, bevel, jag - // It has been noted that there may be issues between miter_join, miter_join_revert and line-caps that + // It has been noted that there may be issues between miter_join, miter_join_revert and line-caps that // need further investigation. This section experiments with adjusting the line-cap according to the selected // line-join.