The utils module exports some drawing-related utility functions.
- frame_rect(surface, color, rect, thick = 1)
- Draws a border with thickness thick just inside the specified rectangle.
- blit_tinted(surface, image, pos, tint, src_rect = None)
- Draws the image onto the surface at position pos with a colour tint
applied. The components of the tint are added to the colour of each
pixel, with the result clamped to 255. If the image has an alpha
channel, it is preserved.
NOTE: This function requires Numeric.
- blit_in_rect(surface, image, frame, align = 'tl', margin = 0)
- Draws the image onto the surface within the rectangle frame, aligned according to align. The alignment string may contain any meaningful combination of the letters 'l', 'r', 't', 'b' and 'c' for left, right, top, bottom and centre. For example, 'bl' aligns the bottom left corners of the image and frame, and 'cr' aligns their centre right points. If a margin is specified, the frame is considered to be reduced in size by that amount on all sides.
- align_rect(rect, frame, align = 'tl', margin = 0)
- Modifies the rectangle rect so that it is aligned with the rectangle frame according to align and margin. See blit_in_rect.
- brighten(rgb, factor)
- Returns a new colour obtained by multiplying each component of the colour rgb by the given factor, which should be a number in the range 0.0 to 1.0.