Documentation ¶
Index ¶
- Constants
- func BGRA(p []uint8)
- func PixelsToTwips(pixels int, dpi int) int
- func TwipsToPixels(twips int, dpi int) int
- type Document
- func (document *Document) Close()
- func (document *Document) CreateView() int
- func (document *Document) GetPart() int
- func (document *Document) GetPartName(part int) string
- func (document *Document) GetPartPageRectangles() []image.Rectangle
- func (document *Document) GetParts() int
- func (document *Document) GetSize() (int, int)
- func (document *Document) GetTextSelection(mimetype string) string
- func (document *Document) GetTileMode() int
- func (document *Document) GetType() int
- func (document *Document) GetView() int
- func (document *Document) InitializeForRendering(arguments string)
- func (document *Document) PaintTile(buf unsafe.Pointer, canvasWidth int, canvasHeight int, tilePosX int, ...)
- func (document *Document) ResetTextSelection()
- func (document *Document) SaveAs(path string, format string, filter string) error
- func (document *Document) SetPart(part int)
- func (document *Document) SetTextSelection(sType int, x int, y int)
- type Office
Constants ¶
const ( TextDocument = iota SpreadsheetDocument PresentationDocument DrawingDocument OtherDocument )
Types of documents returned by Document.GetType function
const ( RGBATilemode = iota BGRATilemode )
Types of tile color mode
const ( SetGraphicSelectionStart = iota SetGraphicSelectionEnd )
Variables ¶
This section is empty.
Functions ¶
func BGRA ¶
func BGRA(p []uint8)
BGRA converts BGRA array of pixels to RGBA https://github.com/golang/exp/blob/master/shiny/driver/internal/swizzle/swizzle_common.go#L13
func PixelsToTwips ¶
PixelsToTwips is like TwipsToPixels, but to another way
func TwipsToPixels ¶
TwipsToPixels converts given twips to pixels with given dpi
Types ¶
type Document ¶
type Document struct {
// contains filtered or unexported fields
}
func (*Document) CreateView ¶
CreateView return id if newly created view
func (*Document) GetPart ¶
GetPart returns current part of document, e.g. if document was just loaded it's current part will be 0
func (*Document) GetPartName ¶
GetPartName returns current slide title (for presentations) or page title (for text documents)
func (*Document) GetPartPageRectangles ¶
GetPartPageRectangles array of image.Rectangle, with actually TextDocument page rectangles. Useful, when rendering text document page-by-page.
func (*Document) GetParts ¶
GetParts returns count of slides (for presentations) or pages (for text documents)
func (*Document) GetSize ¶
GetSize returns width and height of document in twips (1 Twip = 1/1440th of an inch) You can convert twips to pixels by this formula: (width or height) * (1.0 / 1440.0) * DPI
func (*Document) GetTextSelection ¶
func (*Document) GetTileMode ¶
GetTileMode returns tile mode of document, currently only RGBA or BGRA (5.2). You can compare returned int with RGBATilemode / BGRATilemode.
func (*Document) InitializeForRendering ¶
InitializeForRendering must be called before performing any rendering-related actions
func (*Document) PaintTile ¶
func (document *Document) PaintTile(buf unsafe.Pointer, canvasWidth int, canvasHeight int, tilePosX int, tilePosY int, tileWidth int, tileHeight int)
PaintTile renders tile to given buf (which size must be a `4 * canvasWidth * canvasHeight`). In practice buf must be a pointer to image.Image.Pix array's first element, e.g. unsafe.Pointer(&image.Pix[0])
func (*Document) ResetTextSelection ¶
func (document *Document) ResetTextSelection()
func (*Document) SaveAs ¶
SaveAs saves document at desired path in desired format with applied filter rules Actual (from libreoffice) error message can be read with Office.GetError
type Office ¶
func NewOffice ¶
NewOffice returns new Office or error if LibreOfficeKit fails to load required libs (actually, when libreofficekit-dev package isn't installed or path is invalid)
func NewOfficeWithProfile ¶
NewOfficeWithPath returns new Office or error if LibreOfficeKit fails to load required libs (actually, when libreofficekit-dev package isn't installed or path is invalid) profile path should already exist