bracket_image.inc File Reference

Functions

 bracket_image_allocate_default_colors ()
 bracket_image_setup_colors ($node, $img)
 bracket_image_setup_bar_colors ($node, $img)
 bracket_image_setup_fonts ($node)
 bracket_image_setup_font_paths ()
 bracket_image_drawbracketset ($img, $node, $lr, $top, $width, $height, $spacing, $round, $startmatch, $endmatch, $orient='L', $comments=TRUE, $dashed=FALSE)
 bracket_image_drawcell ($img, $lr, $top, $width, $height, $match, $orient='L', $comments=TRUE, $matchid=FALSE, $dashed=FALSE)
 bracket_image_imagetextalign ($img, $fontsize, $x, $y, $w, $text, $color, $align='L')
 bracket_image_imagewordwrapbbox ($text, $width, $fontsize=10, $font= '')
 bracket_image_imagetextwordwrap ($img, $fontsize, $x, $y, $w, $text, $color, $align='L')
 bracket_image_insert_image ($img, $imgpath, $x, $y, $w=0, $center=FALSE)
 bracket_image_imagedashedline ($img, $x1, $y1, $x2, $y2, $color)
 bracket_image_output_png ($img)

Variables

global $bracket_image_fontpath = realpath(drupal_get_path('module', 'bracket') . '/fonts')
global $bracket_image_font_file = 'LiberationSans-Regular.ttf'
global $bracket_image_font_bold_file = 'LiberationSans-Bold.ttf'
global $bracket_image_font_italic_file = 'LiberationSans-Italic.ttf'
global $bracket_image_font_bolditalic_file = 'LiberationSans-BoldItalic.ttf'
global $bracket_image_font
global $bracket_image_font_bold
global $bracket_image_font_italic
global $bracket_image_font_bolditalic
global $bracket_image_font_xlarge = 12
global $bracket_image_font_large = 9
global $bracket_image_font_norm = 7
global $bracket_image_font_small = 6.5
global $bracket_image_font_xsmall = 6
global $bracket_image_bg_color
global $bracket_image_fg_color
global $bracket_image_bar_bg_color
global $bracket_image_bar_fg_color

Detailed Description

This file contains the image helper functions for the bracket module

Author:
Jim Bullington <jimb@jrbcs.com>

Function Documentation

bracket_image_allocate_default_colors (  ) 

Allocate default image colors to globals

bracket_image_drawbracketset ( img,
node,
lr,
top,
width,
height,
spacing,
round,
startmatch,
endmatch,
orient = 'L',
comments = TRUE,
dashed = FALSE 
)

Draw a bracket set on the given image

A bracket set is a vertical set of matches in a round

Parameters:
$img the image handle
$node the bracket node
$lr the left or right edge (x-coord) of the bracket set (depending on orientation)
$top the top edge (y-coord) of the bracket set
$width the width of the bracket set
$height the vertical spacing between bracket lines (competitors)
$spacing the vertical spacing between bracket cells (matches)
$round the bracket round
$startmatch the starting match of this bracket set
$endmatch the ending match of this bracket set
$orient the orientation of the bracket set - 'L'=left or 'R'=right (optional - default is left)
$comments if true, match comments are displayed (optional - default is true)
$dashed if true, dashed bracket lines are produced (optional - default is false)
bracket_image_drawcell ( img,
lr,
top,
width,
height,
match,
orient = 'L',
comments = TRUE,
matchid = FALSE,
dashed = FALSE 
)

Draw a bracket cell on the given image

A bracket cell is a match

Parameters:
$img the img handle
$lr the left or right edge (x-coord) of the bracket cell (depending on orientation)
$top the top edge (y-coord) of the bracket set
$width the width of the bracket set
$height the vertical spacing between bracket lines (competitors)
$match the match of this bracket cell
$orient the orientation of the bracket set - 'L'=left or 'R'=right
$comments if true, match comments are displayed (optional - default is true)
$matchid if true, match ids are displayed (optional - default is false)
$dashed if true, dashed bracket lines are produced (optional - default is false)
bracket_image_imagedashedline ( img,
x1,
y1,
x2,
y2,
color 
)

Draw a dashed line on the image

Parameters:
$img the image handle
$x1 the starting x coordinate of the line
$y1 the starting y coordinate of the line
$x2 the ending x coordinate of the line
$y2 the ending y coordinate of the line
$color the color of the line
bracket_image_imagetextalign ( img,
fontsize,
x,
y,
w,
text,
color,
align = 'L' 
)

Draw text on an image with a given alignment

Parameters:
$img the image handle
$fontsize the font size to draw the text
$x the x-coord of the text
$y the y-coord of the text
$w the width of the text cell
$text the text to draw
$color the color to draw the text
$align the alignment of the text - 'C'=center,'L'=left,'R'=right (optional - default is left)
bracket_image_imagetextwordwrap ( img,
fontsize,
x,
y,
w,
text,
color,
align = 'L' 
)

draw text on the given image restricted to a given with and with a given alignment

Parameters:
$img the image handle
$fontsize the font size to use
$ the maximum width of the text
$fontsize the font size to use
$x the x-coord of the text
$y the y-coord of the text
$w the width of the text
$text the text to draw
$color the color to draw the text
$align the alignment of the text - 'L'=left or 'R'=right (optional - default is left)
bracket_image_imagewordwrapbbox ( text,
width,
fontsize = 10,
font = '' 
)

Word wrap text so it fits into a given width

Parameters:
$text the text to split
$width the maximum width of the text
$fontsize the font size to use
$font the font to use
Returns:
an array containing:
  • the height of each line as it would be rendered
  • an array containt the word wrapped text
  • the height of the text as it would be rendered
bracket_image_insert_image ( img,
imgpath,
x,
y,
w = 0,
center = FALSE 
)

Insert an image into the given image

Parameters:
$img the image handle
$imgpath the path to the image
$x the x coordinate of the image at which to insert the image
$y the y coordinate of the image at which to insert the image
$w scale the image to this width (optional - default is no scaling)
$center center the image over the coordinates (optional - default is FALSE)
bracket_image_output_png ( img  ) 

Draw a dashed line on the image

Parameters:
$img the image handle
Returns:
png image stream
bracket_image_setup_bar_colors ( node,
img 
)

Allocate image colors for bracket bar

Parameters:
$node the bracket node
$img the image handle
bracket_image_setup_colors ( node,
img 
)

Allocate image colors

Parameters:
$node the bracket node
$img the image handle
bracket_image_setup_font_paths (  ) 

Establish font paths

bracket_image_setup_fonts ( node  ) 

Override default font files

Parameters:
$node the bracket node
 All Data Structures Files Functions Variables
Generated on Sat Jul 10 15:07:40 2010 by  doxygen 1.6.3