console

package
v0.0.0-...-1a7aca4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 16, 2018 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device interface {
	// Pixel returns the width and height of the console
	// using a particual dimension.
	Dimensions(Dimension) (uint32, uint32)

	// DefaultColors returns the default foreground and background colors
	// used by this console.
	DefaultColors() (fg, bg uint8)

	// Fill sets the contents of the specified rectangular region to the
	// requested color. Both x and y coordinates are 1-based (top-left
	// corner has coordinates 1,1).
	Fill(x, y, width, height uint32, fg, bg uint8)

	// Scroll the console contents to the specified direction. The caller
	// is responsible for updating (e.g. clear or replace) the contents of
	// the region that was scrolled.
	Scroll(dir ScrollDir, lines uint32)

	// Write a char to the specified location. Both x and y coordinates are
	// 1-based (top-left corner has coordinates 1,1).
	Write(ch byte, fg, bg uint8, x, y uint32)

	// Palette returns the active color palette for this console.
	Palette() color.Palette

	// SetPaletteColor updates the color definition for the specified
	// palette index. Passing a color index greated than the number of
	// supported colors should be a no-op.
	SetPaletteColor(uint8, color.RGBA)
}

The Device interface is implemented by objects that can function as system consoles.

type Dimension

type Dimension uint8

Dimension defines the types of dimensions that can be queried off a device.

const (
	// Characters describes the number of characters in
	// the console depending on the currently active
	// font.
	Characters Dimension = iota

	// Pixels describes the number of pixels in the console framebuffer.
	Pixels
)

type FontSetter

type FontSetter interface {
	SetFont(*font.Font)
}

FontSetter is an interface implemented by console devices that support loadable bitmap fonts.

SetFont selects a bitmap font to be used by the console.

type LogoSetter

type LogoSetter interface {
}

LogoSetter is an interface implemented by console devices that support drawing of logo images.

SetLogo selects the logo to be drawn by the console.

type ScrollDir

type ScrollDir uint8

ScrollDir defines a scroll direction.

const (
	ScrollDirUp ScrollDir = iota
	ScrollDirDown
)

The supported list of scroll directions for the console Scroll() calls.

type VesaFbConsole

type VesaFbConsole struct {
	// contains filtered or unexported fields
}

VesaFbConsole is a driver for a console backed by a VESA linear framebuffer. The driver supports framebuffers with depth 8, 15, 16, 24 and 32 bpp. In all framebuffer configurations, the driver exposes a 256-color palette whose entries get mapped to the correct pixel format for the framebuffer.

To provide text output, a font needs to be specified via the SetFont method.

func NewVesaFbConsole

func NewVesaFbConsole(width, height uint32, bpp uint8, pitch uint32, colorInfo *multiboot.FramebufferRGBColorInfo, fbPhysAddr uintptr) *VesaFbConsole

NewVesaFbConsole returns a new instance of the vesa framebuffer driver.

func (*VesaFbConsole) DefaultColors

func (cons *VesaFbConsole) DefaultColors() (fg uint8, bg uint8)

DefaultColors returns the default foreground and background colors used by this console.

func (*VesaFbConsole) Dimensions

func (cons *VesaFbConsole) Dimensions(dim Dimension) (uint32, uint32)

Dimensions returns the console width and height in the specified dimension.

func (*VesaFbConsole) DriverInit

func (cons *VesaFbConsole) DriverInit(w io.Writer) *kernel.Error

DriverInit initializes this driver.

func (*VesaFbConsole) DriverName

func (cons *VesaFbConsole) DriverName() string

DriverName returns the name of this driver.

func (*VesaFbConsole) DriverVersion

func (cons *VesaFbConsole) DriverVersion() (uint16, uint16, uint16)

DriverVersion returns the version of this driver.

func (*VesaFbConsole) Fill

func (cons *VesaFbConsole) Fill(x, y, width, height uint32, _, bg uint8)

Fill sets the contents of the specified rectangular region to the requested color. Both x and y coordinates are 1-based.

func (*VesaFbConsole) Palette

func (cons *VesaFbConsole) Palette() color.Palette

Palette returns the active color palette for this console.

func (*VesaFbConsole) Scroll

