The blend modes available for render nodes. The implementation of each blend mode is deferred to the rendering pipeline. The default blend mode, which specifies no blending The source color is multiplied by the destination and replaces the destination ... ... ... ... ... ... ... ... ... ... ... ... ... ... # Implements [`RendererExt`](trait.RendererExt.html) Creates a new Broadway renderer. The Broadway renderer is the default renderer for the broadway backend. It will only work with broadway surfaces, otherwise it will fail the call to `gdk_renderer_realize`. This function is only available when GTK was compiled with Broadway support. # Returns a new Broadway renderer. # Implements [`RendererExt`](trait.RendererExt.html) Creates a new Cairo renderer. The Cairo renderer is the fallback renderer drawing in ways similar to how GTK 3 drew its content. Its primary use is as comparison tool. The Cairo renderer is incomplete. It cannot render 3D transformed content and will instead render an error marker. Its usage should be avoided. # Returns a new Cairo renderer. The corner indices used by `RoundedRect`. The top left corner The top right corner The bottom right corner The bottom left corner # Implements [`RendererExt`](trait.RendererExt.html) Creates a new `Renderer` using OpenGL. This is the default renderer used by GTK. # Returns a new GL renderer The `GskRenderNode` structure contains only private data. Draw the contents of `self` to the given cairo context. Typically, you'll use this function to implement fallback rendering of `GskRenderNodes` on an intermediate Cairo context, instead of using the drawing context associated to a `gdk::Surface`'s rendering buffer. For advanced nodes that cannot be supported using Cairo, in particular for nodes doing 3D operations, this function may fail. ## `cr` cairo context to draw to Retrieves the boundaries of the `self`. The node will not draw outside of its boundaries. ## `bounds` return location for the boundaries Returns the type of the `self`. # Returns the type of the `RenderNode` Acquires a reference on the given `RenderNode`. # Returns the `RenderNode` with an additional reference Serializes the `self` for later deserialization via `RenderNode::deserialize`. No guarantees are made about the format used other than that the same version of GTK+ will be able to deserialize the result of a call to `RenderNode::serialize` and `RenderNode::deserialize` will correctly reject files it cannot open that were created with previous versions of GTK+. The intended use of this functions is testing, benchmarking and debugging. The format is not meant as a permanent storage format. # Returns a `glib::Bytes` representing the node. Releases a reference on the given `RenderNode`. If the reference was the last, the resources associated to the `self` are freed. This function is equivalent to calling `RenderNode::serialize` followed by `g_file_set_contents`. See those two functions for details on the arguments. It is mostly intended for use inside a debugger to quickly dump a render node to a file for later inspection. ## `filename` the file to save it to. # Returns `true` if saving was successful Loads data previously created via `RenderNode::serialize`. For a discussion of the supported format, see that function. ## `bytes` the bytes containing the data # Returns a new `RenderNode` or `None` on error. The type of a node determines what the node is rendering. Error type. No node will ever have this type. A node containing a stack of children A node drawing a `cairo::Surface` A node drawing a single color rectangle A node drawing a linear gradient A node drawing a repeating linear gradient A node stroking a border around an area A node drawing a `gdk::Texture` A node drawing an inset shadow A node drawing an outset shadow A node that renders its child after applying a matrix transform A node that changes the opacity of its child A node that applies a color matrix to every pixel A node that repeats the child's contents A node that clips its child to a rectangular area A node that clips its child to a rounded rectangle A node that draws a shadow below its child A node that blends two children together A node that cross-fades between two children A node containing a glyph string A node that applies a blur # Implements [`RendererExt`](trait.RendererExt.html) Trait containing all `Renderer` methods. # Implementors [`BroadwayRenderer`](struct.BroadwayRenderer.html), [`CairoRenderer`](struct.CairoRenderer.html), [`GLRenderer`](struct.GLRenderer.html), [`Renderer`](struct.Renderer.html), [`VulkanRenderer`](struct.VulkanRenderer.html) Creates an appropriate `Renderer` instance for the given `surface`. The renderer will be realized when it is returned. ## `surface` a `gdk::Surface` # Returns a `Renderer` Retrieves the `gdk::Surface` set using `RendererExt::realize`. If the renderer has not been realized yet, `None` will be returned. # Returns a `gdk::Surface` Checks whether the `self` is realized or not. # Returns `true` if the `Renderer` was realized, and `false` otherwise Creates the resources needed by the `self` to render the scene graph. ## `surface` the `gdk::Surface` renderer will be used on Renders the scene graph, described by a tree of `RenderNode` instances, ensuring that the given `region` gets redrawn. Renderers must ensure that changes of the contents given by the `root` node as well as the area given by `region` are redrawn. They are however free to not redraw any pixel outside of `region` if they can guarantee that it didn't change. The `self` will acquire a reference on the `RenderNode` tree while the rendering is in progress. ## `root` a `RenderNode` ## `region` the `cairo::Region` that must be redrawn or `None` for the whole window Renders the scene graph, described by a tree of `RenderNode` instances, to a `gdk::Texture`. The `self` will acquire a reference on the `RenderNode` tree while the rendering is in progress. If you want to apply any transformations to `root`, you should put it into a transform node and pass that node instead. ## `root` a `RenderNode` ## `viewport` the section to draw or `None` to use `root`'s bounds # Returns a `gdk::Texture` with the rendered contents of `root`. Releases all the resources created by `RendererExt::realize`. A rectangular region with rounded corners. Application code should normalize rectangles using `RoundedRect::normalize`; this function will ensure that the bounds of the rectanlge are normalized and ensure that the corner values are positive and the corners do not overlap. All functions taking a `RoundedRect` as an argument will internally operate on a normalized copy; all functions returning a `RoundedRect` will always return a normalized one. Checks if the given `point` is inside the rounded rectangle. This function returns `false` if the point is in the rounded corner areas. ## `point` the point to check # Returns `true` if the `point` is inside the rounded rectangle Checks if the given `rect` is contained inside the rounded rectangle. This function returns `false` if `rect` extends into one of the rounded corner areas. ## `rect` the rectangle to check # Returns `true` if the `rect` is fully contained inside the rounded rectangle Initializes the given `RoundedRect` with the given values. This function will implicitly normalize the `RoundedRect` before returning. ## `bounds` a `graphene::Rect` describing the bounds ## `top_left` the rounding radius of the top left corner ## `top_right` the rounding radius of the top right corner ## `bottom_right` the rounding radius of the bottom right corner ## `bottom_left` the rounding radius of the bottom left corner # Returns the initialized rectangle Initializes `self` using the given `src` rectangle. This function will not normalize the `RoundedRect`, so make sure the source is normalized. ## `src` a `RoundedRect` # Returns the initialized rectangle Initializes `self` to the given `bounds` and sets the radius of all four corners to `radius`. ## `bounds` a `graphene::Rect` ## `radius` the border radius # Returns the initialized rectangle Checks if part of the given `rect` is contained inside the rounded rectangle. This function returns `false` if `rect` only extends into one of the rounded corner areas but not into the rounded rectangle itself. ## `rect` the rectangle to check # Returns `true` if the `rect` intersects with the rounded rectangle Checks if all corners of `self` are right angles and the rectangle covers all of its bounds. This information can be used to decide if `gsk_clip_node_new` or `gsk_rounded_clip_node_new` should be called. # Returns `true` if the rectangle is rectilinear Normalizes the passed rectangle. this function will ensure that the bounds of the rectanlge are normalized and ensure that the corner values are positive and the corners do not overlap. # Returns the normalized rectangle Offsets the bound's origin by `dx` and `dy`. The size and corners of the rectangle are unchanged. ## `dx` the horizontal offset ## `dy` the vertical offset # Returns the offset rectangle Shrinks (or grows) the given rectangle by moving the 4 sides according to the offsets given. The corner radii will be changed in a way that tries to keep the center of the corner circle intact. This emulates CSS behavior. This function also works for growing rectangles if you pass negative values for the `top`, `right`, `bottom` or `left`. ## `top` How far to move the top side downwards ## `right` How far to move the right side to the left ## `bottom` How far to move the bottom side upwards ## `left` How far to move the left side to the right # Returns the resized `RoundedRect` The filters used when scaling texture data. The actual implementation of each filter is deferred to the rendering pipeline. linear interpolation filter nearest neighbor interpolation filter linear interpolation along each axis, plus mipmap generation, with linear interpolation along the mipmap levels Errors that can happen during (de)serialization. The format can not be identified The version of the data is not understood The given data may not exist in a proper serialization Creates a `RenderNode` that will draw a `child` with the given `shadows` below it. ## `child` The node to draw ## `shadows` The shadows to apply ## `n_shadows` number of entries in the `shadows` array # Returns A new `RenderNode` The `GskTransform` structure contains only private data. Checks two matrices for equality. Note that matrices need to be literally identical in their operations, it is not enough that they return the same result in `Transform::to_matrix`. ## `second` the second matrix # Returns `true` if the two matrices can be proven to be equal Returns the category this transform belongs to. # Returns The category of the transform Inverts the given transform. If `self` is not invertible, `None` is returned. Note that inverting `None` also returns `None`, which is the correct inverse of `None`. If you need to differentiate between those cases, you should check `self` is not `None` before calling this function. # Returns The inverted transform or `None` if the transform cannot be inverted. Multiplies `self` with the given `matrix`. ## `matrix` the matrix to multiply `self` with # Returns The new matrix Applies a perspective projection transform. This transform scales points in X and Y based on their Z value, scaling points with positive Z values away from the origin, and those with negative Z values towards the origin. Points on the z=0 plane are unchanged. ## `depth` distance of the z=0 plane. Lower values give a more flattened pyramid and therefore a more pronounced perspective effect. # Returns The new matrix Converts `self` into a human-readable string representation suitable for printing that can later be parsed with `Transform::parse`. ## `string` The string to print into Acquires a reference on the given `Transform`. # Returns the `Transform` with an additional reference Rotates `self` `angle` degrees in 2D - or in 3Dspeak, around the z axis. ## `angle` the rotation angle, in degrees (clockwise) # Returns The new matrix Rotates `self` `angle` degrees around `axis`. For a rotation in 2D space, use `Transform::rotate`. ## `angle` the rotation angle, in degrees (clockwise) ## `axis` The rotation axis # Returns The new matrix Scales `self` in 2-dimensional space by the given factors. Use `Transform::scale_3d` to scale in all 3 dimensions. ## `factor_x` scaling factor on the X axis ## `factor_y` scaling factor on the Y axis # Returns The new matrix Scales `self` by the given factors. ## `factor_x` scaling factor on the X axis ## `factor_y` scaling factor on the Y axis ## `factor_z` scaling factor on the Z axis # Returns The new matrix Converts a `Transform` to a 2D transformation matrix. `self` must be a 2D transformation. If you are not sure, use `Transform::get_category` >= `TransformCategory::2d` to check. The returned values have the following layout: ```plain | xx yx | | a b 0 | | xy yy | = | c d 0 | | x0 y0 | | tx ty 1 | ``` This function can be used to convert between a `Transform` and a matrix type from other 2D drawing libraries, in particular Cairo. ## `out_xx` return location for the xx member ## `out_yx` return location for the yx member ## `out_xy` return location for the xy member ## `out_yy` return location for the yy member ## `out_dx` return location for the x0 member ## `out_dy` return location for the y0 member Converts a `Transform` to 2D affine transformation factors. `self` must be a 2D transformation. If you are not sure, use `Transform::get_category` >= `TransformCategory::2dAffine` to check. ## `out_scale_x` return location for the scale factor in the x direction ## `out_scale_y` return location for the scale factor in the y direction ## `out_dx` return location for the translation in the x direction ## `out_dy` return location for the translation in the y direction Computes the actual value of `self` and stores it in `out_matrix`. The previous value of `out_matrix` will be ignored. ## `out_matrix` The matrix to set Converts a matrix into a string that is suitable for printing and can later be parsed with `Transform::parse`. This is a wrapper around `Transform::print`, see that function for details. # Returns A new string for `self` Converts a `Transform` to a translation operation. `self` must be a 2D transformation. If you are not sure, use `Transform::get_category` >= `TransformCategory::2dTranslate` to check. ## `out_dx` return location for the translation in the x direction ## `out_dy` return location for the translation in the y direction Applies all the operations from `other` to `self`. ## `other` Transform to apply # Returns The new matrix Transforms a `graphene::Rect` using the given matrix `m`. The result is the bounding box containing the coplanar quad. ## `rect` a `graphene::Rect` ## `out_rect` return location for the bounds of the transformed rectangle Translates `self` in 2dimensional space by `point`. ## `point` the point to translate the matrix by # Returns The new matrix Translates `self` by `point`. ## `point` the point to translate the matrix by # Returns The new matrix Releases a reference on the given `Transform`. If the reference was the last, the resources associated to the `self` are freed. Gets the child node that is getting transformed by the given `node`. ## `node` a transform `RenderNode` # Returns The child that is getting transformed Creates a `RenderNode` that will transform the given `child` with the given `transform`. ## `child` The node to transform ## `transform` The transform to apply # Returns A new `RenderNode` Parses the given `string` into a transform and puts it in `out_transform`. Strings printed via `Transform::to_string` can be read in again successfully using this function. If `string` does not describe a valid transform, `false` is returned and `None` is put in `out_transform`. ## `string` the string to parse ## `out_transform` The location to put the transform in # Returns `true` if `string` described a valid transform. The categories of matrices relevant for GSK and GTK. Note that any category includes matrices of all later categories. So if you want to for example check if a matrix is a 2D matrix, `category >= GSK_TRANSFORM_CATEGORY_2D` is the way to do this. Also keep in mind that rounding errors may cause matrices to not conform to their categories. Otherwise, matrix operations done via mutliplication will not worsen categories. So for the matrix multiplication `C = A * B`, `category(C) = MIN (category(A), category(B))`. The category of the matrix has not been determined. Analyzing the matrix concluded that it does not fit in any other category. The matrix is a 3D matrix. This means that the w column (the last column) has the values (0, 0, 0, 1). The matrix is a 2D matrix. This is equivalent to `graphene::Matrix::is_2d` returning `true`. In particular, this means that Cairo can deal with the matrix. The matrix is a combination of 2D scale and 2D translation operations. In particular, this means that any rectangle can be transformed exactly using this matrix. The matrix is a 2D translation. The matrix is the identity matrix. # Implements [`RendererExt`](trait.RendererExt.html)