
Blend2DBETA
2D Vector Graphics Engine
Rendering context [C++ API].
Creates a default constructed rendering context.
Default constructed means that the instance is valid, but uninitialized, which means the rendering context does not have attached any target. Any attempt to use uninitialized context results in BL_ERROR_NOT_INITIALIZED
error.
Move constructor.
Moves the other
rendering context into this one and resets the other
.
Copy constructor.
Creates a weak-copy of the other
rendering context by increasing it's internal reference counter. This context and other
would point to the same data and would be otherwise identical. Any change to other
would also affect this context.
This function is mostly provided for C++ users that may keep a global reference to the same rendering context, for example, otherwise sharing is not that useful as they also share a state.
Two weak copies of the same rendering context cannot be used by different threads simultaneously.
Creates a new rendering context for rendering to the image target
.
Creates a new rendering context for rendering to the image target
.
This overload accepts create options that can be used to change the implementation of the rendering context.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Destroys the rendering context.
Waits for all operations, detaches the target from the rendering context and then destroys it. Does nothing if the context is not initialized.
Returns true if the rendering context is initialized (has target attached).
Provided for users that want to use bool idiom in C++ to check for the status of the object.
Returns whether this and other
point to the same rendering context.
Returns whether this and other
are different rendering contexts.
Returns the target size in abstract units (pixels in case of BLImage
).
Returns the target width in abstract units (pixels in case of BLImage
).
Returns the target height in abstract units (pixels in case of BLImage
).
Returns the target image or null if there is no target image.
BLImage
passed to either the constructor or begin()
function. So the returned pointer is not the same as the pointer passed to begin()
, but it points to the same impl. Returns the type of this context, see BLContextType
.
Tests whether the context is a valid rendering context that has attached target to it.
Returns whether this and other
point to the same rendering context.
Resets this rendering context to the default constructed one.
Similar behavior to the destructor, but the context will still be valid after reset()
and would behave like a default constructed context.
Begins rendering to the given image
.
If this operation succeeds then the rendering context will have exclusive access to the image data. This means that no other renderer can use it during rendering.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Waits for completion of all render commands and detaches the rendering context from the rendering target. After end()
completes the rendering context implementation would be released and replaced by a built-in null instance (no context).
Flushes the context, see BLContextFlushFlags
.
Gets a property of the given name
and assigns it to an initialized valueOut
.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Sets a property of the given name
to value
.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Queries the number of threads that the rendering context uses.
If the returned value is zero it means that the rendering is synchronous, otherwise it describes the number of threads used for asynchronous rendering which include the user thread. For example if the returned value is 2
it means that the rendering context uses the user thread and one more worker.
Queries accumulated errors as flags, see BLContextErrorFlags.
Errors may accumulate during the lifetime of the rendering context.
Returns the number of saved states in the context (0 means no saved states).
Saves the current rendering context state and creates a restoration cookie
.
If you use a cookie
to save a state you have to use the same cookie to restore it otherwise the restore()
would fail. Please note that cookies are not a means of security, they are provided for making it easier to guarantee that a code that you may not control won't break your context.
Restores the top-most saved context-state.
Possible return conditions:
BL_SUCCESS
- State was restored successfully.BL_ERROR_NO_STATES_TO_RESTORE
- There are no saved states to restore.BL_ERROR_NO_MATCHING_COOKIE
- Previous state was saved with cookie, which was not provided. You would need the correct cookie to restore such state. Restores to the point that matches the given cookie
.
More than one state can be restored in case that the cookie
points to some previous state in the list.
Possible return conditions:
BL_SUCCESS
- Matching state was restored successfully.BL_ERROR_NO_STATES_TO_RESTORE
- There are no saved states to restore.BL_ERROR_NO_MATCHING_COOKIE
- The cookie did't match any saved state. Returns meta-matrix.
Meta matrix is a core transformation matrix that is normally not changed by transformations applied to the context. Instead it acts as a secondary matrix used to create the final transformation matrix from meta and user matrices.
Meta matrix can be used to scale the whole context for HI-DPI rendering or to change the orientation of the image being rendered, however, the number of use-cases is unlimited.
To change the meta-matrix you must first change user-matrix and then call userToMeta()
, which would update meta-matrix and clear user-matrix.
See userMatrix()
and userToMeta()
.
Returns user-matrix.
User matrix contains all transformations that happened to the rendering context unless the context was restored or userToMeta()
was called.
Sets user matrix to m
.
Resets user matrix to identity.
Store the result of combining the current MetaMatrix
and UserMatrix
to MetaMatrix
and reset UserMatrix
to identity as shown below:
Please note that this operation is irreversible. The only way to restore both matrices to the state before the call to userToMeta()
is to use save()
and restore()
functions.
Returns rendering hints.
Sets the given rendering hint hintType
to the value
.
Sets all rendering hints of this context to the given hints
.
Returns the rendering quality hint.
Sets rendering quality hint to value
.
Returns the gradient quality hint.
Sets gradient quality hint to value
.
Returns the pattern quality hint.
Sets pattern quality hint to value
.
Returns approximation options.
Sets approximation options to options
.
Returns flatten mode (how curves are flattened).
Sets flatten mode
(how curves are flattened).
Returns tolerance used for curve flattening.
Sets tolerance used for curve flattening.
Returns composition operator.
Sets composition operator to compOp
, see BLCompOp
.
Returns global alpha value.
Sets global alpha value.
Returns fill or alpha value dependeing on the rendering operation opType
.
The function behaves like fillAlpha()
or strokeAlpha()
depending on opType
value, see BLContextOpType
.
Set fill or stroke alpha
value depending on the rendering operation opType
.
The function behaves like setFillAlpha()
or setStrokeAlpha()
depending on opType
value, see BLContextOpType
.
Returns fill alpha value.
Sets fill alpha
value.
Returns fill-rule, see BLFillRule
.
Sets fill-rule, see BLFillRule
.
Returns stroke width.
Returns stroke miter-limit.
Returns stroke join, see BLStrokeJoin
.
Returns stroke start-cap, see BLStrokeCap
.
Returns stroke end-cap, see BLStrokeCap
.
Returns stroke transform order, see BLStrokeTransformOrder
.
Returns stroke dash-offset.
Returns stroke dash-array.
Returns stroke options as a reference to BLStrokeOptions
.
Sets stroke width to width
.
Sets miter limit to miterLimit
.
Sets stroke join to strokeJoin
, see BLStrokeJoin
.
Sets stroke cap of the specified type
to strokeCap
, see BLStrokeCap
.
Sets stroke start cap to strokeCap
, see BLStrokeCap
.
Sets stroke end cap to strokeCap
, see BLStrokeCap
.
Sets all stroke caps to strokeCap
, see BLStrokeCap
.
Sets stroke transformation order to transformOrder
, see BLStrokeTransformOrder
.
Sets stroke dash-offset to dashOffset
.
Sets stroke dash-array to dashArray
.
Sets all stroke options
.
Returns stroke alpha value.
Sets stroke alpha value to alpha
.
Restores clipping to the last saved state or to the context default clipping if there is no saved state.
If there are no saved states then it resets clipping completely to the initial state that was used when the rendering context was created.
Clear everything.
Clears a rectangle rect
.
Clears a rectangle rect
.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Fills the passed geometry specified by geometryType
and geometryData
[Internal].
Fills everything.
Fills a box.
Fills a rectangle rect
.
Fills a rectangle rect
.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Fills a circle.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Fills an ellipse.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Fills a rounded rectangle.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Fills a chord.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Fills a pie.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Fills a triangle.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Fills a polygon.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Fills a polygon.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Fills an array of boxes.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Fills an array of boxes.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Fills an array of rectangles.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Fills an array of rectangles.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Fills the given path
.
SIZE_MAX
)[1/2]¶Fills the passed UTF-8 text by using the given font
.
SIZE_MAX
)[2/2]¶Fills the passed UTF-8 text by using the given font
.
SIZE_MAX
)[1/2]¶Fills the passed UTF-16 text by using the given font
.
SIZE_MAX
)[2/2]¶Fills the passed UTF-16 text by using the given font
.
SIZE_MAX
)[1/2]¶Fills the passed UTF-32 text by using the given font
.
SIZE_MAX
)[2/2]¶Fills the passed UTF-32 text by using the given font
.
Fills the passed glyphRun
by using the given font
.
Fills the passed glyphRun
by using the given font
.
Fills a source mask
image at coordinates specified by dst
(int coordinates).
Fills a source mask
image specified by maskArea
at coordinates specified by dst
(int coordinates).
Fills a source mask
image at coordinates specified by dst
.
Fills a source mask
image specified by maskArea
at coordinates specified by dst
.
Strokes the passed geometry specified by geometryType
and geometryData
[Internal].
Strokes a box.
Strokes a rectangle.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Strokes a line.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Strokes a circle.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Strokes an ellipse.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Strokes a round.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Strokes an arc.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Strokes a chord.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Strokes a pie.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Strokes a triangle.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Strokes a polyline.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Strokes a polyline.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Strokes a polygon.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Strokes a polygon.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Strokes an array of boxes.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Strokes an array of boxes.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Strokes an array of rectangles.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Strokes an array of rectangles.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Strokes a path.
SIZE_MAX
)[1/2]¶Strokes the passed UTF-8 text by using the given font
.
SIZE_MAX
)[2/2]¶Strokes the passed UTF-8 text by using the given font
.
SIZE_MAX
)[1/2]¶Strokes the passed UTF-16 text by using the given font
.
SIZE_MAX
)[2/2]¶Strokes the passed UTF-16 text by using the given font
.
SIZE_MAX
)[1/2]¶Strokes the passed UTF-32 text by using the given font
.
SIZE_MAX
)[2/2]¶Strokes the passed UTF-32 text by using the given font
.
Strokes the passed glyphRun
by using the given font
.
Strokes the passed glyphRun
by using the given font
.
Blits source image src
at coordinates specified by dst
.
Blits an area of source image src
specified by srcArea
at coordinates specified by dst
.
Blits source image src
at coordinates specified by dst
(int coordinates).
Blits an area in source image src
specified by srcArea
at coordinates specified by dst
(int coordinates).
Blits a source image src
scaled to fit into dst
rectangle.
Blits an area of source image src
specified by srcArea
scaled to fit into dst
rectangle.
Blits a source image src
scaled to fit into dst
rectangle (int coordinates).
Blits an area of source image src
specified by srcArea
scaled to fit into dst
rectangle (int coordinates).