v0.2.1 c0399be

pango-renderer.go RawHistoryFolder

1// Package pango was automatically generated by github.com/bnema/puregotk DO NOT EDIT
2package pango
3
4import (
5	"structs"
6	"unsafe"
7
8	"github.com/ebitengine/purego"
9
10	"github.com/bnema/puregotk/pkg/core"
11	"github.com/bnema/puregotk/v4/gobject"
12	"github.com/bnema/puregotk/v4/gobject/types"
13)
14
15// Class structure for `PangoRenderer`.
16//
17// The following vfuncs take user space coordinates in Pango units
18// and have default implementations:
19// - draw_glyphs
20// - draw_rectangle
21// - draw_error_underline
22// - draw_shape
23// - draw_glyph_item
24//
25// The default draw_shape implementation draws nothing.
26//
27// The following vfuncs take device space coordinates as doubles
28// and must be implemented:
29// - draw_trapezoid
30// - draw_glyph
31type RendererClass struct {
32	_ structs.HostLayout
33
34	ParentClass gobject.ObjectClass
35
36	xDrawGlyphs uintptr
37
38	xDrawRectangle uintptr
39
40	xDrawErrorUnderline uintptr
41
42	xDrawShape uintptr
43
44	xDrawTrapezoid uintptr
45
46	xDrawGlyph uintptr
47
48	xPartChanged uintptr
49
50	xBegin uintptr
51
52	xEnd uintptr
53
54	xPrepareRun uintptr
55
56	xDrawGlyphItem uintptr
57
58	xPangoReserved2 uintptr
59
60	xPangoReserved3 uintptr
61
62	xPangoReserved4 uintptr
63}
64
65func (x *RendererClass) GoPointer() uintptr {
66	return uintptr(unsafe.Pointer(x))
67}
68
69// OverrideDrawGlyphs sets the "draw_glyphs" callback function.
70// draws a `PangoGlyphString`
71func (x *RendererClass) OverrideDrawGlyphs(cb func(*Renderer, *Font, *GlyphString, int, int)) {
72	if cb == nil {
73		x.xDrawGlyphs = 0
74	} else {
75		x.xDrawGlyphs = purego.NewCallback(func(RendererVarp uintptr, FontVarp uintptr, GlyphsVarp *GlyphString, XVarp int, YVarp int) {
76			cb(RendererNewFromInternalPtr(RendererVarp), FontNewFromInternalPtr(FontVarp), GlyphsVarp, XVarp, YVarp)
77		})
78	}
79}
80
81// GetDrawGlyphs gets the "draw_glyphs" callback function.
82// draws a `PangoGlyphString`
83func (x *RendererClass) GetDrawGlyphs() func(*Renderer, *Font, *GlyphString, int, int) {
84	if x.xDrawGlyphs == 0 {
85		return nil
86	}
87	var rawCallback func(RendererVarp uintptr, FontVarp uintptr, GlyphsVarp *GlyphString, XVarp int, YVarp int)
88	purego.RegisterFunc(&rawCallback, x.xDrawGlyphs)
89	return func(RendererVar *Renderer, FontVar *Font, GlyphsVar *GlyphString, XVar int, YVar int) {
90		rawCallback(RendererVar.GoPointer(), FontVar.GoPointer(), GlyphsVar, XVar, YVar)
91	}
92}
93
94// OverrideDrawRectangle sets the "draw_rectangle" callback function.
95// draws a rectangle
96func (x *RendererClass) OverrideDrawRectangle(cb func(*Renderer, RenderPart, int, int, int, int)) {
97	if cb == nil {
98		x.xDrawRectangle = 0
99	} else {
100		x.xDrawRectangle = purego.NewCallback(func(RendererVarp uintptr, PartVarp RenderPart, XVarp int, YVarp int, WidthVarp int, HeightVarp int) {
101			cb(RendererNewFromInternalPtr(RendererVarp), PartVarp, XVarp, YVarp, WidthVarp, HeightVarp)
102		})
103	}
104}
105
106// GetDrawRectangle gets the "draw_rectangle" callback function.
107// draws a rectangle
108func (x *RendererClass) GetDrawRectangle() func(*Renderer, RenderPart, int, int, int, int) {
109	if x.xDrawRectangle == 0 {
110		return nil
111	}
112	var rawCallback func(RendererVarp uintptr, PartVarp RenderPart, XVarp int, YVarp int, WidthVarp int, HeightVarp int)
113	purego.RegisterFunc(&rawCallback, x.xDrawRectangle)
114	return func(RendererVar *Renderer, PartVar RenderPart, XVar int, YVar int, WidthVar int, HeightVar int) {
115		rawCallback(RendererVar.GoPointer(), PartVar, XVar, YVar, WidthVar, HeightVar)
116	}
117}
118
119// OverrideDrawErrorUnderline sets the "draw_error_underline" callback function.
120// draws a squiggly line that approximately
121// covers the given rectangle in the style of an underline used to
122// indicate a spelling error.
123func (x *RendererClass) OverrideDrawErrorUnderline(cb func(*Renderer, int, int, int, int)) {
124	if cb == nil {
125		x.xDrawErrorUnderline = 0
126	} else {
127		x.xDrawErrorUnderline = purego.NewCallback(func(RendererVarp uintptr, XVarp int, YVarp int, WidthVarp int, HeightVarp int) {
128			cb(RendererNewFromInternalPtr(RendererVarp), XVarp, YVarp, WidthVarp, HeightVarp)
129		})
130	}
131}
132
133// GetDrawErrorUnderline gets the "draw_error_underline" callback function.
134// draws a squiggly line that approximately
135// covers the given rectangle in the style of an underline used to
136// indicate a spelling error.
137func (x *RendererClass) GetDrawErrorUnderline() func(*Renderer, int, int, int, int) {
138	if x.xDrawErrorUnderline == 0 {
139		return nil
140	}
141	var rawCallback func(RendererVarp uintptr, XVarp int, YVarp int, WidthVarp int, HeightVarp int)
142	purego.RegisterFunc(&rawCallback, x.xDrawErrorUnderline)
143	return func(RendererVar *Renderer, XVar int, YVar int, WidthVar int, HeightVar int) {
144		rawCallback(RendererVar.GoPointer(), XVar, YVar, WidthVar, HeightVar)
145	}
146}
147
148// OverrideDrawShape sets the "draw_shape" callback function.
149// draw content for a glyph shaped with `PangoAttrShape`
150//
151//	@x, @y are the coordinates of the left edge of the baseline,
152//	in user coordinates.
153func (x *RendererClass) OverrideDrawShape(cb func(*Renderer, *AttrShape, int, int)) {
154	if cb == nil {
155		x.xDrawShape = 0
156	} else {
157		x.xDrawShape = purego.NewCallback(func(RendererVarp uintptr, AttrVarp *AttrShape, XVarp int, YVarp int) {
158			cb(RendererNewFromInternalPtr(RendererVarp), AttrVarp, XVarp, YVarp)
159		})
160	}
161}
162
163// GetDrawShape gets the "draw_shape" callback function.
164// draw content for a glyph shaped with `PangoAttrShape`
165//
166//	@x, @y are the coordinates of the left edge of the baseline,
167//	in user coordinates.
168func (x *RendererClass) GetDrawShape() func(*Renderer, *AttrShape, int, int) {
169	if x.xDrawShape == 0 {
170		return nil
171	}
172	var rawCallback func(RendererVarp uintptr, AttrVarp *AttrShape, XVarp int, YVarp int)
173	purego.RegisterFunc(&rawCallback, x.xDrawShape)
174	return func(RendererVar *Renderer, AttrVar *AttrShape, XVar int, YVar int) {
175		rawCallback(RendererVar.GoPointer(), AttrVar, XVar, YVar)
176	}
177}
178
179// OverrideDrawTrapezoid sets the "draw_trapezoid" callback function.
180// draws a trapezoidal filled area
181func (x *RendererClass) OverrideDrawTrapezoid(cb func(*Renderer, RenderPart, float64, float64, float64, float64, float64, float64)) {
182	if cb == nil {
183		x.xDrawTrapezoid = 0
184	} else {
185		x.xDrawTrapezoid = purego.NewCallback(func(RendererVarp uintptr, PartVarp RenderPart, Y1Varp float64, X11Varp float64, X21Varp float64, Y2Varp float64, X12Varp float64, X22Varp float64) {
186			cb(RendererNewFromInternalPtr(RendererVarp), PartVarp, Y1Varp, X11Varp, X21Varp, Y2Varp, X12Varp, X22Varp)
187		})
188	}
189}
190
191// GetDrawTrapezoid gets the "draw_trapezoid" callback function.
192// draws a trapezoidal filled area
193func (x *RendererClass) GetDrawTrapezoid() func(*Renderer, RenderPart, float64, float64, float64, float64, float64, float64) {
194	if x.xDrawTrapezoid == 0 {
195		return nil
196	}
197	var rawCallback func(RendererVarp uintptr, PartVarp RenderPart, Y1Varp float64, X11Varp float64, X21Varp float64, Y2Varp float64, X12Varp float64, X22Varp float64)
198	purego.RegisterFunc(&rawCallback, x.xDrawTrapezoid)
199	return func(RendererVar *Renderer, PartVar RenderPart, Y1Var float64, X11Var float64, X21Var float64, Y2Var float64, X12Var float64, X22Var float64) {
200		rawCallback(RendererVar.GoPointer(), PartVar, Y1Var, X11Var, X21Var, Y2Var, X12Var, X22Var)
201	}
202}
203
204// OverrideDrawGlyph sets the "draw_glyph" callback function.
205// draws a single glyph
206func (x *RendererClass) OverrideDrawGlyph(cb func(*Renderer, *Font, Glyph, float64, float64)) {
207	if cb == nil {
208		x.xDrawGlyph = 0
209	} else {
210		x.xDrawGlyph = purego.NewCallback(func(RendererVarp uintptr, FontVarp uintptr, GlyphVarp Glyph, XVarp float64, YVarp float64) {
211			cb(RendererNewFromInternalPtr(RendererVarp), FontNewFromInternalPtr(FontVarp), GlyphVarp, XVarp, YVarp)
212		})
213	}
214}
215
216// GetDrawGlyph gets the "draw_glyph" callback function.
217// draws a single glyph
218func (x *RendererClass) GetDrawGlyph() func(*Renderer, *Font, Glyph, float64, float64) {
219	if x.xDrawGlyph == 0 {
220		return nil
221	}
222	var rawCallback func(RendererVarp uintptr, FontVarp uintptr, GlyphVarp Glyph, XVarp float64, YVarp float64)
223	purego.RegisterFunc(&rawCallback, x.xDrawGlyph)
224	return func(RendererVar *Renderer, FontVar *Font, GlyphVar Glyph, XVar float64, YVar float64) {
225		rawCallback(RendererVar.GoPointer(), FontVar.GoPointer(), GlyphVar, XVar, YVar)
226	}
227}
228
229// OverridePartChanged sets the "part_changed" callback function.
230// do renderer specific processing when rendering
231//
232//	attributes change
233func (x *RendererClass) OverridePartChanged(cb func(*Renderer, RenderPart)) {
234	if cb == nil {
235		x.xPartChanged = 0
236	} else {
237		x.xPartChanged = purego.NewCallback(func(RendererVarp uintptr, PartVarp RenderPart) {
238			cb(RendererNewFromInternalPtr(RendererVarp), PartVarp)
239		})
240	}
241}
242
243// GetPartChanged gets the "part_changed" callback function.
244// do renderer specific processing when rendering
245//
246//	attributes change
247func (x *RendererClass) GetPartChanged() func(*Renderer, RenderPart) {
248	if x.xPartChanged == 0 {
249		return nil
250	}
251	var rawCallback func(RendererVarp uintptr, PartVarp RenderPart)
252	purego.RegisterFunc(&rawCallback, x.xPartChanged)
253	return func(RendererVar *Renderer, PartVar RenderPart) {
254		rawCallback(RendererVar.GoPointer(), PartVar)
255	}
256}
257
258// OverrideBegin sets the "begin" callback function.
259// Do renderer-specific initialization before drawing
260func (x *RendererClass) OverrideBegin(cb func(*Renderer)) {
261	if cb == nil {
262		x.xBegin = 0
263	} else {
264		x.xBegin = purego.NewCallback(func(RendererVarp uintptr) {
265			cb(RendererNewFromInternalPtr(RendererVarp))
266		})
267	}
268}
269
270// GetBegin gets the "begin" callback function.
271// Do renderer-specific initialization before drawing
272func (x *RendererClass) GetBegin() func(*Renderer) {
273	if x.xBegin == 0 {
274		return nil
275	}
276	var rawCallback func(RendererVarp uintptr)
277	purego.RegisterFunc(&rawCallback, x.xBegin)
278	return func(RendererVar *Renderer) {
279		rawCallback(RendererVar.GoPointer())
280	}
281}
282
283// OverrideEnd sets the "end" callback function.
284// Do renderer-specific cleanup after drawing
285func (x *RendererClass) OverrideEnd(cb func(*Renderer)) {
286	if cb == nil {
287		x.xEnd = 0
288	} else {
289		x.xEnd = purego.NewCallback(func(RendererVarp uintptr) {
290			cb(RendererNewFromInternalPtr(RendererVarp))
291		})
292	}
293}
294
295// GetEnd gets the "end" callback function.
296// Do renderer-specific cleanup after drawing
297func (x *RendererClass) GetEnd() func(*Renderer) {
298	if x.xEnd == 0 {
299		return nil
300	}
301	var rawCallback func(RendererVarp uintptr)
302	purego.RegisterFunc(&rawCallback, x.xEnd)
303	return func(RendererVar *Renderer) {
304		rawCallback(RendererVar.GoPointer())
305	}
306}
307
308// OverridePrepareRun sets the "prepare_run" callback function.
309// updates the renderer for a new run
310func (x *RendererClass) OverridePrepareRun(cb func(*Renderer, *LayoutRun)) {
311	if cb == nil {
312		x.xPrepareRun = 0
313	} else {
314		x.xPrepareRun = purego.NewCallback(func(RendererVarp uintptr, RunVarp *LayoutRun) {
315			cb(RendererNewFromInternalPtr(RendererVarp), RunVarp)
316		})
317	}
318}
319
320// GetPrepareRun gets the "prepare_run" callback function.
321// updates the renderer for a new run
322func (x *RendererClass) GetPrepareRun() func(*Renderer, *LayoutRun) {
323	if x.xPrepareRun == 0 {
324		return nil
325	}
326	var rawCallback func(RendererVarp uintptr, RunVarp *LayoutRun)
327	purego.RegisterFunc(&rawCallback, x.xPrepareRun)
328	return func(RendererVar *Renderer, RunVar *LayoutRun) {
329		rawCallback(RendererVar.GoPointer(), RunVar)
330	}
331}
332
333// OverrideDrawGlyphItem sets the "draw_glyph_item" callback function.
334// draws a `PangoGlyphItem`
335func (x *RendererClass) OverrideDrawGlyphItem(cb func(*Renderer, string, *GlyphItem, int, int)) {
336	if cb == nil {
337		x.xDrawGlyphItem = 0
338	} else {
339		x.xDrawGlyphItem = purego.NewCallback(func(RendererVarp uintptr, TextVarp string, GlyphItemVarp *GlyphItem, XVarp int, YVarp int) {
340			cb(RendererNewFromInternalPtr(RendererVarp), TextVarp, GlyphItemVarp, XVarp, YVarp)
341		})
342	}
343}
344
345// GetDrawGlyphItem gets the "draw_glyph_item" callback function.
346// draws a `PangoGlyphItem`
347func (x *RendererClass) GetDrawGlyphItem() func(*Renderer, string, *GlyphItem, int, int) {
348	if x.xDrawGlyphItem == 0 {
349		return nil
350	}
351	var rawCallback func(RendererVarp uintptr, TextVarp string, GlyphItemVarp *GlyphItem, XVarp int, YVarp int)
352	purego.RegisterFunc(&rawCallback, x.xDrawGlyphItem)
353	return func(RendererVar *Renderer, TextVar string, GlyphItemVar *GlyphItem, XVar int, YVar int) {
354		rawCallback(RendererVar.GoPointer(), TextVar, GlyphItemVar, XVar, YVar)
355	}
356}
357
358// OverridePangoReserved2 sets the "_pango_reserved2" callback function.
359func (x *RendererClass) OverridePangoReserved2(cb func()) {
360	if cb == nil {
361		x.xPangoReserved2 = 0
362	} else {
363		x.xPangoReserved2 = purego.NewCallback(func() {
364			cb()
365		})
366	}
367}
368
369// GetPangoReserved2 gets the "_pango_reserved2" callback function.
370func (x *RendererClass) GetPangoReserved2() func() {
371	if x.xPangoReserved2 == 0 {
372		return nil
373	}
374	var rawCallback func()
375	purego.RegisterFunc(&rawCallback, x.xPangoReserved2)
376	return func() {
377		rawCallback()
378	}
379}
380
381// OverridePangoReserved3 sets the "_pango_reserved3" callback function.
382func (x *RendererClass) OverridePangoReserved3(cb func()) {
383	if cb == nil {
384		x.xPangoReserved3 = 0
385	} else {
386		x.xPangoReserved3 = purego.NewCallback(func() {
387			cb()
388		})
389	}
390}
391
392// GetPangoReserved3 gets the "_pango_reserved3" callback function.
393func (x *RendererClass) GetPangoReserved3() func() {
394	if x.xPangoReserved3 == 0 {
395		return nil
396	}
397	var rawCallback func()
398	purego.RegisterFunc(&rawCallback, x.xPangoReserved3)
399	return func() {
400		rawCallback()
401	}
402}
403
404// OverridePangoReserved4 sets the "_pango_reserved4" callback function.
405func (x *RendererClass) OverridePangoReserved4(cb func()) {
406	if cb == nil {
407		x.xPangoReserved4 = 0
408	} else {
409		x.xPangoReserved4 = purego.NewCallback(func() {
410			cb()
411		})
412	}
413}
414
415// GetPangoReserved4 gets the "_pango_reserved4" callback function.
416func (x *RendererClass) GetPangoReserved4() func() {
417	if x.xPangoReserved4 == 0 {
418		return nil
419	}
420	var rawCallback func()
421	purego.RegisterFunc(&rawCallback, x.xPangoReserved4)
422	return func() {
423		rawCallback()
424	}
425}
426
427type RendererPrivate struct {
428	_ structs.HostLayout
429}
430
431func (x *RendererPrivate) GoPointer() uintptr {
432	return uintptr(unsafe.Pointer(x))
433}
434
435// `PangoRenderPart` defines different items to render for such
436// purposes as setting colors.
437type RenderPart int
438
439var xRenderPartGLibType func() types.GType
440
441func RenderPartGLibType() types.GType {
442	return xRenderPartGLibType()
443}
444
445const (
446
447	// the text itself
448	RenderPartForegroundValue RenderPart = 0
449	// the area behind the text
450	RenderPartBackgroundValue RenderPart = 1
451	// underlines
452	RenderPartUnderlineValue RenderPart = 2
453	// strikethrough lines
454	RenderPartStrikethroughValue RenderPart = 3
455	// overlines
456	RenderPartOverlineValue RenderPart = 4
457)
458
459// `PangoRenderer` is a base class for objects that can render text
460// provided as `PangoGlyphString` or `PangoLayout`.
461//
462// By subclassing `PangoRenderer` and overriding operations such as
463// @draw_glyphs and @draw_rectangle, renderers for particular font
464// backends and destinations can be created.
465type Renderer struct {
466	gobject.Object
467}
468
469var xRendererGLibType func() types.GType
470
471func RendererGLibType() types.GType {
472	return xRendererGLibType()
473}
474
475func RendererNewFromInternalPtr(ptr uintptr) *Renderer {
476	cls := &Renderer{}
477	cls.Ptr = ptr
478	return cls
479}
480
481var xRendererActivate func(uintptr)
482
483// Does initial setup before rendering operations on @renderer.
484//
485// [method@Pango.Renderer.deactivate] should be called when done drawing.
486// Calls such as [method@Pango.Renderer.draw_layout] automatically
487// activate the layout before drawing on it.
488//
489// Calls to [method@Pango.Renderer.activate] and
490// [method@Pango.Renderer.deactivate] can be nested and the
491// renderer will only be initialized and deinitialized once.
492func (x *Renderer) Activate() {
493
494	xRendererActivate(x.GoPointer())
495
496}
497
498var xRendererDeactivate func(uintptr)
499
500// Cleans up after rendering operations on @renderer.
501//
502// See docs for [method@Pango.Renderer.activate].
503func (x *Renderer) Deactivate() {
504
505	xRendererDeactivate(x.GoPointer())
506
507}
508
509var xRendererDrawErrorUnderline func(uintptr, int, int, int, int)
510
511// Draw a squiggly line that approximately covers the given rectangle
512// in the style of an underline used to indicate a spelling error.
513//
514// The width of the underline is rounded to an integer number
515// of up/down segments and the resulting rectangle is centered
516// in the original rectangle.
517//
518// This should be called while @renderer is already active.
519// Use [method@Pango.Renderer.activate] to activate a renderer.
520func (x *Renderer) DrawErrorUnderline(XVar int, YVar int, WidthVar int, HeightVar int) {
521
522	xRendererDrawErrorUnderline(x.GoPointer(), XVar, YVar, WidthVar, HeightVar)
523
524}
525
526var xRendererDrawGlyph func(uintptr, uintptr, Glyph, float64, float64)
527
528// Draws a single glyph with coordinates in device space.
529func (x *Renderer) DrawGlyph(FontVar *Font, GlyphVar Glyph, XVar float64, YVar float64) {
530
531	xRendererDrawGlyph(x.GoPointer(), FontVar.GoPointer(), GlyphVar, XVar, YVar)
532
533}
534
535var xRendererDrawGlyphItem func(uintptr, uintptr, *GlyphItem, int, int)
536
537// Draws the glyphs in @glyph_item with the specified `PangoRenderer`,
538// embedding the text associated with the glyphs in the output if the
539// output format supports it.
540//
541// This is useful for rendering text in PDF.
542//
543// Note that this method does not handle attributes in @glyph_item.
544// If you want colors, shapes and lines handled automatically according
545// to those attributes, you need to use pango_renderer_draw_layout_line()
546// or pango_renderer_draw_layout().
547//
548// Note that @text is the start of the text for layout, which is then
549// indexed by `glyph_item->item->offset`.
550//
551// If @text is %NULL, this simply calls [method@Pango.Renderer.draw_glyphs].
552//
553// The default implementation of this method simply falls back to
554// [method@Pango.Renderer.draw_glyphs].
555func (x *Renderer) DrawGlyphItem(TextVar *string, GlyphItemVar *GlyphItem, XVar int, YVar int) {
556
557	TextVarPtr := core.GStrdupNullable(TextVar)
558	defer core.GFreeNullable(TextVarPtr)
559
560	xRendererDrawGlyphItem(x.GoPointer(), TextVarPtr, GlyphItemVar, XVar, YVar)
561
562}
563
564var xRendererDrawGlyphs func(uintptr, uintptr, *GlyphString, int, int)
565
566// Draws the glyphs in @glyphs with the specified `PangoRenderer`.
567func (x *Renderer) DrawGlyphs(FontVar *Font, GlyphsVar *GlyphString, XVar int, YVar int) {
568
569	xRendererDrawGlyphs(x.GoPointer(), FontVar.GoPointer(), GlyphsVar, XVar, YVar)
570
571}
572
573var xRendererDrawLayout func(uintptr, uintptr, int, int)
574
575// Draws @layout with the specified `PangoRenderer`.
576//
577// This is equivalent to drawing the lines of the layout, at their
578// respective positions relative to @x, @y.
579func (x *Renderer) DrawLayout(LayoutVar *Layout, XVar int, YVar int) {
580
581	xRendererDrawLayout(x.GoPointer(), LayoutVar.GoPointer(), XVar, YVar)
582
583}
584
585var xRendererDrawLayoutLine func(uintptr, *LayoutLine, int, int)
586
587// Draws @line with the specified `PangoRenderer`.
588//
589// This draws the glyph items that make up the line, as well as
590// shapes, backgrounds and lines that are specified by the attributes
591// of those items.
592func (x *Renderer) DrawLayoutLine(LineVar *LayoutLine, XVar int, YVar int) {
593
594	xRendererDrawLayoutLine(x.GoPointer(), LineVar, XVar, YVar)
595
596}
597
598var xRendererDrawRectangle func(uintptr, RenderPart, int, int, int, int)
599
600// Draws an axis-aligned rectangle in user space coordinates with the
601// specified `PangoRenderer`.
602//
603// This should be called while @renderer is already active.
604// Use [method@Pango.Renderer.activate] to activate a renderer.
605func (x *Renderer) DrawRectangle(PartVar RenderPart, XVar int, YVar int, WidthVar int, HeightVar int) {
606
607	xRendererDrawRectangle(x.GoPointer(), PartVar, XVar, YVar, WidthVar, HeightVar)
608
609}
610
611var xRendererDrawTrapezoid func(uintptr, RenderPart, float64, float64, float64, float64, float64, float64)
612
613// Draws a trapezoid with the parallel sides aligned with the X axis
614// using the given `PangoRenderer`; coordinates are in device space.
615func (x *Renderer) DrawTrapezoid(PartVar RenderPart, Y1Var float64, X11Var float64, X21Var float64, Y2Var float64, X12Var float64, X22Var float64) {
616
617	xRendererDrawTrapezoid(x.GoPointer(), PartVar, Y1Var, X11Var, X21Var, Y2Var, X12Var, X22Var)
618
619}
620
621var xRendererGetAlpha func(uintptr, RenderPart) uint16
622
623// Gets the current alpha for the specified part.
624func (x *Renderer) GetAlpha(PartVar RenderPart) uint16 {
625
626	cret := xRendererGetAlpha(x.GoPointer(), PartVar)
627	return cret
628}
629
630var xRendererGetColor func(uintptr, RenderPart) *Color
631
632// Gets the current rendering color for the specified part.
633func (x *Renderer) GetColor(PartVar RenderPart) *Color {
634
635	cret := xRendererGetColor(x.GoPointer(), PartVar)
636	return cret
637}
638
639var xRendererGetLayout func(uintptr) uintptr
640
641// Gets the layout currently being rendered using @renderer.
642//
643// Calling this function only makes sense from inside a subclass's
644// methods, like in its draw_shape vfunc, for example.
645//
646// The returned layout should not be modified while still being
647// rendered.
648func (x *Renderer) GetLayout() *Layout {
649	var cls *Layout
650
651	cret := xRendererGetLayout(x.GoPointer())
652
653	if cret == 0 {
654		return nil
655	}
656	gobject.IncreaseRef(cret)
657	cls = &Layout{}
658	cls.Ptr = cret
659	return cls
660}
661
662var xRendererGetLayoutLine func(uintptr) *LayoutLine
663
664// Gets the layout line currently being rendered using @renderer.
665//
666// Calling this function only makes sense from inside a subclass's
667// methods, like in its draw_shape vfunc, for example.
668//
669// The returned layout line should not be modified while still being
670// rendered.
671func (x *Renderer) GetLayoutLine() *LayoutLine {
672
673	cret := xRendererGetLayoutLine(x.GoPointer())
674	return cret
675}
676
677var xRendererGetMatrix func(uintptr) *Matrix
678
679// Gets the transformation matrix that will be applied when
680// rendering.
681//
682// See [method@Pango.Renderer.set_matrix].
683func (x *Renderer) GetMatrix() *Matrix {
684
685	cret := xRendererGetMatrix(x.GoPointer())
686	return cret
687}
688
689var xRendererPartChanged func(uintptr, RenderPart)
690
691// Informs Pango that the way that the rendering is done
692// for @part has changed.
693//
694// This should be called if the rendering changes in a way that would
695// prevent multiple pieces being joined together into one drawing call.
696// For instance, if a subclass of `PangoRenderer` was to add a stipple
697// option for drawing underlines, it needs to call
698//
699// ```
700// pango_renderer_part_changed (render, PANGO_RENDER_PART_UNDERLINE);
701// ```
702//
703// When the stipple changes or underlines with different stipples
704// might be joined together. Pango automatically calls this for
705// changes to colors. (See [method@Pango.Renderer.set_color])
706func (x *Renderer) PartChanged(PartVar RenderPart) {
707
708	xRendererPartChanged(x.GoPointer(), PartVar)
709
710}
711
712var xRendererSetAlpha func(uintptr, RenderPart, uint16)
713
714// Sets the alpha for part of the rendering.
715//
716// Note that the alpha may only be used if a color is
717// specified for @part as well.
718func (x *Renderer) SetAlpha(PartVar RenderPart, AlphaVar uint16) {
719
720	xRendererSetAlpha(x.GoPointer(), PartVar, AlphaVar)
721
722}
723
724var xRendererSetColor func(uintptr, RenderPart, *Color)
725
726// Sets the color for part of the rendering.
727//
728// Also see [method@Pango.Renderer.set_alpha].
729func (x *Renderer) SetColor(PartVar RenderPart, ColorVar *Color) {
730
731	xRendererSetColor(x.GoPointer(), PartVar, ColorVar)
732
733}
734
735var xRendererSetMatrix func(uintptr, *Matrix)
736
737// Sets the transformation matrix that will be applied when rendering.
738func (x *Renderer) SetMatrix(MatrixVar *Matrix) {
739
740	xRendererSetMatrix(x.GoPointer(), MatrixVar)
741
742}
743
744func (c *Renderer) GoPointer() uintptr {
745	if c == nil {
746		return 0
747	}
748	return c.Ptr
749}
750
751func (c *Renderer) SetGoPointer(ptr uintptr) {
752	c.Ptr = ptr
753}
754
755func init() {
756	core.SetPackageName("PANGO", "pango")
757	core.SetSharedLibraries("PANGO", []string{"libpango-1.0.so.0"})
758	var libs []uintptr
759	for _, libPath := range core.GetPaths("PANGO") {
760		lib, err := purego.Dlopen(libPath, purego.RTLD_NOW|purego.RTLD_GLOBAL)
761		if err != nil {
762			panic(err)
763		}
764		libs = append(libs, lib)
765	}
766
767	core.PuregoSafeRegister(&xRenderPartGLibType, libs, "pango_render_part_get_type")
768
769	core.PuregoSafeRegister(&xRendererGLibType, libs, "pango_renderer_get_type")
770
771	core.PuregoSafeRegister(&xRendererActivate, libs, "pango_renderer_activate")
772	core.PuregoSafeRegister(&xRendererDeactivate, libs, "pango_renderer_deactivate")
773	core.PuregoSafeRegister(&xRendererDrawErrorUnderline, libs, "pango_renderer_draw_error_underline")
774	core.PuregoSafeRegister(&xRendererDrawGlyph, libs, "pango_renderer_draw_glyph")
775	core.PuregoSafeRegister(&xRendererDrawGlyphItem, libs, "pango_renderer_draw_glyph_item")
776	core.PuregoSafeRegister(&xRendererDrawGlyphs, libs, "pango_renderer_draw_glyphs")
777	core.PuregoSafeRegister(&xRendererDrawLayout, libs, "pango_renderer_draw_layout")
778	core.PuregoSafeRegister(&xRendererDrawLayoutLine, libs, "pango_renderer_draw_layout_line")
779	core.PuregoSafeRegister(&xRendererDrawRectangle, libs, "pango_renderer_draw_rectangle")
780	core.PuregoSafeRegister(&xRendererDrawTrapezoid, libs, "pango_renderer_draw_trapezoid")
781	core.PuregoSafeRegister(&xRendererGetAlpha, libs, "pango_renderer_get_alpha")
782	core.PuregoSafeRegister(&xRendererGetColor, libs, "pango_renderer_get_color")
783	core.PuregoSafeRegister(&xRendererGetLayout, libs, "pango_renderer_get_layout")
784	core.PuregoSafeRegister(&xRendererGetLayoutLine, libs, "pango_renderer_get_layout_line")
785	core.PuregoSafeRegister(&xRendererGetMatrix, libs, "pango_renderer_get_matrix")
786	core.PuregoSafeRegister(&xRendererPartChanged, libs, "pango_renderer_part_changed")
787	core.PuregoSafeRegister(&xRendererSetAlpha, libs, "pango_renderer_set_alpha")
788	core.PuregoSafeRegister(&xRendererSetColor, libs, "pango_renderer_set_color")
789	core.PuregoSafeRegister(&xRendererSetMatrix, libs, "pango_renderer_set_matrix")
790
791}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close