예제 #1
0
파일: surface.go 프로젝트: ungerik/go-cairo
func NewPDFSurface(filename string, widthInPoints, heightInPoints float64, version PDFVersion) *Surface {
	cs := C.CString(filename)
	defer C.free(unsafe.Pointer(cs))
	s := C.cairo_pdf_surface_create(cs, C.double(widthInPoints), C.double(heightInPoints))
	C.cairo_pdf_surface_restrict_to_version(s, C.cairo_pdf_version_t(version))
	return &Surface{surface: s, context: C.cairo_create(s)}
}
예제 #2
0
func (p version) String() string {
	v := C.cairo_pdf_version_to_string(C.cairo_pdf_version_t(p))
	if v == nil {
		return "unknown PDF version"
	}
	return C.GoString(v)
}
예제 #3
0
파일: cairo.go 프로젝트: mantyr/go-cairo
func (self PDFVersion) String() string {
	return C.GoString(C.cairo_pdf_version_to_string(C.cairo_pdf_version_t(self)))
}
예제 #4
0
파일: pdf.go 프로젝트: jimmyfrasche/cairo
//RestrictTo restricts the generated PDF to the specified verison.
//
//This method should only be called before any drawing operations have been
//performed on this surface.
//
//Originally cairo_pdf_surface_restrict_to_version.
func (s Surface) RestrictTo(v version) error {
	C.cairo_pdf_surface_restrict_to_version(s.XtensionRaw(), C.cairo_pdf_version_t(v))
	return s.Err()
}