IndexStylingBLGradient
BLGradient Class Referencefinal

Gradient [C++ API].

Member Functions

Construction & Destruction
Overloaded Operators
Common Functionality
Create Gradient
Accessors
Gradient Stops
Content Manipulation
Equality & Comparison
Transformations

Additional Inherited Members

- Public Attributes inherited from BLObjectCore

BLGradient::BLGradient()noexcept[1/3][¶]

Creates a default constructed gradient.

A default constructed gradient has BL_GRADIENT_TYPE_LINEAR type, all values set to zero, and has no color stops.

BLGradient::BLGradient(
BLGradient&& other
)noexcept[2/3][¶]

Move constructor.

The other gradient is reset to its construction state after the move.

BLGradient::BLGradient(
const BLGradient& other
)noexcept[3/3][¶]

Copy constructor creates a weak copy of other.

BLGradient& BLGradient::operator=(
BLGradient&& other
)noexcept[1/2][¶]

Move assignment operator, does the same as assign(other).

BLGradient& BLGradient::operator=(
const BLGradient& other
)noexcept[2/2][¶]

Copy assignment operator, does the same as assign(other).

bool BLGradient::operator==(
const BLGradient& other
) constnoexcept[¶]

Equality operator, performs the same operation as equals(other).

bool BLGradient::operator!=(
const BLGradient& other
) constnoexcept[¶]

Inequality operator, performs the same operation as !equals(other).

BLResult BLGradient::reset()noexcept[¶]

Resets the gradient to its construction state.

Note
This operation always succeeds and returns BL_SUCCESS. The return value is provided for convenience so reset() can be used in tail calls in case other functions need to return BLResult.

void BLGradient::swap(
BLGradient& other
)noexcept[¶]

Swaps this gradient with other.

Note
This operation always succeeds.

BLGradientType BLGradient::type() constnoexcept[¶]

Returns the type of the gradient.

BLResult BLGradient::setType()noexcept[¶]

Sets the type of the gradient.

BLExtendMode BLGradient::extendMode() constnoexcept[¶]

Returns the gradient extend mode, see BLExtendMode.

BLResult BLGradient::setExtendMode(
BLExtendMode extendMode
)noexcept[¶]

Set the gradient extend mode, see BLExtendMode.

BLResult BLGradient::resetExtendMode()noexcept[¶]

Resets the gradient extend mode to BL_EXTEND_MODE_PAD.

bool BLGradient::empty() constnoexcept[¶]

Tests whether the gradient is empty.

Empty gradient is considered any gradient that has no stops.

size_t BLGradient::size() constnoexcept[¶]

Returns the number of stops the gradient has.

size_t BLGradient::capacity() constnoexcept[¶]

Returns the gradient capacity [in stops].

BLResult BLGradient::reserve(
size_t n
)noexcept[¶]

Reserves the capacity of gradient for at least n stops.

BLResult BLGradient::shrink()noexcept[¶]

Shrinks the capacity of gradient stops to fit the current use.

const BLGradientStop* BLGradient::stops() constnoexcept[¶]

Returns the gradient stop data.

const BLGradientStop& BLGradient::stopAt(
size_t i
) constnoexcept[¶]

Returns a gradient stop at i.

BLArrayView<BLGradientStop>BLGradient::stopsView() constnoexcept[¶]

Returns gradient stops and their count as BLArrayView<BLGradientStop>.

BLResult BLGradient::assign(
BLGradient&& other
)noexcept[1/2][¶]

Move assignment of other gradient to this gradient.

This function resets other to its initialization state.

BLResult BLGradient::assign(
const BLGradient& other
)noexcept[2/2][¶]

Copy assignment of other gradient to this gradient.

This function creates a weak copy of other gradient by increasing its reference count if other is reference counted.

BLResult BLGradient::resetStops()noexcept[¶]

Resets all stops of the gradient.

After the operation the gradient will have no color stops.

BLResult BLGradient::assignStops(
const BLGradientStop* stops,
size_t n
)noexcept[1/2][¶]

Assigns colors stops of the gradient to stops of size n.

BLResult BLGradient::assignStops()noexcept[2/2][¶]

Assigns colors stops of the gradient to stops.

BLResult BLGradient::addStop(
double offset,
const BLRgba32& rgba32
)noexcept[1/2][¶]

Adds a color stop described as a 32-bit color rgba32 at the given offset.

Note
The offset value must be in [0, 1] range.

BLResult BLGradient::addStop(
double offset,
const BLRgba64& rgba64
)noexcept[2/2][¶]

Adds a color stop described as a 64-bit color rgba64 at the given offset.

Note
The offset value must be in [0, 1] range.

BLResult BLGradient::removeStop(
size_t index
)noexcept[¶]

Removes stop at the given index.

Note
This function should be used together with indexOfStop(), which returns index to the stop array.

BLResult BLGradient::removeStopByOffset(
double offset,
bool all = true
)noexcept[¶]

Removes stop at the given offset, which should be in [0, 1] range.

The all parameter specifies whether all stops at the given offset should be removed as there are cases in which two stops can occupy the same offset to create sharp transitions. If all is false and there is a sharp transition only the first stop would be removed. If all is true both stops will be removed.

Note
There are never 3 stops occupying the same offset.

BLResult BLGradient::removeStops(
BLRange range
)noexcept[¶]

Removes all stops in the given range, which describes indexes in the stop array.

BLResult BLGradient::removeStopsByOffset(
double offsetMin,
double offsetMax
)noexcept[¶]

Removes all stops in the given interval [offsetMin, offsetMax], which specifies stop offsets, which are between [0, 1].

BLResult BLGradient::replaceStop(
size_t index,
double offset,
const BLRgba32& rgba32
)noexcept[1/2][¶]

Replaces stop at the given index with a new color stop described by offset and rgba32.

The operation leads to the same result as removeStop(index) followed by addStop(offset, rgba32).

BLResult BLGradient::replaceStop(
size_t index,
double offset,
const BLRgba64& rgba64
)noexcept[2/2][¶]

Replaces stop at the given index with a new color stop described by offset and rgba64.

The operation leads to the same result as removeStop(index) followed by addStop(offset, rgba64).

size_t BLGradient::indexOfStop(
double offset
) constnoexcept[¶]

Returns the index of a color stop in stops[] array of the given offset.

Note
If there is no such offset, SIZE_MAX is returned.

bool BLGradient::equals(
const BLGradient& other
) constnoexcept[¶]

Tests whether the gradient equals other.

Note
The equality check returns true if both gradients are the same value-wise.

const BLMatrix2D& BLGradient::transform() constnoexcept[¶]

Returns the transformation matrix applied to the gradient.

BLTransformType BLGradient::transformType() constnoexcept[¶]

Returns the type of the transformation matrix returned by transform().

bool BLGradient::hasTransform() constnoexcept[¶]

Tests whether the gradient has a non-identity transformation matrix.

BLResult BLGradient::_applyTransformOp(
BLTransformOp opType,
const void* opData
)noexcept[¶]

Applies a matrix operation to the current transformation matrix (internal).