# Module `helpers`

Functions used in blingbling.

blingbling.helpers

## Functions

dbg (vars) | Display values of variables in an awesome popup.
hexadecimal_to_rgba_percent (my_color) | Convert an hexadecimal color to rgba color.
rgb (red, green, blue) | Get red green blue value in parameters and return hexadecimal string
rgba (red, green, blue, alpha) | Get red green blue and alpha value in parameters and return hexadecimal string.
is_transparent (my_color) | Check if an hexadecimal color is fully transparent.
split (str, pat) | Split string in different parts which are returned in a table.
draw_background_tiles (cr, height, v_margin, width, h_margin) | Draw tiles in a cairo context.
draw_text_and_background (cr, text, x, y, text_background_color, text_color, show_text_centered_on_x, show_text_centered_on_y, show_text_on_left_of_x, show_text_on_bottom_of_y) | Draw text on a rectangle which width and height depend on the text width and height.
draw_up_down_arrows (cr, x, y_bottom, y_top, value, background_arrow_color, arrow_color, arrow_line_color, up) | Drawn one foreground arrow with a background arrow that depend on a value.
draw_vertical_bar (cr, h_margin, v_margin, width, height, represent) | Draw a vertical bar with gradient color, so it looks like a cylinder, and it's height depends on a value.
draw_horizontal_bar (cr, h_margin, v_margin, width, height, represent) | Draw an horizontal bar with gradient color, so it looks like a cylinder, and it's height depends on a value.
draw_rounded_corners_rectangle (cr, x, y, width, height, color, rounded_size) | Draw a rectangle width rounded corners.
clip_rounded_corners_rectangle (cr, x, y, width, height, rounded_size) | Set a rectangle width rounded corners that define the area to draw.
draw_rounded_corners_horizontal_graph (cr, x, y, width, height, background_color, graph_color, rounded_size, value_to_represent, graph_line_color) | Draw a foreground rounded corners rectangle which width depends on a value, and a background rounded corners rectangle.
draw_rounded_corners_vertical_graph (cr, x, y, width, height, background_color, graph_color, rounded_size, value_to_represent, graph_line_color) | Draw a foreground rounded corners rectangle which height depends on a value, and a background rounded corners rectangle.
generate_rounded_rectangle_with_text (cr, width, height, text, padding, background_color, text_color, font_size, rounded_size, border) | Generate a text in front of a centered rectangle with rounded corners (or not) in a cairo context.
hash_remove (hash, key) | Remove an element from a table using key.
get_days_in_month (month, year) | Get the number of days in a given month of a year.
get_ISO8601_weeks_number_of_month (month, year) | Find the weeks numbers of a given month.

## Functions

dbg (vars)
  Display values of variables in an awesome popup. Each variables in vars is separated by a "|"

  ### Parameters:

  - vars a table of variable
hexadecimal_to_rgba_percent (my_color)
  Convert an hexadecimal color to rgba color.

  ### Parameters:

  - my_color a string "#rrggbb" or "#rrggbbaa"
rgb (red, green, blue)
  Get red green blue value in parameters and return hexadecimal string

  ### Parameters:

  - red
  - green
  - blue
rgba (red, green, blue, alpha)
  Get red green blue and alpha value in parameters and return hexadecimal string.

  ### Parameters:

  - red
  - green
  - blue
  - alpha
is_transparent (my_color)
  Check if an hexadecimal color is fully transparent. Returns true or false

  ### Parameters:

  - my_color a string "#rrggbb" or "#rrggbbaa"
split (str, pat)
  Split string in different parts which are returned in a table. The delimiter of each part is a pattern given in argument.

  ### Parameters:

  - str the string to split
  - pat the pattern delimiter
draw_background_tiles (cr, height, v_margin, width, h_margin)
  Draw tiles in a cairo context.

  ### Parameters:

  - cr a cairo context.
  - height the height of the surface on which we want tiles
  - v_margin value used to define top margin and/or bottom margin (tiles are not drawn on the margins)
  - width the width of the surface on which we want tiles
  - h_margin value used to define left margin and/or right margin.
