Esempio n. 1
0
func genIconThumbnail(info pathInfo, dest, bg string) bool {
	if len(dest) < 1 || len(bg) < 1 {
		return false
	}

	theme := path.Base(info.Path)
	item1, item2, item3 := getIconFiles(theme)
	if len(item1) < 1 || len(item2) < 1 || len(item3) < 1 {
		logger.Debug("getIconTypeFile Failed")
		return false
	}

	cBg := C.CString(bg)
	defer C.free(unsafe.Pointer(cBg))
	cDest := C.CString(dest)
	defer C.free(unsafe.Pointer(cDest))
	cItem1 := C.CString(item1)
	defer C.free(unsafe.Pointer(cItem1))
	cItem2 := C.CString(item2)
	defer C.free(unsafe.Pointer(cItem2))
	cItem3 := C.CString(item3)
	defer C.free(unsafe.Pointer(cItem3))

	ret := C.gen_icon_preview(cBg, cDest, cItem1, cItem2, cItem3)
	if int(ret) == -1 {
		logger.Debug("Generate Icon Thumbnail Error")
		return false
	}

	return true
}
Esempio n. 2
0
func genCursorThumbnail(info pathInfo, dest, bg string) bool {
	if len(dest) < 1 || len(bg) < 1 {
		return false
	}

	item1, item2, item3 := getCursorIcons(info)
	if len(item1) < 1 || len(item2) < 1 || len(item3) < 1 {
		logger.Debug("getCursorIcons Failed")
		return false
	}

	cBg := C.CString(bg)
	defer C.free(unsafe.Pointer(cBg))
	cDest := C.CString(dest)
	defer C.free(unsafe.Pointer(cDest))
	cItem1 := C.CString(item1)
	defer C.free(unsafe.Pointer(cItem1))
	cItem2 := C.CString(item2)
	defer C.free(unsafe.Pointer(cItem2))
	cItem3 := C.CString(item3)
	defer C.free(unsafe.Pointer(cItem3))

	ret := C.gen_icon_preview(cBg, cDest, cItem1, cItem2, cItem3)
	if int(ret) == -1 {
		logger.Debug("Generate Cursor Thumbnail Error")
		return false
	}

	return true
}