5.7. fonteffects¶
Copyright @ 2013 Mathias Westerdahl
The fonteffects module provides commonly used base functionality for the effects.
- class fonteffects.DistanceField(*k, **kw)[source]¶
Calculates a distance field for each glyph
- factor = 4¶
The number of times the glyph is enlarged before the glyph is rendered.
- size = 16¶
The spread of the “blur” that is applied to the glyphs
- class fonteffects.DropShadow(*k, **kw)[source]¶
Applies a drop shadow to the glyphs
- angle = 120¶
The angle of the shadow (in degrees)
- color = (0, 0, 0)¶
The color of the shadow
- distance = 3¶
The offset of the shadow
- opacity = 100¶
The opacity of the shadow (in percent)
- padding[source]¶
Return the amount of padding needed to fit the effect as a 4 tuple (left, top, right, bottom)
- size = 1¶
The spread of the shadow (in pixels)
- exception fonteffects.FontEffectException[source]¶
An internal exception class used for font creator exceptions
- class fonteffects.GaussianBlur(*k, **kw)[source]¶
Applies a gaussian blur to the glyph
- size = 1¶
The radius (in pixels) of the kernel
- class fonteffects.Gradient(*k, **kw)[source]¶
Creates a gradient between two or more colors.
Parameters: - colors – A list of colors (3 tuples) to interpolate between. [bottom color, ..., top color]
- angle – The angle of rotation (in degrees)
- class fonteffects.Halfsize(*k, **kw)[source]¶
Down scales the glyph by a factor, using bilinear factoring
- class fonteffects.KernelBlur(*k, **kw)[source]¶
Applies a simple box filter where the middle element has value ‘strength’
- size = 1¶
The radius of the kernel (in pixels). The kernel size is radius*2+1
- strength = 1¶
The center value of the kernel
- class fonteffects.Outline(*k, **kw)[source]¶
Creates an outline around the glyph
Parameters: - color – The color of the outline
- opacity – The opacity of the color [0,100]
- width – The width of the outline
- spread – The radius of the blur of the outline
- padding = None¶
Return the amount of padding needed to fit the effect as a 4 tuple (left, top, right, bottom)
- class fonteffects.Solid(*k, **kw)[source]¶
Creates solid fill with a single color
Parameters: color – A color as (r,g,b) [0,255]