Documentation
¶
Index ¶
- type Device
- type Dimension
- type FontSetter
- type LogoSetter
- type ScrollDir
- type VesaFbConsole
- func (cons *VesaFbConsole) DefaultColors() (fg uint8, bg uint8)
- func (cons *VesaFbConsole) Dimensions(dim Dimension) (uint32, uint32)
- func (cons *VesaFbConsole) DriverInit(w io.Writer) *kernel.Error
- func (cons *VesaFbConsole) DriverName() string
- func (cons *VesaFbConsole) DriverVersion() (uint16, uint16, uint16)
- func (cons *VesaFbConsole) Fill(x, y, width, height uint32, _, bg uint8)
- func (cons *VesaFbConsole) Palette() color.Palette
- func (cons *VesaFbConsole) Scroll(dir ScrollDir, lines uint32)
- func (cons *VesaFbConsole) SetFont(f *font.Font)
- func (cons *VesaFbConsole) SetLogo(l *logo.Image)
- func (cons *VesaFbConsole) SetPaletteColor(index uint8, rgba color.RGBA)
- func (cons *VesaFbConsole) Write(ch byte, fg, bg uint8, x, y uint32)
- type VgaTextConsole
- func (cons *VgaTextConsole) DefaultColors() (fg uint8, bg uint8)
- func (cons *VgaTextConsole) Dimensions(dim Dimension) (uint32, uint32)
- func (cons *VgaTextConsole) DriverInit(w io.Writer) *kernel.Error
- func (cons *VgaTextConsole) DriverName() string
- func (cons *VgaTextConsole) DriverVersion() (uint16, uint16, uint16)
- func (cons *VgaTextConsole) Fill(x, y, width, height uint32, fg, bg uint8)
- func (cons *VgaTextConsole) Palette() color.Palette
- func (cons *VgaTextConsole) Scroll(dir ScrollDir, lines uint32)
- func (cons *VgaTextConsole) SetPaletteColor(index uint8, rgba color.RGBA)
- func (cons *VgaTextConsole) Write(ch byte, fg, bg uint8, x, y uint32)
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.
type FontSetter ¶
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 ¶
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 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 (*VesaFbConsole) SetLogo ¶
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.
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.