Documentation ¶
Index ¶
- func Blur(pixbuf *C.GdkPixbuf, sigma, numSteps float64) (err error)
- func BlurImage(srcFile, dstFile string, sigma, numSteps float64, f Format) (err error)
- func BlurImageCache(srcFile string, sigma, numSteps float64, f Format) (dstFile string, useCache bool, err error)
- func ClipImage(srcFile, destFile string, srcX, srcY, width, height int, f Format) (err error)
- func ConvertImage(srcFile, destFile string, f Format) (err error)
- func ConvertImageToXpixmap(imgFile string) (xpixmap x.Pixmap, err error)
- func ConvertPixbufToXpixmap(pixbuf *C.GdkPixbuf) (xpixmap x.Pixmap, err error)
- func ConvertXpixmapToPixbuf(xpixmap x.Pixmap, width, height int) (pixbuf *C.GdkPixbuf, err error)
- func CopyArea(srcPixbuf, destPixbuf *C.GdkPixbuf, ...) (err error)
- func CopyAreaSimple(srcPixbuf *C.GdkPixbuf, srcX, srcY, width, height int) (destPixbuf *C.GdkPixbuf, err error)
- func Flip(srcPixbuf *C.GdkPixbuf, horizontal bool) (destPixbuf *C.GdkPixbuf, err error)
- func FlipImageHorizontal(srcFile, destFile string, f Format) (err error)
- func FlipImageVertical(srcFile, destFile string, f Format) (err error)
- func FreePixbuf(pixbuf *C.GdkPixbuf)
- func GetDominantColor(pixbuf *C.GdkPixbuf) (h, s, v float64, err error)
- func GetDominantColorOfImage(imgFile string) (h, s, v float64, err error)
- func GetImageSize(imgFile string) (w, h int, err error)
- func GetPreferScaleClipRect(refWidth, refHeight, imgWidth, imgHeight int) (x, y, w, h int, err error)
- func GetSize(pixbuf *C.GdkPixbuf) (w, h int, err error)
- func Hsv2Rgb(h, s, v float64) (r, g, b uint8)
- func InitGdk() (err error)
- func InitGdkXlib() (err error)
- func IsSupportedImage(imgFile string) bool
- func NewPixbufFromFile(imgFile string) (pixbuf *C.GdkPixbuf, err error)
- func Rgb2Hsv(r, g, b uint8) (h, s, v float64)
- func RotateImageLeft(srcFile, destFile string, f Format) (err error)
- func RotateImageRight(srcFile, destFile string, f Format) (err error)
- func RotateImageUpsizedown(srcFile, destFile string, f Format) (err error)
- func RotateSimple(srcPixbuf *C.GdkPixbuf, angle GdkPixbufRotation) (destPixbuf *C.GdkPixbuf, err error)
- func Save(pixbuf *C.GdkPixbuf, destFile string, f Format) (err error)
- func ScaleImage(srcFile, destFile string, newWidth, newHeght int, interpType GdkInterpType, ...) (err error)
- func ScaleImageCache(srcFile string, newWidth, newHeght int, interpType GdkInterpType, f Format) (destFile string, useCache bool, err error)
- func ScaleImagePrefer(srcFile, destFile string, newWidth, newHeght int, interpType GdkInterpType, ...) (err error)
- func ScaleImagePreferCache(srcFile string, newWidth, newHeght int, interpType GdkInterpType, f Format) (destFile string, useCache bool, err error)
- func ScalePrefer(srcPixbuf *C.GdkPixbuf, newWidth, newHeight int, interpType GdkInterpType) (destPixbuf *C.GdkPixbuf, err error)
- func ScaleSimple(srcPixbuf *C.GdkPixbuf, newWidth, newHeght int, interpType GdkInterpType) (destPixbuf *C.GdkPixbuf, err error)
- func Screenshot() (pixbuf *C.GdkPixbuf, err error)
- func ScreenshotImage(file string, f Format) (err error)
- func Thumbnail(srcPixbuf *C.GdkPixbuf, maxWidth, maxHeight int, interpType GdkInterpType) (destPixbuf *C.GdkPixbuf, err error)
- func ThumbnailImage(srcFile, destFile string, maxWidth, maxHeight int, interpType GdkInterpType, ...) (err error)
- type Format
- type GdkColorspace
- type GdkInterpType
- type GdkPixbufAlphaMode
- type GdkPixbufError
- type GdkPixbufRotation
- type GdkPixdataDumpType
- type GdkPixdataType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BlurImageCache ¶
func BlurImageCache(srcFile string, sigma, numSteps float64, f Format) (dstFile string, useCache bool, err error)
BlurImageCache generate and save the blurred image file to cache directory, if target file already exists, just return it.
func ConvertImage ¶
func ConvertImageToXpixmap ¶
ConvertImageToXpixmap convert image file to x pixmap.
func ConvertPixbufToXpixmap ¶
func ConvertXpixmapToPixbuf ¶
func CopyAreaSimple ¶
func FlipImageHorizontal ¶
func FlipImageVertical ¶
func FreePixbuf ¶
func GetDominantColorOfImage ¶
GetDominantColorOfImage return the dominant hsv color of an image.
func GetImageSize ¶
GetImageSize return image file's width and height.
func GetPreferScaleClipRect ¶
func GetPreferScaleClipRect(refWidth, refHeight, imgWidth, imgHeight int) (x, y, w, h int, err error)
GetPreferScaleClipRect get the maximum rectangle in center of image which with the same scale to reference width/heigh.
func Hsv2Rgb ¶
Hsv2Rgb convert color format from HSV(h=[0..360), s,v=[0..1]) to RGB(r, g, b=[0..255]).
func InitGdkXlib ¶
func InitGdkXlib() (err error)
InitGdkXlib initialize gdk and xlib, should not be used with InitGdk().
func IsSupportedImage ¶
IsSupportedImage check if image file is supported.
func Rgb2Hsv ¶
Rgb2Hsv convert color format from RGB(r, g, b=[0..255]) to HSV(h=[0..360), s,v=[0..1]).
func RotateImageLeft ¶
func RotateImageRight ¶
func RotateImageUpsizedown ¶
func RotateSimple ¶
func ScaleImage ¶
func ScaleImage(srcFile, destFile string, newWidth, newHeght int, interpType GdkInterpType, f Format) (err error)
ScaleImage returns a new image file with the given width and height created by resizing the given image.
func ScaleImageCache ¶
func ScaleImagePrefer ¶
func ScaleImagePrefer(srcFile, destFile string, newWidth, newHeght int, interpType GdkInterpType, f Format) (err error)
ScaleImagePrefer resize image file to new width and heigh, and maintain the original proportions unchanged.
func ScaleImagePreferCache ¶
func ScalePrefer ¶
func ScalePrefer(srcPixbuf *C.GdkPixbuf, newWidth, newHeight int, interpType GdkInterpType) (destPixbuf *C.GdkPixbuf, err error)
ScalePrefer resize pixbuf to new width and heigh, and maintain the original proportions unchanged.
func ScaleSimple ¶
func Screenshot ¶
func ScreenshotImage ¶
func Thumbnail ¶
func Thumbnail(srcPixbuf *C.GdkPixbuf, maxWidth, maxHeight int, interpType GdkInterpType) (destPixbuf *C.GdkPixbuf, err error)
Thumbnail resize pixbuf with limited maximum width and height.
func ThumbnailImage ¶
func ThumbnailImage(srcFile, destFile string, maxWidth, maxHeight int, interpType GdkInterpType, f Format) (err error)
ThumbnailImage resize target image file with limited maximum width and height.
Types ¶
type Format ¶
type Format string
Format defines the type of image format.
const ( FormatPng Format = "png" FormatJpeg Format = "jpeg" FormatBmp Format = "bmp" FormatIco Format = "ico" FormatTiff Format = "tiff" )
Registered image format.
func GetImageFormat ¶
GetImageFormat return image file's format, such as "png", "jpeg".
type GdkInterpType ¶
type GdkInterpType uint
const ( GDK_INTERP_NEAREST GdkInterpType = iota GDK_INTERP_TILES GDK_INTERP_BILINEAR GDK_INTERP_HYPER )
type GdkPixbufAlphaMode ¶
type GdkPixbufAlphaMode uint
const ( GDK_PIXBUF_ALPHA_BILEVEL GdkPixbufAlphaMode = iota GDK_PIXBUF_ALPHA_FULL )
type GdkPixbufError ¶
type GdkPixbufError uint
const ( /* image data hosed */ GDK_PIXBUF_ERROR_CORRUPT_IMAGE GdkPixbufError = iota /* no mem to load image */ GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY /* bad option passed to save routine */ GDK_PIXBUF_ERROR_BAD_OPTION /* unsupported image type (sort of an ENOSYS) */ GDK_PIXBUF_ERROR_UNKNOWN_TYPE /* unsupported operation (load, save) for image type */ GDK_PIXBUF_ERROR_UNSUPPORTED_OPERATION GDK_PIXBUF_ERROR_FAILED )
type GdkPixbufRotation ¶
type GdkPixbufRotation uint
const ( GDK_PIXBUF_ROTATE_NONE GdkPixbufRotation = 0 GDK_PIXBUF_ROTATE_COUNTERCLOCKWISE GdkPixbufRotation = 90 GDK_PIXBUF_ROTATE_UPSIDEDOWN GdkPixbufRotation = 180 GDK_PIXBUF_ROTATE_CLOCKWISE GdkPixbufRotation = 270 )
type GdkPixdataDumpType ¶
type GdkPixdataDumpType uint
const ( /* type of source to save */ GDK_PIXDATA_DUMP_PIXDATA_STREAM GdkPixdataDumpType = 0 GDK_PIXDATA_DUMP_PIXDATA_STRUCT GdkPixdataDumpType = 1 GDK_PIXDATA_DUMP_MACROS GdkPixdataDumpType = 2 /* type of variables to use */ GDK_PIXDATA_DUMP_GTYPES GdkPixdataDumpType = 0 GDK_PIXDATA_DUMP_CTYPES GdkPixdataDumpType = 1 << 8 GDK_PIXDATA_DUMP_STATIC GdkPixdataDumpType = 1 << 9 GDK_PIXDATA_DUMP_CONST GdkPixdataDumpType = 1 << 10 /* save RLE decoder macro? */ GDK_PIXDATA_DUMP_RLE_DECODER GdkPixdataDumpType = 1 << 16 )
type GdkPixdataType ¶
type GdkPixdataType uint
const ( /* colorspace + alpha */ GDK_PIXDATA_COLOR_TYPE_RGB GdkPixdataType = 0x01 GDK_PIXDATA_COLOR_TYPE_RGBA GdkPixdataType = 0x02 GDK_PIXDATA_COLOR_TYPE_MASK GdkPixdataType = 0xff /* width, support 8bits only currently */ GDK_PIXDATA_SAMPLE_WIDTH_8 GdkPixdataType = 0x01 << 16 GDK_PIXDATA_SAMPLE_WIDTH_MASK GdkPixdataType = 0x0f << 16 /* encoding */ GDK_PIXDATA_ENCODING_RAW GdkPixdataType = 0x01 << 24 GDK_PIXDATA_ENCODING_RLE GdkPixdataType = 0x02 << 24 GDK_PIXDATA_ENCODING_MASK GdkPixdataType = 0x0f << 24 )