draw_text_and_background (cr, text, x, y, text_background_color, text_color, show_text_centered_on_x, show_text_centered_on_y, show_text_on_left_of_x, show_text_on_bottom_of_y)
  Draw text on a rectangle which width and height depend on the text width and height.

  ### Parameters:

  - cr a cairo context already initialised with oocairo.context_create( )
  - text the text to display
  - x the x coordinate of the left of the text
  - y the y coordinate of the bottom of the text
  - text_background_color a string "#rrggbb" or "#rrggbbaa" for the rectangle color
  - text_color a string "#rrggbb" or "#rrggbbaa" for the text color
  - show_text_centered_on_x a boolean value not mandatory (false by default) if true, x parameter is the coordinate of the middle of the text
  - show_text_centered_on_y a boolean value not mandatory (false by default) if true, y parameter is the coordinate of the middle of the text
  - show_text_on_left_of_x a boolean value not mandatory (false by default) if true, x parameter is the right of the text
  - show_text_on_bottom_of_y a boolean value not mandatory (false by default) if true, y parameter is the top of the text
draw_up_down_arrows (cr, x, y_bottom, y_top, value, background_arrow_color, arrow_color, arrow_line_color, up)
  Drawn one foreground arrow with a background arrow that depend on a value. If the value is egal to 0 then the foreground arrow is not drawn.

  ### Parameters:

  - cr a cairo context already initialised with oocairo.context_create( )
  - x the x coordinate in the cairo context where the arrow start
  - y_bottom the bottom corrdinate of the arrows
  - y_top the top coordinate of the arrows
  - value a number
  - background_arrow_color the color of the background arrow, a string "#rrggbb" or "#rrggbbaa"
  - arrow_color the color of the foreground arrow, a string "#rrggbb" or "#rrggbbaa"
  - arrow_line_color the color of the outline of the foreground arrow , a string "#rrggbb" or "#rrggbbaa"
  - up boolean value if false draw a down arrow, if true draw a up arrow
draw_vertical_bar (cr, h_margin, v_margin, width, height, represent)
  Draw a vertical bar with gradient color, so it looks like a cylinder, and it's height depends on a value.

  ### Parameters:

  - cr a cairo context already initialised with oocairo.context_create( )
  - h_margin the left and right margin of the bar in the cr
  - v_margin the top and bottom margin of the bar in the cr
  - width the width used to display the left margin, the bar and the right margin
  - height the height used to display the top margin, the bar and the bottom margin
  - represent a table {background_bar_color = "#rrggbb" or "#rrggbbaa", color = "#rrggbb" or "#rrggbbaa", value =the value used to calculate the height of the bar}
draw_horizontal_bar (cr, h_margin, v_margin, width, height, represent)
  Draw an horizontal bar with gradient color, so it looks like a cylinder, and it's height depends on a value.

  ### Parameters:

  - cr a cairo context already initialised with oocairo.context_create( )
  - h_margin the left and right margin of the bar in the cr
  - v_margin the top and bottom margin of the bar in the cr
  - width the width used to display the left margin, the bar and the right margin
  - height the height used to display the top margin, the bar and the bottom margin
  - represent a table {background_bar_color = "#rrggbb" or "#rrggbbaa", color = "#rrggbb" or "#rrggbbaa", value =the value used to calculate the width of the bar}
draw_rounded_corners_rectangle (cr, x, y, width, height, color, rounded_size)
  Draw a rectangle width rounded corners.

  ### Parameters:

  - cr a cairo context already initialised with oocairo.context_create( )
  - x the x coordinate of the left top corner
  - y the y corrdinate of the left top corner
  - width the width of the rectangle
  - height the height of the rectangle
  - color a string "#rrggbb" or "#rrggbbaa" for the color of the rectangle
  - rounded_size a float value from 0 to 1 (0 is no rounded corner) or a table of float value