func (cons *VesaFbConsole) Scroll(dir ScrollDir, lines uint32)

Scroll the console contents to the specified direction. The caller is responsible for updating (e.g. clear or replace) the contents of the region that was scrolled.

func (*VesaFbConsole) SetFont

func (cons *VesaFbConsole) SetFont(f *font.Font)

SetFont selects a bitmap font to be used by the console.

func (cons *VesaFbConsole) SetLogo(l *logo.Image)

SetLogo selects the logo to be displayed by the console. The logo colors will be remapped to the end of the console's palette and space equal to the logo height will be reserved at the top of the framebuffer for diplaying the logo.

As setting a logo changes the available space for rendering text, SetLogo must be invoked before SetFont.

func (*VesaFbConsole) SetPaletteColor

func (cons *VesaFbConsole) SetPaletteColor(index uint8, rgba color.RGBA)

SetPaletteColor updates the color definition for the specified palette index. Passing a color index greated than the number of supported colors should be a no-op.

func (*VesaFbConsole) Write

func (cons *VesaFbConsole) Write(ch byte, fg, bg uint8, x, y uint32)

Write a char to the specified location. If fg or bg exceed the supported colors for this console, they will be set to their default value. Both x and y coordinates are 1-based

type VgaTextConsole

type VgaTextConsole struct {
	// contains filtered or unexported fields
}

VgaTextConsole implements an EGA-compatible 80x25 text console using VGA mode 0x3. The console supports the default 16 EGA colors which can be overridden using the SetPaletteColor method.

Each character in the console framebuffer is represented using two bytes, a byte for the character ASCII code and a byte that encodes the foreground and background colors (4 bits for each).

The default settings for the console are:

  • light gray text (color 7) on black background (color 0).
  • space as the clear character

func NewVgaTextConsole

func NewVgaTextConsole(columns, rows uint32, fbPhysAddr uintptr) *VgaTextConsole

NewVgaTextConsole creates an new vga text console with its framebuffer mapped to fbPhysAddr.

func (*VgaTextConsole) DefaultColors

func (cons *VgaTextConsole) DefaultColors() (fg uint8, bg uint8)

DefaultColors returns the default foreground and background colors used by this console.

func (*VgaTextConsole) Dimensions

func (cons *VgaTextConsole) Dimensions(dim Dimension) (uint32, uint32)

Dimensions returns the console width and height in the specified dimension.

func (*VgaTextConsole) DriverInit

func (cons *VgaTextConsole) DriverInit(w io.Writer) *kernel.Error

DriverInit initializes this driver.

func (*VgaTextConsole) DriverName

func (cons *VgaTextConsole) DriverName() string

DriverName returns the name of this driver.

func (*VgaTextConsole) DriverVersion

func (cons *VgaTextConsole) DriverVersion() (uint16, uint16, uint16)

DriverVersion returns the version of this driver.

func (*VgaTextConsole) Fill

func (cons *VgaTextConsole) Fill(x, y, width, height uint32, fg, bg uint8)

Fill sets the contents of the specified rectangular region to the requested color. Both x and y coordinates are 1-based.

func (*VgaTextConsole) Palette

func (cons *VgaTextConsole) Palette() color.Palette

Palette returns the active color palette for this console.

func (*VgaTextConsole) Scroll

func (cons *VgaTextConsole) Scroll(dir ScrollDir, lines uint32)

Scroll the console contents to the specified direction. The caller is responsible for updating (e.g. clear or replace) the contents of the region that was scrolled.

func (*VgaTextConsole) SetPaletteColor

func (cons *VgaTextConsole) SetPaletteColor(index uint8, rgba color.RGBA)

SetPaletteColor updates the color definition for the specified palette index. Passing a color index greated than the number of supported colors should be a no-op.

func (*VgaTextConsole) Write

func (cons *VgaTextConsole) Write(ch byte, fg, bg uint8, x, y uint32)

Write a char to the specified location. If fg or bg exceed the supported colors for this console, they will be set to their default value. Both x and y coordinates are 1-based

Directories

Path Synopsis
Package logo contains logos that can be used with a framebuffer console.
Package logo contains logos that can be used with a framebuffer console.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL