renderer

package
v0.0.0-...-0b4b87a Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2019 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AreaMapping

type AreaMapping struct {
	Area    image.Rectangle
	Content *RenderableDomElement
}

type BoxBorder

type BoxBorder struct {
	BoxOffset
	Color color.Color
	Style string
}

type BoxBorders

type BoxBorders struct {
	Top    BoxBorder
	Bottom BoxBorder
	Left   BoxBorder
	Right  BoxBorder
}

type BoxMargin

type BoxMargin BoxOffset

type BoxMargins

type BoxMargins struct {
	Top    BoxMargin
	Bottom BoxMargin
	Left   BoxMargin
	Right  BoxMargin
}

type BoxOffset

type BoxOffset struct {
	Width int
}

type BoxPadding

type BoxPadding BoxOffset

type BoxPaddings

type BoxPaddings struct {
	Top    BoxPadding
	Bottom BoxPadding
	Left   BoxPadding
	Right  BoxPadding
}

type DynamicMemoryDrawer

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

func NewDynamicMemoryDrawer

func NewDynamicMemoryDrawer(r image.Rectangle) *DynamicMemoryDrawer

func (*DynamicMemoryDrawer) At

func (d *DynamicMemoryDrawer) At(x, y int) color.Color

func (*DynamicMemoryDrawer) Bounds

func (d *DynamicMemoryDrawer) Bounds() image.Rectangle

func (*DynamicMemoryDrawer) ColorModel

func (d *DynamicMemoryDrawer) ColorModel() color.Model

func (*DynamicMemoryDrawer) GrowBounds

func (d *DynamicMemoryDrawer) GrowBounds(r image.Rectangle)

func (*DynamicMemoryDrawer) Set

func (d *DynamicMemoryDrawer) Set(x, y int, c color.Color)

type FloatStack

type FloatStack []*RenderableDomElement

A FloatStack represents the floating elements that haven't yet been cleared. There's generally two FloatStacks, one for the left elements, and one for the right elements. Once dot advances past the FloatStack, they're removed from the stack.

func (FloatStack) ClearFloats

func (f FloatStack) ClearFloats(dot image.Point) FloatStack

Remove any floats that are past dot from the float stack and return the floats that have not yet been cleared.

func (FloatStack) MaxX

func (f FloatStack) MaxX(loc image.Point) int

MaxX returns the highest X coordinate in the FloatStack, at height loc. This is mostly used to get the left edge of left floats at a certain height.

func (FloatStack) NextFloatHeight

func (f FloatStack) NextFloatHeight() int

func (FloatStack) WidthAt

func (f FloatStack) WidthAt(loc image.Point) int

type ImageMap

type ImageMap []AreaMapping

func NewImageMap

func NewImageMap() ImageMap

func (*ImageMap) Add

func (imap *ImageMap) Add(el *RenderableDomElement, location image.Rectangle)

func (ImageMap) At

func (imap ImageMap) At(x, y int) *RenderableDomElement

type Page

type Page struct {
	Content    *RenderableDomElement
	Background color.Color
	URL        *url.URL
	// contains filtered or unexported fields
}

Represents a page to be rendered

func LoadPage

func LoadPage(r io.Reader, loader net.URLReader, urlContext *url.URL) Page

Parses an io.Reader into a Page object.

func (*Page) ReapplyStyles

func (p *Page) ReapplyStyles()

type RenderableDomElement

type RenderableDomElement struct {
	*dom.Element
	Styles            *css.StyledElement
	ConditionalStyles struct {
		Unconditional          *css.StyledElement
		FirstLine, FirstLetter *css.StyledElement
	}

	Parent      *RenderableDomElement
	FirstChild  *RenderableDomElement
	NextSibling *RenderableDomElement
	PrevSibling *RenderableDomElement

	CSSOuterBox    image.Image
	ContentOverlay image.Image

	// The location within the parent to draw the OverlayedContent
	//DrawRectangle    image.Rectangle
	//BoxOrigin        image.Point
	BoxDrawRectangle    image.Rectangle
	BoxContentRectangle image.Rectangle

	ImageMap     ImageMap
	PageLocation *url.URL

	State css.State
	// contains filtered or unexported fields
}

func (*RenderableDomElement) FontVariant

func (e *RenderableDomElement) FontVariant() string

func (RenderableDomElement) GetBackgroundColor

func (e RenderableDomElement) GetBackgroundColor() color.Color

func (*RenderableDomElement) GetBackgroundImage

func (e *RenderableDomElement) GetBackgroundImage() image.Image

func (*RenderableDomElement) GetBackgroundRepeat

func (e *RenderableDomElement) GetBackgroundRepeat() string

func (RenderableDomElement) GetBorderBottomColor

func (e RenderableDomElement) GetBorderBottomColor() color.Color

func (RenderableDomElement) GetBorderBottomStyle

func (e RenderableDomElement) GetBorderBottomStyle() string

func (RenderableDomElement) GetBorderBottomWidth

func (e RenderableDomElement) GetBorderBottomWidth() int

func (RenderableDomElement) GetBorderLeftColor

func (e RenderableDomElement) GetBorderLeftColor() color.Color

func (RenderableDomElement) GetBorderLeftStyle

func (e RenderableDomElement) GetBorderLeftStyle() string

func (RenderableDomElement) GetBorderLeftWidth

func (e RenderableDomElement) GetBorderLeftWidth() int

func (RenderableDomElement) GetBorderRightColor

func (e RenderableDomElement) GetBorderRightColor() color.Color

func (RenderableDomElement) GetBorderRightStyle

func (e RenderableDomElement) GetBorderRightStyle() string

func (RenderableDomElement) GetBorderRightWidth

func (e RenderableDomElement) GetBorderRightWidth() int

func (RenderableDomElement) GetBorderTopColor

func (e RenderableDomElement) GetBorderTopColor() color.Color

func (RenderableDomElement) GetBorderTopStyle

func (e RenderableDomElement) GetBorderTopStyle() string

func (RenderableDomElement) GetBorderTopWidth

func (e RenderableDomElement) GetBorderTopWidth() int

func (RenderableDomElement) GetColor

func (e RenderableDomElement) GetColor() color.Color

func (RenderableDomElement) GetContainerWidth

func (e RenderableDomElement) GetContainerWidth(containerWidth int) int

func (RenderableDomElement) GetDisplayProp

func (e RenderableDomElement) GetDisplayProp() string

func (RenderableDomElement) GetFloat

func (e RenderableDomElement) GetFloat() string

func (*RenderableDomElement) GetFontFace

func (e *RenderableDomElement) GetFontFace(fsize int) font.Face

func (*RenderableDomElement) GetFontFamily

func (e *RenderableDomElement) GetFontFamily() css.FontFamily

func (*RenderableDomElement) GetFontSize

func (e *RenderableDomElement) GetFontSize() int

func (*RenderableDomElement) GetFontStyle

func (e *RenderableDomElement) GetFontStyle() font.Style

func (*RenderableDomElement) GetFontWeight

func (e *RenderableDomElement) GetFontWeight() font.Weight

func (RenderableDomElement) GetHeight

func (e RenderableDomElement) GetHeight() int

func (*RenderableDomElement) GetLineHeight

func (e *RenderableDomElement) GetLineHeight() int

func (*RenderableDomElement) GetListStyleType

func (e *RenderableDomElement) GetListStyleType() string

func (RenderableDomElement) GetMarginBottomSize

func (e RenderableDomElement) GetMarginBottomSize() int

func (RenderableDomElement) GetMarginLeftSize

func (e RenderableDomElement) GetMarginLeftSize() int

func (RenderableDomElement) GetMarginRightSize

func (e RenderableDomElement) GetMarginRightSize() int

func (RenderableDomElement) GetMarginTopSize

func (e RenderableDomElement) GetMarginTopSize() int

func (RenderableDomElement) GetMaxHeight

func (e RenderableDomElement) GetMaxHeight() int

func (RenderableDomElement) GetMaxWidth

func (e RenderableDomElement) GetMaxWidth() int

func (RenderableDomElement) GetMinHeight

func (e RenderableDomElement) GetMinHeight() int

func (RenderableDomElement) GetMinWidth

func (e RenderableDomElement) GetMinWidth() int

func (*RenderableDomElement) GetOverflow

func (e *RenderableDomElement) GetOverflow() string

func (RenderableDomElement) GetPaddingBottom

func (e RenderableDomElement) GetPaddingBottom() int

func (RenderableDomElement) GetPaddingLeft

func (e RenderableDomElement) GetPaddingLeft() int

func (RenderableDomElement) GetPaddingRight

func (e RenderableDomElement) GetPaddingRight() int

func (RenderableDomElement) GetPaddingTop

func (e RenderableDomElement) GetPaddingTop() int

func (*RenderableDomElement) GetTextDecoration

func (e *RenderableDomElement) GetTextDecoration() string

func (RenderableDomElement) GetTextIndent

func (e RenderableDomElement) GetTextIndent(containerWidth int) int

func (RenderableDomElement) GetTextTransform

func (e RenderableDomElement) GetTextTransform() string

func (*RenderableDomElement) GetVerticalAlign

func (e *RenderableDomElement) GetVerticalAlign() string

func (*RenderableDomElement) GetWhiteSpace

func (e *RenderableDomElement) GetWhiteSpace() string

func (RenderableDomElement) GetWidth

func (e RenderableDomElement) GetWidth() int

func (*RenderableDomElement) InvalidateLayout

func (e *RenderableDomElement) InvalidateLayout()

func (*RenderableDomElement) Layout

func (e *RenderableDomElement) Layout(ctx context.Context, viewportSize image.Point) error

Lays out the element into a viewport of size viewportSize.

func (*RenderableDomElement) RenderInto

func (e *RenderableDomElement) RenderInto(ctx context.Context, dst draw.Image, cursor image.Point) error

func (RenderableDomElement) String

func (e RenderableDomElement) String() string

func (*RenderableDomElement) Walk

func (e *RenderableDomElement) Walk(callback func(*RenderableDomElement))

type Renderer

type Renderer interface {
	// Lays out an element in preparation for rendering
	Layout(ctx context.Context, viewportSize image.Point) error

	// Draws the element into dst, scrolled so that the top left of the
	// image is at cursor. Layout must be called before RenderInto.
	RenderInto(ctx context.Context, dst draw.Image, cursor image.Point) error
}

A RenderableElement is something that can be rendered to an image.

Jump to

Keyboard shortcuts

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