Skip to content

Commit 622e364

Browse files
committed
More exposure
1 parent 599bfe2 commit 622e364

File tree

9 files changed

+373
-72
lines changed

9 files changed

+373
-72
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
==============================================================================
3+
4+
This file is part of the YUP library.
5+
Copyright (c) 2024 - [email protected]
6+
7+
YUP is an open source library subject to open-source licensing.
8+
9+
The code included in this file is provided under the terms of the ISC license
10+
http://www.isc.org/downloads/software-support-policy/isc-license. Permission
11+
to use, copy, modify, and/or distribute this software for any purpose with or
12+
without fee is hereby granted provided that the above copyright notice and
13+
this permission notice appear in all copies.
14+
15+
YUP IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
16+
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
17+
DISCLAIMED.
18+
19+
==============================================================================
20+
*/
21+
22+
namespace yup
23+
{
24+
25+
//==============================================================================
26+
/** Defines the blend mode for graphical operations. */
27+
enum class BlendMode : uint8
28+
{
29+
SrcOver,
30+
Screen,
31+
Overlay,
32+
Darken,
33+
Lighten,
34+
ColorDodge,
35+
ColorBurn,
36+
HardLight,
37+
SoftLight,
38+
Difference,
39+
Exclusion,
40+
Multiply,
41+
Hue,
42+
Saturation,
43+
Color,
44+
Luminosity
45+
};
46+
47+
} // namespace yup

modules/yup_graphics/graphics/yup_ColorGradient.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ class YUP_API ColorGradient
4444
/** Represents a single color stop in a gradient. */
4545
struct ColorStop
4646
{
47+
/** Constructs a default color stop with zero values. */
4748
constexpr ColorStop() = default;
4849

50+
/** Constructs a color stop with the given color, x, y, and delta. */
4951
constexpr ColorStop (Color color, float x, float y, float delta)
5052
: color (color)
5153
, x (x)
@@ -225,7 +227,7 @@ class YUP_API ColorGradient
225227
226228
@return A const reference to the vector of color stops.
227229
*/
228-
const std::vector<ColorStop>& getStops() const
230+
Span<const ColorStop> getStops() const
229231
{
230232
return stops;
231233
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*
2+
==============================================================================
3+
4+
This file is part of the YUP library.
5+
Copyright (c) 2025 - [email protected]
6+
7+
YUP is an open source library subject to open-source licensing.
8+
9+
The code included in this file is provided under the terms of the ISC license
10+
http://www.isc.org/downloads/software-support-policy/isc-license. Permission
11+
to use, copy, modify, and/or distribute this software for any purpose with or
12+
without fee is hereby granted provided that the above copyright notice and
13+
this permission notice appear in all copies.
14+
15+
YUP IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
16+
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
17+
DISCLAIMED.
18+
19+
==============================================================================
20+
*/
21+
22+
namespace yup
23+
{
24+
25+
26+
27+
} // namespace yup

modules/yup_graphics/graphics/yup_Graphics.cpp

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -312,17 +312,6 @@ ColorGradient Graphics::getStrokeColorGradient() const
312312
return currentRenderOptions().strokeGradient;
313313
}
314314

315-
//==============================================================================
316-
void Graphics::setStrokeWidth (float strokeWidth)
317-
{
318-
currentRenderOptions().strokeWidth = jmax (0.0f, strokeWidth);
319-
}
320-
321-
float Graphics::getStrokeWidth() const
322-
{
323-
return currentRenderOptions().strokeWidth;
324-
}
325-
326315
//==============================================================================
327316
void Graphics::setFeather (float feather)
328317
{
@@ -346,6 +335,33 @@ float Graphics::getOpacity() const
346335
}
347336

348337
//==============================================================================
338+
void Graphics::setStrokeType (StrokeType strokeType)
339+
{
340+
auto& options = currentRenderOptions();
341+
342+
options.strokeWidth = strokeType.getWidth();
343+
options.join = strokeType.getJoin();
344+
options.cap = strokeType.getCap();
345+
}
346+
347+
StrokeType Graphics::getStrokeType() const
348+
{
349+
auto& options = currentRenderOptions();
350+
351+
return StrokeType (options.strokeWidth, options.join, options.cap);
352+
}
353+
354+
void Graphics::setStrokeWidth (float strokeWidth)
355+
{
356+
currentRenderOptions().strokeWidth = jmax (0.0f, strokeWidth);
357+
}
358+
359+
float Graphics::getStrokeWidth() const
360+
{
361+
return currentRenderOptions().strokeWidth;
362+
}
363+
364+
349365
void Graphics::setStrokeJoin (StrokeJoin join)
350366
{
351367
currentRenderOptions().join = join;
@@ -356,7 +372,6 @@ StrokeJoin Graphics::getStrokeJoin() const
356372
return currentRenderOptions().join;
357373
}
358374

359-
//==============================================================================
360375
void Graphics::setStrokeCap (StrokeCap cap)
361376
{
362377
currentRenderOptions().cap = cap;

0 commit comments

Comments
 (0)