mirror of
https://github.com/rive-app/rive-flutter.git
synced 2025-05-20 06:46:28 +08:00
Runtime modifiers
Finally ready! Some highlights:
- Text objects own TextModifierGroups
- A TextModifierGroup defines a set of operations (Modifiers) to perform on ranges of the whole Text object.
- The ranges are defined by TextModifierRanges which are owned by TextModiferGroups. Each TextModifierGroup can have multiple TextModifierRanges, meaning that the set of Modifiers will perform on the final selection defined by TextModifierRanges.
- TextModifierRanges select portions of the text in a Text object based on rules that define the strength of the selection. The strength of multiple TextModifierRanges can be blended together meaning selection strength can be above 1 and below 0 (optionally clamped).
- There are three fundamental modifications:
1. Transform where glyphs are individually transformed by a matrix
2. Paint where glyphs are drawn with different paint (currently only opacity is supported, but later Fill and Stroke will be too).
3. Shape where a selection can have shaping properties (currently variable axes later also font size) changed. This is the most complex one as it requires [two pass shaping](ef2d0d3ca3/packages/runtime/src/text/text.cpp (L578-L598)
).
Diffs=
8086bdbf9 Runtime modifiers (#5512)
1a271c437 Get more compiling on MSVC (#5547)
5a18c89bd Swap propertyKeys between follow path and text core defs (#5543)
942bb8c94 Fix conflicting core key ids and set follow path offset to default false (#5541)
dcf320c64 Follow Path Constraint (Editor & CPP Runtime) (#5510)
Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
This commit is contained in:
@ -1 +1 @@
|
||||
9b8dacbacbfb232303773dd7a6008fdffaecc29c
|
||||
8086bdbf9e9b0535255653a1915a3cf22e1d1dd3
|
||||
|
@ -143,22 +143,6 @@ class TextModifierRange extends TextModifierRangeBase {
|
||||
_computeRangeMappedCoverage(coverage, _rangeMapper!);
|
||||
}
|
||||
|
||||
// void _computeCharacterCoverage(Float32List coverage, TextShapeResult shape) {
|
||||
// var length = coverage.length;
|
||||
// _indexFrom = length * offsetModifyFrom;
|
||||
// _indexTo = length * offsetModifyTo;
|
||||
// _indexFalloffFrom = length * offsetFalloffFrom;
|
||||
// _indexFalloffTo = length * offsetFalloffTo;
|
||||
|
||||
// // Since _coverage.length == text.length, we can use this for our length.
|
||||
// for (int i = 0; i < length; i++) {
|
||||
// coverage[i] += _characterCoverage(i);
|
||||
// }
|
||||
// }
|
||||
|
||||
// Coverage of an individual character in the range.
|
||||
// double _characterCoverage(int i) => _coverageAt(i + 0.5);
|
||||
|
||||
double _coverageAt(double t) {
|
||||
var c = 0.0;
|
||||
if (_indexTo >= _indexFrom) {
|
||||
@ -250,20 +234,19 @@ class TextModifierRange extends TextModifierRangeBase {
|
||||
set mode(TextRangeMode mode) => modeValue = mode.index;
|
||||
|
||||
@override
|
||||
void modeValueChanged(int from, int to) => modifierGroup?.rangeTypeChanged();
|
||||
void modeValueChanged(int from, int to) => modifierGroup?.rangeChanged();
|
||||
|
||||
TextRangeType get type => TextRangeType.values[typeValue];
|
||||
set type(TextRangeType value) => typeValue = value.index;
|
||||
|
||||
@override
|
||||
void typeValueChanged(int from, int to) => modifierGroup?.rangeTypeChanged();
|
||||
void typeValueChanged(int from, int to) => modifierGroup?.rangeChanged();
|
||||
|
||||
@override
|
||||
void clampChanged(bool from, bool to) => modifierGroup?.rangeTypeChanged();
|
||||
void clampChanged(bool from, bool to) => modifierGroup?.rangeChanged();
|
||||
|
||||
@override
|
||||
void strengthChanged(double from, double to) =>
|
||||
modifierGroup?.rangeTypeChanged();
|
||||
void strengthChanged(double from, double to) => modifierGroup?.rangeChanged();
|
||||
}
|
||||
|
||||
// See word indices and word lengths implementation above, we basically want the
|
||||
|
Reference in New Issue
Block a user