static void draw_col(GContext *ctx, unsigned short digit, unsigned short type, unsigned short col, unsigned short max_rows) { for (int row = 0; row < max_rows; row++) { (type == DATE_TYPE) ? draw_date_cell(ctx, get_center_point_from_cell_location(col, row), (digit >> row) & 0x1) : draw_time_cell(ctx, get_center_point_from_cell_location(col, row), (digit >> row) & 0x1); } }
void draw_cell_row_for_digit(GContext* ctx, unsigned short digit, unsigned short max_columns_to_display, unsigned short cell_row) { // Converts the supplied decimal digit into Binary Coded Decimal form and // then draws a row of cells on screen--'1' binary values are filled, '0' binary values are not filled. // `max_columns_to_display` restricts how many binary digits are shown in the row. for (int cell_column_index = 0; cell_column_index < max_columns_to_display; cell_column_index++) { draw_cell(ctx, get_center_point_from_cell_location(cell_column_index, cell_row), (digit >> cell_column_index) & 0x1); } }
/** * Converts decimal into binary decimal form, then draws bits in cells */ static void draw_col(GContext* ctx, unsigned short digit, unsigned short max_rows, unsigned short col) { for(int i = 0; i < max_rows; i++) draw_cell(ctx, get_center_point_from_cell_location(col, i), (digit >> i) & 0x1); }