Documentation ¶
Overview ¶
Package viewporter is cropping & scaling extension for surface contents
Index ¶
Constants ¶
const ( WpViewportErrorBadValue = 0 WpViewportErrorBadSize = 1 WpViewportErrorOutOfBuffer = 2 WpViewportErrorNoSurface = 3 )
const (
WpViewporterErrorViewportExists = 0
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type WpViewport ¶
func NewWpViewport ¶
func NewWpViewport(ctx *wl.Context) *WpViewport
func (*WpViewport) Destroy ¶
func (p *WpViewport) Destroy() error
Destroy will remove scaling and cropping from the surface.
The associated wl_surface's crop and scale state is removed. The change is applied on the next wl_surface.commit.
func (*WpViewport) SetDestination ¶
func (p *WpViewport) SetDestination(width, height int32) error
SetDestination will set the surface size for scaling.
Set the destination size of the associated wl_surface. See wp_viewport for the description, and relation to the wl_buffer size.
If width is -1 and height is -1, the destination size is unset instead. Any other pair of values for width and height that contains zero or negative values raises the bad_value protocol error.
The crop and scale state is double-buffered state, and will be applied on the next wl_surface.commit.
func (*WpViewport) SetSource ¶
func (p *WpViewport) SetSource(x, y, width, height float32) error
SetSource will set the source rectangle for cropping.
Set the source rectangle of the associated wl_surface. See wp_viewport for the description, and relation to the wl_buffer size.
If all of x, y, width and height are -1.0, the source rectangle is unset instead. Any other set of values where width or height are zero or negative, or x or y are negative, raise the bad_value protocol error.
The crop and scale state is double-buffered state, and will be applied on the next wl_surface.commit.
type WpViewporter ¶
func NewWpViewporter ¶
func NewWpViewporter(ctx *wl.Context) *WpViewporter
func (*WpViewporter) Destroy ¶
func (p *WpViewporter) Destroy() error
Destroy will unbind from the cropping and scaling interface.
Informs the server that the client will not be using this protocol object anymore. This does not affect any other objects, wp_viewport objects included.
func (*WpViewporter) GetViewport ¶
func (p *WpViewporter) GetViewport(surface *wl.Surface) (*WpViewport, error)
GetViewport will extend surface interface for crop and scale.
Instantiate an interface extension for the given wl_surface to crop and scale its content. If the given wl_surface already has a wp_viewport object associated, the viewport_exists protocol error is raised.