Ejemplo n.º 1
0
func (self *Canvas) SetSize(width, height uint) error {
	if C.MagickSetSize(self.wand, C.size_t(width), C.size_t(height)) == C.MagickFalse {
		return fmt.Errorf("Could not set size: %s", self.Error())
	}

	return nil
}
Ejemplo n.º 2
0
Archivo: mage.go Proyecto: dqminh/mage
// Private: Create a blank magick wand with size width and height
//
// Params:
// - format: format of the new image
// - width: width of the new image
// - height: height of the new image
//
// Examples
//  blankWand("jpg", 100, 100)
//
// Return *C.MagickWand
func blankWand(format string, width, height int) *C.MagickWand {
	wand := C.NewMagickWand()
	cformat := C.CString(format)
	noneBackground := C.CString("none")
	defer C.free(unsafe.Pointer(cformat))
	defer C.free(unsafe.Pointer(noneBackground))

	C.MagickSetFormat(wand, C.CString(format))
	pixel := C.NewPixelWand()
	defer C.DestroyPixelWand(pixel)

	C.PixelSetColor(pixel, noneBackground)
	C.MagickSetSize(wand, C.size_t(width), C.size_t(height))
	C.MagickNewImage(wand, C.size_t(width), C.size_t(height), pixel)
	return wand
}
Ejemplo n.º 3
0
// Sets the size of the magick wand. Set it before you read a raw image format
// such as RGB, GRAY, or CMYK.
func (mw *MagickWand) SetSize(cols, rows uint) error {
	C.MagickSetSize(mw.mw, C.size_t(cols), C.size_t(rows))
	return mw.GetLastError()
}
Ejemplo n.º 4
0
// Sets the size of the magick wand. Set it before you read a raw image format
// such as RGB, GRAY, or CMYK.
func (mw *MagickWand) SetSize(cols, rows uint) error {
	ok := C.MagickSetSize(mw.mw, C.size_t(cols), C.size_t(rows))
	return mw.getLastErrorIfFailed(ok)
}