Skip to content

Commit

Permalink
Merge pull request #295 from parasol-framework/test/vector
Browse files Browse the repository at this point in the history
Cleanup
  • Loading branch information
paul-manias authored Dec 31, 2024
2 parents b4cf45f + f94b50f commit e096316
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 99 deletions.
1 change: 1 addition & 0 deletions include/parasol/modules/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) { };
Expand Down
3 changes: 3 additions & 0 deletions include/parasol/modules/vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions include/parasol/system/fields.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/core/defs/core.fdl
Original file line number Diff line number Diff line change
Expand Up @@ -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) { };
Expand Down
2 changes: 2 additions & 0 deletions src/core/defs/fields.fdl
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
10 changes: 5 additions & 5 deletions src/vector/defs/gradient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
*********************************************************************************************************************/
Expand All @@ -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.
*********************************************************************************************************************/
Expand Down
16 changes: 8 additions & 8 deletions src/vector/filters/filter_image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
34 changes: 0 additions & 34 deletions src/vector/utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,6 @@ static void read_numseq_zero(CSTRING &, std::initializer_list<DOUBLE *>);

//********************************************************************************************************************

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 },
Expand Down
102 changes: 51 additions & 51 deletions src/vector/vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<extVector *> glVectorFocusList; // The first reference is the most foreground object with the focus
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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; }
3 changes: 3 additions & 0 deletions src/vector/vector.fdl
Original file line number Diff line number Diff line change
Expand Up @@ -1168,6 +1168,9 @@ inline void SET_VECTOR_COLOUR(objVectorColour *Colour, DOUBLE Red, DOUBLE Green,
"INTERCEPT",
"INVERT",
"IDENTITY",
"L",
"M",
"N",
"LINEAR",
"TABLE",
"GAMMA",
Expand Down
2 changes: 1 addition & 1 deletion src/vector/vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit e096316

Please sign in to comment.