Exemplo n.º 1
0
// Returns a TextProperties structure.
// Parameters:
//   read_default: if false, returns an empty structure.
//				   if true, returns a structure set with current canvas settings
func (self *Canvas) NewTextProperties(read_default bool) *TextProperties {
	if read_default == true {
		cfont := C.DrawGetFont(self.drawing)
		defer C.free(unsafe.Pointer(cfont))
		cfamily := C.DrawGetFontFamily(self.drawing)
		defer C.free(unsafe.Pointer(cfamily))
		csize := C.DrawGetFontSize(self.drawing)
		cweight := C.DrawGetFontWeight(self.drawing)
		calignment := C.DrawGetTextAlignment(self.drawing)
		cantialias := C.DrawGetTextAntialias(self.drawing)
		ckerning := C.DrawGetTextKerning(self.drawing)
		antialias := false
		if cantialias == C.MagickTrue {
			antialias = true
		}

		underColor := C.NewPixelWand()
		C.DrawGetTextUnderColor(self.drawing, underColor)
		return &TextProperties{
			Font:       C.GoString(cfont),
			Family:     C.GoString(cfamily),
			Size:       float64(csize),
			Weight:     uint(cweight),
			Alignment:  Alignment(calignment),
			Antialias:  antialias,
			Kerning:    float64(ckerning),
			UnderColor: underColor,
		}
	}
	return &TextProperties{
		UnderColor: C.NewPixelWand(),
	}
}
Exemplo n.º 2
0
// Returns a string specifying the font used when annotating with text.
func (dw *DrawingWand) GetFont() string {
	csfont := C.DrawGetFont(dw.dw)
	defer C.free(unsafe.Pointer(csfont))
	return C.GoString(csfont)
}
Exemplo n.º 3
0
// Returns a string specifying the font used when annotating with text.
func (dw *DrawingWand) GetFont() string {
	csfont := C.DrawGetFont(dw.dw)
	defer relinquishMemory(unsafe.Pointer(csfont))
	return C.GoString(csfont)
}