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

Constructor & Destructor Documentation

BLGradient::BLGradient()[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)[2/3]◆ 

Move constructor.

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

BLGradient::BLGradient(const BLGradient& other)[3/3]◆ 

Copy constructor creates a weak copy of other.

Member Function Documentation

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

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

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

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

bool BLGradient::operator==(const BLGradient& other) const◆ 

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

bool BLGradient::operator!=(const BLGradient& other) const◆ 

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

BLResult BLGradient::reset()◆ 

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)◆ 

Swaps this gradient with other.

Note
This operation always succeeds.

BLGradientType BLGradient::type() const◆ 

Returns the type of the gradient.

BLResult BLGradient::setType(BLGradientType type)◆ 

Sets the type of the gradient.

BLExtendMode BLGradient::extendMode() const◆ 

Returns the gradient extend mode, see BLExtendMode.

BLResult BLGradient::setExtendMode(BLExtendMode extendMode)◆ 

Set the gradient extend mode, see BLExtendMode.

BLResult BLGradient::resetExtendMode()◆ 

Resets the gradient extend mode to BL_EXTEND_MODE_PAD.

bool BLGradient::empty() const◆ 

Tests whether the gradient is empty.

Empty gradient is considered any gradient that has no stops.

size_t BLGradient::size() const◆ 

Returns the number of stops the gradient has.

size_t BLGradient::capacity() const◆ 

Returns the gradient capacity [in stops].

BLResult BLGradient::reserve(size_t n)◆ 

Reserves the capacity of gradient for at least n stops.

BLResult BLGradient::shrink()◆ 

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

const BLGradientStop* BLGradient::stops() const◆ 

Returns the gradient stop data.

const BLGradientStop& BLGradient::stopAt(size_t i) const◆ 

Returns a gradient stop at i.

BLArrayView<BLGradientStop>BLGradient::stopsView() const◆ 

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

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

Move assignment of other gradient to this gradient.

This function resets other to its initialization state.

BLResult BLGradient::assign(const BLGradient& other)[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()◆ 

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)[1/2]◆ 

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

BLResult BLGradient::assignStops(BLArrayView<BLGradientStop> stops)[2/2]◆ 

Assigns colors stops of the gradient to stops.

BLResult BLGradient::addStop(double offset, const BLRgba32& rgba32)[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)[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)◆ 

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)◆ 

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)◆ 

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

BLResult BLGradient::removeStopsByOffset(double offsetMin, double offsetMax)◆ 

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)[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)[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) const◆ 

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) const◆ 

Tests whether the gradient equals other.

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

const BLMatrix2D& BLGradient::transform() const◆ 

Returns the transformation matrix applied to the gradient.

BLTransformType BLGradient::transformType() const◆ 

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

bool BLGradient::hasTransform() const◆ 

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

BLResult BLGradient::_applyTransformOp(BLTransformOp opType, const void* opData)◆ 

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