class Freetype::Stroker

Overview

FT_Stroker wrapper

This component generates stroked outlines of a given vectorial glyph. It also allows you to retrieve the 'outside' and/or the 'inside' borders of the stroke.

This can be useful to generate 'bordered' glyph, i.e., glyphs displayed with a coloured (and anti-aliased) border around their shape.

Defined in:

freetype/stroker.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new #

[View source]

Instance Method Detail

def begin_subpath(to, open) #

Start a new sub-path in the stroker.

Note:

This function is useful when you need to stroke a path that is not stored as an 'Outline' object.


[View source]
def border_counts(border) #

Call this function once you have finished parsing your paths with the stroker. It returns the number of points and contours necessary to export one of the 'border' or 'stroke' outlines generated by the stroker.


[View source]
def conic_to(control, to) #

'Draw' a single quadratic Bezier in the stroker's current sub-path, from the last position.

Note:

You should call this function between 'begin_subpath' and 'end_subpath'.


[View source]
def counts #

Call this function once you have finished parsing your paths with the stroker. It returns the number of points and contours necessary to export all points/borders from the stroked outline/path.


[View source]
def cubic_to(control1, control2, to) #

'Draw' a single quadratic Bezier in the stroker's current sub-path, from the last position.

Note:

You should call this function between 'begin_subpath' and 'end_subpath'.


[View source]
def end_subpath #

Close the current sub-path in the stroker.

Note:

You should call this function after 'begin_subpath'. If the subpath was not 'opened', this function 'draws' a single line segment to the start position when needed.


[View source]
def export(outline) #

Call this function after get_border_counts to export all borders to your own 'Outline' structure.

Note that this function appends the border points and contours to your outline, but does not try to resize its arrays.


[View source]
def export_border(border, outline) #

Call this function after 'get_border_counts' to export the corresponding border to your own 'Outline' structure.

Note that this function appends the border points and contours to your outline, but does not try to resize its arrays.

Note:

Always call this function after get_border_counts to get sure that there is enough room in your 'Outline' object to receive all new data.

When an outline, or a sub-path, is 'closed', the stroker generates two independent 'border' outlines, named 'left' and 'right'.

When the outline, or a sub-path, is 'opened', the stroker merges the 'border' outlines with caps. The 'left' border receives all points, while the 'right' border becomes empty.

Use the function export instead if you want to retrieve all borders at once.


[View source]
def finalize #

[View source]
def line_to(to) #

'Draw' a single line segment in the stroker's current sub-path, from the last position.

Note:

You should call this function between 'begin_subpath' and 'end_subpath'.


[View source]
def parse_outline(outline, opened = false) #

A convenience function used to parse a whole outline with the stroker. The resulting outline(s) can be retrieved later by functions like FT_Stroker_GetCounts and FT_Stroker_Export.

Note:

If 'opened' is 0 (the default), the outline is treated as a closed path, and the stroker generates two distinct 'border' outlines.

If 'opened' is 1, the outline is processed as an open path, and the stroker generates a single 'stroke' outline. This function calls 'rewind' automatically.


[View source]
def rewind #

Reset a stroker object without changing its attributes. You should call this function before beginning a new series of calls to FT_Stroker_BeginSubPath or FT_Stroker_EndSubPath.


[View source]
def set(radius, line_cap, line_join, miter_limit) #

Reset a stroker object's attributes.


[View source]
def stroker : LibFreetype::FT_Stroker #

[View source]