libkate: Tracker

# Tracker

## Functions
int | kate_tracker_init (kate_tracker *kin, const kate_info *ki, kate_const kate_event *ev)
int | kate_tracker_clear (kate_tracker *kin)
int | kate_tracker_morph_styles (kate_style *style, kate_float t, const kate_style *from, const kate_style *to)
int | kate_tracker_remap (const kate_tracker *kin, kate_motion_mapping x_mapping, kate_motion_mapping y_mapping, kate_float *x, kate_float *y)
int | kate_tracker_update_property_at_duration (const kate_tracker *kin, kate_float duration, kate_float t, kate_motion_semantics semantics, kate_float *x, kate_float *y)
int | kate_tracker_update (kate_tracker *kin, kate_float t, int window_w, int window_h, int frame_x, int frame_y, int frame_w, int frame_h)
int | kate_tracker_get_text_path_position (kate_tracker *kin, size_t glyph, int *x, int *y)

## Detailed Description

## Function Documentation

int kate_tracker_clear | ( | kate_tracker * | kin | ) |

Clears a tracker.

Parameters:

  | kin | the tracker to clear, must have been initialized with kate_tracker_init

Returns:
  0 success
  KATE_E_* error

References kate_tracker::event, KATE_E_INIT, and KATE_E_INVALID_PARAMETER.

int kate_tracker_get_text_path_position | ( | kate_tracker * | kin,
|  | size_t | glyph,
|  | int * | x,
|  | int * | y |
| ) |  |  |

Finds the position of a particular glyph along a path.

Parameters:

  | kin | the tracker to use
  | glyph | the index of the glyph to get the position of
  | x | will return the first coordinate of the position
  | y | will return the second coordinate of the position

References kate_tracker::has, KATE_E_INVALID_PARAMETER, kate_motion_semantics_text_path, kate_tracker_update_property_at_duration(), kate_tracker::path, kate_tracker::path_end, and kate_tracker::path_start.

int kate_tracker_init | ( | kate_tracker * | kin,
|  | const kate_info * | ki,
|  | kate_const kate_event * | ev |
| ) |  |  |

Initializes a tracker with the given event. When done, it should be cleared using kate_tracker_clear.

Parameters:

  | kin | the tracker to initialize
  | ki | the kate_info structure for the stream
  | ev | the event to track

References kate_tracker::event, KATE_E_INVALID_PARAMETER, KATE_E_OUT_OF_MEMORY, kate_text_get_character(), kate_tracker::ki, kate_event::len0, kate_event::text, and kate_event::text_encoding.

int kate_tracker_morph_styles | ( | kate_style * | style,
|  | kate_float | t,
|  | const kate_style * | from,
|  | const kate_style * | to |
| ) |  |  |

Morphs between two styles. t should be between 0 and 1

Parameters:

  | style | the style that will hold the morphed style
  | t | the amount of morping from the from style (eg, 0 yields from, 1 yields to)
  | from | the style to morph from
  | to | the style to morph to

Returns:
  0 success
  KATE_E_* error

References kate_style::font, and KATE_E_INVALID_PARAMETER.

Referenced by kate_tracker_update().

int kate_tracker_remap | ( | const kate_tracker * | kin,
|  | kate_motion_mapping | x_mapping,
|  | kate_motion_mapping | y_mapping,
|  | kate_float * | x,
|  | kate_float * | y |
| ) |  |  |

Remaps a point according to the given mappings

Parameters:

  | kin | the tracker to use for the remapping
  | x_mapping | the mapping for use for the x coordinate
  | y_mapping | the mapping for use for the y coordinate
  | x | a pointer to the x coordinate
  | y | a pointer to the y coordinate

Returns:
  0 success
  KATE_E_* error

References kate_event::bitmap, kate_event::end_time, kate_tracker::event, kate_tracker::frame_h, kate_tracker::frame_w, kate_tracker::frame_x, kate_tracker::frame_y, kate_bitmap::height, KATE_E_INVALID_PARAMETER, kate_motion_mapping_bitmap_size, kate_motion_mapping_event_duration, kate_motion_mapping_frame, kate_motion_mapping_none, kate_motion_mapping_region, kate_motion_mapping_window, kate_tracker::region_h, kate_tracker::region_w, kate_tracker::region_x, kate_tracker::region_y, kate_event::start_time, kate_bitmap::width, kate_tracker::window_h, and kate_tracker::window_w.

Referenced by kate_tracker_update_property_at_duration().

int kate_tracker_update | ( | kate_tracker * | kin,
|  | kate_float | t,
|  | int | window_w,
|  | int | window_h,
|  | int | frame_x,
|  | int | frame_y,
|  | int | frame_w,
|  | int | frame_h |
| ) |  |  |

Tracks changes in an event at the given time.

