Module: gears.surface
Info:
- Copyright: 2012 Uli Schlachter
-
Originally authored by: Uli Schlachter
(Full contributors list available on our github project)
Static module functions
gears.surface.load_uncached_silently (_surface, default) -> () | Try to convert the argument into an lgi cairo surface. | |
gears.surface.load_silently (_surface, default) -> () | Try to convert the argument into an lgi cairo surface. | |
gears.surface.load_uncached (_surface) -> () | Try to convert the argument into an lgi cairo surface. | |
gears.surface (_surface) -> () | Try to convert the argument into an lgi cairo surface. | |
gears.surface.get_size (surf) -> () | Get the size of a cairo surface | |
gears.surface.duplicate_surface (s) -> () | Create a copy of a cairo surface. | |
gears.surface.load_from_shape (width, height, shape[, shape_color=white[, bg_color=transparent]]) -> cairo.surface | Create a surface from a gears.shape Any additional parameters will be passed to the shape function | |
gears.surface.apply_shape_bounding (draw, shape[, Any]) | Apply a shape to a client or a wibox. |
Deprecated functions
gears.surface.draw_to_svg_file [deprecated] | Create an SVG file with this widget content. | |
gears.surface.draw_to_image_surface [deprecated] | Create a cairo surface with this widget content. |
Static module functions
- gears.surface.load_uncached_silently (_surface, default) -> ()
-
Try to convert the argument into an lgi cairo surface.
This is usually needed for loading images by file name.
Parameters:
- _surface The surface to load or nil
- default The default value to return on error; when nil, then a surface in an error state is returned.
Returns:
- The loaded surface, or the replacement default
- An error message, or nil on success.
- gears.surface.load_silently (_surface, default) -> ()
-
Try to convert the argument into an lgi cairo surface.
This is usually needed for loading images by file name and uses a cache.
In contrast to
load()
, errors are returned to the caller.Parameters:
- _surface The surface to load or nil
- default The default value to return on error; when nil, then a surface in an error state is returned.
Returns:
- The loaded surface, or the replacement default, or nil if called with nil.
- An error message, or nil on success.
- gears.surface.load_uncached (_surface) -> ()
-
Try to convert the argument into an lgi cairo surface.
This is usually needed for loading images by file name. Errors are handled
via gears.debug.print_error.
Parameters:
- _surface The surface to load or nil
Returns:
-
The loaded surface, or nil
- gears.surface (_surface) -> ()
-
Try to convert the argument into an lgi cairo surface.
This is usually needed for loading images by file name. Errors are handled
via gears.debug.print_error.
Parameters:
- _surface The surface to load or nil
Returns:
-
The loaded surface, or nil.
- gears.surface.get_size (surf) -> ()
-
Get the size of a cairo surface
Parameters:
- surf The surface you are interested in
Returns:
-
The surface's width and height.
- gears.surface.duplicate_surface (s) -> ()
-
Create a copy of a cairo surface.
The surfaces returned by
surface.load
are cached and must not be modified to avoid unintended side-effects. This function allows to create a copy of a cairo surface. This copy can then be freely modified. The surface returned will be as compatible as possible to the input surface. For example, it will likely be of the same surface type as the input. The details are explained in thecreate_similar
function on a cairo surface.Parameters:
- s Source surface.
Returns:
-
The surface's duplicate.
- gears.surface.load_from_shape (width, height, shape[, shape_color=white[, bg_color=transparent]]) -> cairo.surface
-
Create a surface from a gears.shape
Any additional parameters will be passed to the shape function
Parameters:
- width number The surface width
- height number The surface height
- shape A gears.shape compatible function
- shape_color The shape color or pattern (default white)
- bg_color The surface background color (default transparent)
Returns:
-
cairo.surface
the new surface
- gears.surface.apply_shape_bounding (draw, shape[, Any])
-
Apply a shape to a client or a wibox.
If the wibox or client size change, this function need to be called again.
Parameters:
- draw A wibox or a client
- shape or gears.shape function or a custom function with a context, width and height as parameter.
- Any additional parameters will be passed to the shape function. (optional)
Deprecated functions
- gears.surface.draw_to_svg_file [deprecated]
-
Create an SVG file with this widget content.
This is dynamic, so the SVG will be updated along with the widget content.
because of this, the painting may happen hover multiple event loop cycles.
Parameters:
- widget widget A widget
- path string The output file path
- width number The surface width
- height number The surface height
Returns:
- The cairo surface
- The hierarchy.
See also:
- gears.surface.draw_to_image_surface [deprecated]
-
Create a cairo surface with this widget content.
This is dynamic, so the SVG will be updated along with the widget content.
because of this, the painting may happen hover multiple event loop cycles.
Parameters:
- widget widget A widget
- width number The surface width
- height number The surface height
- format The surface format (default cairo.Format.ARGB32)
Returns:
- The cairo surface
- The hierarchy.
See also: