# Class `wibox.widget`

### Info:

- Copyright: 2010 Uli Schlachter
- Author: Uli Schlachter

## Methods

wibox.widget:draw_to_cairo_context (wdg, cr, width, height[, context={dpi=96}]) | Draw a widget directly to a given cairo context.
wibox.widget:draw_to_svg_file (wdg, path, width, height[, context={dpi=96}]) | Create an SVG file showing this widget.
wibox.widget:draw_to_image_surface (wdg, width, height[, format=cairo.Format.ARGB32[, context={dpi=96}]]) | Create a cairo image surface showing this widget.

## Methods

wibox.widget:draw_to_cairo_context (wdg, cr, width, height[, context={dpi=96}])
  Draw a widget directly to a given cairo context. This function creates a temporary wibox.hierarchy instance and uses that to draw the given widget once to the given cairo context.
  - wdg widget A widget to draw
  - cr cairo_context The cairo context to draw the widget on
  - width number The width of the widget
  - height number The height of the widget
  - context table The context information to give to the widget. (default {dpi=96})
wibox.widget:draw_to_svg_file (wdg, path, width, height[, context={dpi=96}])
  Create an SVG file showing this widget.
  - wdg widget A widget
  - path string The output file path
  - width number The surface width
  - height number The surface height
  - context table The context information to give to the widget. (default {dpi=96})
wibox.widget:draw_to_image_surface (wdg, width, height[, format=cairo.Format.ARGB32[, context={dpi=96}]])
  Create a cairo image surface showing this widget.
  - wdg widget A widget
  - width number The surface width
  - height number The surface height
  - format The surface format (default cairo.Format.ARGB32)
  - context table The context information to give to the widget. (default {dpi=96})

  ### Returns:

  The cairo surface

generated by LDoc 1.5.0 Last updated 2025-09-26 21:04:17