Parameters:

  | kin | the tracker to update
  | t | the time (between 0 and the duration of the motion) to update to
  | window_w | the width of the window
  | window_h | the height of the window
  | frame_x | the horizontal offset of the video frame within the window
  | frame_y | the vertical offset of the video frame within the window
  | frame_w | the width of the video frame
  | frame_h | the height of the video frame

Returns:
  0 success
  KATE_E_* error

References kate_style::background_color, kate_tracker::background_color, kate_tracker::bitmap_pos, kate_tracker::bitmap_size, kate_tracker::bitmap_size_x, kate_tracker::bitmap_size_y, kate_tracker::bitmap_x, kate_tracker::bitmap_y, kate_style::bottom_margin, kate_tracker::bottom_margin, kate_tracker::draw, kate_style::draw_color, kate_tracker::draw_color, kate_tracker::draw_width, kate_tracker::draw_x, kate_tracker::draw_y, kate_event::end_time, kate_tracker::event, kate_tracker::frame_h, kate_tracker::frame_w, kate_tracker::frame_x, kate_tracker::frame_y, kate_tracker::glyph_height, kate_tracker::glyph_pointer, kate_tracker::glyph_pointer_bitmap, kate_region::h, kate_style::halign, kate_tracker::has, kate_tracker::hmargins, KATE_E_INIT, KATE_E_INVALID_PARAMETER, kate_millionths, kate_motion_get_point(), kate_motion_semantics_background_color_ba, kate_motion_semantics_background_color_rg, kate_motion_semantics_bitmap_position, kate_motion_semantics_bitmap_size, kate_motion_semantics_draw, kate_motion_semantics_draw_color_ba, kate_motion_semantics_draw_color_rg, kate_motion_semantics_draw_width, kate_motion_semantics_glyph_pointer_1, kate_motion_semantics_glyph_pointer_1_bitmap, kate_motion_semantics_horizontal_margins, kate_motion_semantics_marker1_bitmap, kate_motion_semantics_marker1_position, kate_motion_semantics_region_position, kate_motion_semantics_region_size, kate_motion_semantics_style_morph, kate_motion_semantics_text_alignment_ext, kate_motion_semantics_text_alignment_int, kate_motion_semantics_text_color_ba, kate_motion_semantics_text_color_rg, kate_motion_semantics_text_path, kate_motion_semantics_text_path_section, kate_motion_semantics_text_position, kate_motion_semantics_text_size, kate_motion_semantics_text_visible_section, kate_motion_semantics_time, kate_motion_semantics_vertical_margins, kate_motion_semantics_z, kate_percentage, kate_pixel, kate_tracker_morph_styles(), kate_tracker::ki, kate_style::left_margin, kate_tracker::left_margin, kate_tracker::marker_bitmap, kate_tracker::marker_pos, kate_tracker::marker_x, kate_tracker::marker_y, kate_region::metric, kate_event::nmotions, kate_tracker::path, kate_tracker::path_end, kate_tracker::path_start, kate_tracker::region, kate_event::region, kate_tracker::region_h, kate_tracker::region_w, kate_tracker::region_x, kate_tracker::region_y, kate_style::right_margin, kate_tracker::right_margin, kate_event::secondary_style, kate_event::start_time, kate_region::style, kate_event::style, kate_info::styles, kate_tracker::t, kate_tracker::text_alignment_ext, kate_tracker::text_alignment_int, kate_style::text_color, kate_tracker::text_color, kate_tracker::text_halign, kate_tracker::text_pos, kate_tracker::text_size, kate_tracker::text_size_x, kate_tracker::text_size_y, kate_tracker::text_valign, kate_tracker::text_x, kate_tracker::text_y, kate_style::top_margin, kate_tracker::top_margin, kate_style::valign, kate_tracker::visible_section, kate_tracker::visible_x, kate_tracker::visible_y, kate_tracker::vmargins, kate_region::w, kate_tracker::window_h, kate_tracker::window_w, kate_region::x, kate_region::y, and kate_tracker::z.

int kate_tracker_update_property_at_duration | ( | const kate_tracker * | kin,
|  | kate_float | duration,
|  | kate_float | t,
|  | kate_motion_semantics | semantics,
|  | kate_float * | x,
|  | kate_float * | y |
| ) |  |  |

Returns the value of a particular property at the given time

Parameters:

  | kin | the tracker to update the property for
  | duration | the duration of the event the motion belongs to
  | t | the time, between 0 and duration, at which to compute the point
  | semantics | the semantics of the motion to use
  | x | a pointer to the x coordinate
  | y | a pointer to the y coordinate

Returns:
  0 success
  1 success, and there is no such motion at this time
  KATE_E_* error

References KATE_E_INVALID_PARAMETER, kate_motion_get_point(), kate_tracker_remap(), kate_motion::x_mapping, and kate_motion::y_mapping.

Referenced by kate_tracker_get_text_path_position().