Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/util/ed_draw.c
| Show First 20 Lines • Show All 217 Lines • ▼ Show 20 Lines | static void draw_main_line(const rctf *main_line_rect, | ||||
| } | } | ||||
| else { | else { | ||||
| UI_draw_roundbox_3ub_alpha(main_line_rect, true, 0, color_line, 255); | UI_draw_roundbox_3ub_alpha(main_line_rect, true, 0, color_line, 255); | ||||
| } | } | ||||
| } | } | ||||
| static void draw_backdrop(const int fontid, | static void draw_backdrop(const int fontid, | ||||
| const rctf *main_line_rect, | const rctf *main_line_rect, | ||||
| const float color_bg[4], | const uint8_t color_bg[4], | ||||
| const short region_y_size, | const short region_y_size, | ||||
| const float base_tick_height) | const float base_tick_height) | ||||
| { | { | ||||
| float string_pixel_size[2]; | float string_pixel_size[2]; | ||||
| const char *percentage_string_placeholder = "000%%"; | const char *percentage_string_placeholder = "000%%"; | ||||
| BLF_width_and_height(fontid, | BLF_width_and_height(fontid, | ||||
| percentage_string_placeholder, | percentage_string_placeholder, | ||||
| sizeof(percentage_string_placeholder), | sizeof(percentage_string_placeholder), | ||||
| &string_pixel_size[0], | &string_pixel_size[0], | ||||
| &string_pixel_size[1]); | &string_pixel_size[1]); | ||||
| const float pad[2] = {(region_y_size - base_tick_height) / 2, 2.0f * U.pixelsize}; | const float pad[2] = {(region_y_size - base_tick_height) / 2, 2.0f * U.pixelsize}; | ||||
| const rctf backdrop_rect = { | const rctf backdrop_rect = { | ||||
| .xmin = main_line_rect->xmin - string_pixel_size[0] - pad[0], | .xmin = main_line_rect->xmin - string_pixel_size[0] - pad[0], | ||||
| .xmax = main_line_rect->xmax + pad[0], | .xmax = main_line_rect->xmax + pad[0], | ||||
| .ymin = pad[1], | .ymin = pad[1], | ||||
| .ymax = region_y_size - pad[1], | .ymax = region_y_size - pad[1], | ||||
| }; | }; | ||||
| UI_draw_roundbox_aa(&backdrop_rect, true, 4.0f, color_bg); | UI_draw_roundbox_3ub_alpha(&backdrop_rect, true, 4.0f, color_bg, color_bg[3]); | ||||
| } | } | ||||
| /** | /** | ||||
| * Draw an on screen Slider for a Pose Slide Operator. | * Draw an on screen Slider for a Pose Slide Operator. | ||||
| */ | */ | ||||
| static void slider_draw(const struct bContext *UNUSED(C), ARegion *region, void *arg) | static void slider_draw(const struct bContext *UNUSED(C), ARegion *region, void *arg) | ||||
| { | { | ||||
| tSlider *slider = arg; | tSlider *slider = arg; | ||||
| /* Only draw in region from which the Operator was started. */ | /* Only draw in region from which the Operator was started. */ | ||||
| if (region != slider->region_header) { | if (region != slider->region_header) { | ||||
| return; | return; | ||||
| } | } | ||||
| uint8_t color_text[4]; | uint8_t color_text[4]; | ||||
| uint8_t color_line[4]; | uint8_t color_line[4]; | ||||
| uint8_t color_handle[4]; | uint8_t color_handle[4]; | ||||
| uint8_t color_overshoot[4]; | uint8_t color_overshoot[4]; | ||||
| float color_bg[4]; | uint8_t color_bg[4]; | ||||
| /* Get theme colors. */ | /* Get theme colors. */ | ||||
| UI_GetThemeColor4ubv(TH_TEXT, color_text); | UI_GetThemeColor4ubv(TH_HEADER_TEXT_HI, color_handle); | ||||
| UI_GetThemeColor4ubv(TH_TEXT, color_line); | UI_GetThemeColor4ubv(TH_HEADER_TEXT, color_text); | ||||
| UI_GetThemeColor4ubv(TH_TEXT, color_overshoot); | UI_GetThemeColor4ubv(TH_HEADER_TEXT, color_line); | ||||
| UI_GetThemeColor4ubv(TH_ACTIVE, color_handle); | UI_GetThemeColor4ubv(TH_HEADER_TEXT, color_overshoot); | ||||
| UI_GetThemeColor3fv(TH_BACK, color_bg); | UI_GetThemeColor4ubv(TH_HEADER, color_bg); | ||||
| color_bg[3] = 0.5f; | color_overshoot[0] = color_overshoot[0] * 0.8; | ||||
| color_overshoot[0] = color_overshoot[0] * 0.7; | color_overshoot[1] = color_overshoot[1] * 0.8; | ||||
| color_overshoot[1] = color_overshoot[1] * 0.7; | color_overshoot[2] = color_overshoot[2] * 0.8; | ||||
| color_overshoot[2] = color_overshoot[2] * 0.7; | color_bg[3] = 160; | ||||
| /* Get the default font. */ | /* Get the default font. */ | ||||
| const uiStyle *style = UI_style_get(); | const uiStyle *style = UI_style_get(); | ||||
| const uiFontStyle *fstyle = &style->widget; | const uiFontStyle *fstyle = &style->widget; | ||||
| const int fontid = fstyle->uifont_id; | const int fontid = fstyle->uifont_id; | ||||
| BLF_color3ubv(fontid, color_text); | BLF_color3ubv(fontid, color_text); | ||||
| BLF_rotation(fontid, 0.0f); | BLF_rotation(fontid, 0.0f); | ||||
| ▲ Show 20 Lines • Show All 571 Lines • Show Last 20 Lines | |||||