Пример #1
0
func cfgSurf(ps *C.cairo_surface_t, eps bool, header, setup Comments) {
	var ceps C.cairo_bool_t
	if eps {
		ceps = 1
	}
	C.cairo_ps_surface_set_eps(ps, ceps)

	for _, c := range header {
		s := C.CString(c.String())
		C.cairo_ps_surface_dsc_comment(ps, s)
		C.free(unsafe.Pointer(s))
	}

	if len(setup) > 0 {
		C.cairo_ps_surface_dsc_begin_setup(ps)

		for _, c := range setup {
			s := C.CString(c.String())
			C.cairo_ps_surface_dsc_comment(ps, s)
			C.free(unsafe.Pointer(s))
		}
	}

	//ensure calls to AddComments apply to page even if no drawing has been performed.
	C.cairo_ps_surface_dsc_begin_page_setup(ps)
}
Пример #2
0
//AddComments adds comments to the PageSetup sections.
//
//Originally cairo_ps_surface_dsc_comment.
func (s Surface) AddComments(comments Comments) (err error) {
	if err = comments.Err(); err != nil {
		return
	}

	for _, c := range comments {
		str := C.CString(c.String())
		C.cairo_ps_surface_dsc_comment(s.XtensionRaw(), str)
		C.free(unsafe.Pointer(str))
	}

	return s.Err()
}