clip_rounded_corners_rectangle (cr, x, y, width, height, rounded_size)
  Set a rectangle width rounded corners that define the area to draw.

  ### Parameters:

  - cr a cairo context already initialised with oocairo.context_create( )
  - x the x coordinate of the left top corner
  - y the y corrdinate of the left top corner
  - width the width of the rectangle
  - height the height of the rectangle
  - rounded_size a float value from 0 to 1 (0 is no rounded corner)
draw_rounded_corners_horizontal_graph (cr, x, y, width, height, background_color, graph_color, rounded_size, value_to_represent, graph_line_color)
  Draw a foreground rounded corners rectangle which width depends on a value, and a background rounded corners rectangle.

  ### Parameters:

  - cr a cairo context already initialised with oocairo.context_create( )
  - x the x coordinate of the left top corner
  - y the y corrdinate of the left top corner
  - width the width of the background rectangle and the maximal width of th foreground rectangle
  - height the height of the background and the foreground rectangles
  - background_color a string "#rrggbb" or "#rrggbbaa" for the color of the background rectangle
  - graph_color a string "#rrggbb" or "#rrggbbaa" for the color of the foreground rectangle
  - rounded_size a float value from 0 to 1 (0 is no rounded corner)
  - value_to_represent the percent of the max width used to calculate the width of the foreground rectangle
  - graph_line_color a string "#rrggbb" or "#rrggbbaa" for the outiline color of the background rectangle
draw_rounded_corners_vertical_graph (cr, x, y, width, height, background_color, graph_color, rounded_size, value_to_represent, graph_line_color)
  Draw a foreground rounded corners rectangle which height depends on a value, and a background rounded corners rectangle.

  ### Parameters:

  - cr a cairo context already initialised with oocairo.context_create( )
  - x the x coordinate of the left top corner
  - y the y corrdinate of the left top corner
  - width the width of the background and the foreground rectangles
  - height the height of the background rectangle and the maximal height of the foreground rectangle
  - background_color a string "#rrggbb" or "#rrggbbaa" for the color of the background rectangle
  - graph_color a string "#rrggbb" or "#rrggbbaa" for the color of the foreground rectangle
  - rounded_size a float value from 0 to 1 (0 is no rounded corner)
  - value_to_represent the percent of the max height used to calculate the height of the foreground rectangle
  - graph_line_color a string "#rrggbb" or "#rrggbbaa" for the outiline color of the background rectangle
generate_rounded_rectangle_with_text (cr, width, height, text, padding, background_color, text_color, font_size, rounded_size, border)
  Generate a text in front of a centered rectangle with rounded corners (or not) in a cairo context. It returns a table ={ width = the width of the image, height = the height of the image}

  ### Parameters:

  - cr a cairo context already initialised with oocairo.context_create( )
  - width the width of the widget
  - height the height of the widget
  - text the text to display
  - padding the left/right/top/bottom padding used to center the text in the background rectangle
  - background_color a string "#rrggbb" or "#rrggbbaa" for the color of the background rectangle
  - text_color a string "#rrggbb" or "#rrggbbaa" for the color of the text
  - font_size define the size of the font
  - rounded_size a float value from 0 to 1 (0 is no rounded corner)
  - border a color as a string "#rrggbb" or "#rrggbbaa"
hash_remove (hash, key)
  Remove an element from a table using key.

  ### Parameters:

  - hash the table
  - key the key to remove
get_days_in_month (month, year)
  Get the number of days in a given month of a year. iT returns a number

  ### Parameters:

  - month the month we focus on ( 1 to 12 )
  - year a number YYYY used to check if it's a leap year.
get_ISO8601_weeks_number_of_month (month, year)
  Find the weeks numbers of a given month. Week begin on monday http://fr.wikipedia.org/wiki/ISO_8601 find the week number of a date: 1 find the day number (in the year) of the thursday of the same week of our date 2 find the week day of the 04 january of the year of our date 3 find the number of days between the 04-01 and the first monday before this date 4 find the number of days between the 04-01 and the date we focus on 5 add the two last value, add 3 and divide by 7 First it checks the number of the first week of a month and then it calculate the next six weeks numbers. The value returned is a table of six number.

  ### Parameters:

  - month the month
  - year the year

generated by LDoc 1.3.12