Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_image/image_draw.c
| Show First 20 Lines • Show All 143 Lines • ▼ Show 20 Lines | |||||
| /* used by node view too */ | /* used by node view too */ | ||||
| void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_default_view, int channels, int x, int y, | void ED_image_draw_info(Scene *scene, ARegion *ar, bool color_manage, bool use_default_view, int channels, int x, int y, | ||||
| const unsigned char cp[4], const float fp[4], const float linearcol[4], int *zp, float *zpf) | const unsigned char cp[4], const float fp[4], const float linearcol[4], int *zp, float *zpf) | ||||
| { | { | ||||
| rcti color_rect; | rcti color_rect; | ||||
| char str[256]; | char str[256]; | ||||
| int dx = 6; | int dx = 6; | ||||
| const int dy = 0.3f * UI_UNIT_Y; | /* local coordinate visible rect inside region, to accommodate overlapping ui */ | ||||
| rcti rect; | |||||
| ED_region_visible_rect(ar, &rect); | |||||
| const int ymin = rect.ymin; | |||||
| const int dy = ymin + 0.3f * UI_UNIT_Y; | |||||
| /* text colors */ | /* text colors */ | ||||
| /* XXX colored text not allowed in Blender UI */ | /* XXX colored text not allowed in Blender UI */ | ||||
| #if 0 | #if 0 | ||||
| unsigned char red[3] = {255, 50, 50}; | unsigned char red[3] = {255, 50, 50}; | ||||
| unsigned char green[3] = {0, 255, 0}; | unsigned char green[3] = {0, 255, 0}; | ||||
| unsigned char blue[3] = {100, 100, 255}; | unsigned char blue[3] = {100, 100, 255}; | ||||
| #else | #else | ||||
| unsigned char red[3] = {255, 255, 255}; | unsigned char red[3] = {255, 255, 255}; | ||||
| unsigned char green[3] = {255, 255, 255}; | unsigned char green[3] = {255, 255, 255}; | ||||
| unsigned char blue[3] = {255, 255, 255}; | unsigned char blue[3] = {255, 255, 255}; | ||||
| #endif | #endif | ||||
| float hue = 0, sat = 0, val = 0, lum = 0, u = 0, v = 0; | float hue = 0, sat = 0, val = 0, lum = 0, u = 0, v = 0; | ||||
| float col[4], finalcol[4]; | float col[4], finalcol[4]; | ||||
| GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); | GPU_blend_set_func_separate(GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); | ||||
| GPU_blend(true); | GPU_blend(true); | ||||
| uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | ||||
| /* noisy, high contrast make impossible to read if lower alpha is used. */ | /* noisy, high contrast make impossible to read if lower alpha is used. */ | ||||
| immUniformColor4ub(0, 0, 0, 190); | immUniformColor4ub(0, 0, 0, 190); | ||||
| immRecti(pos, 0, 0, BLI_rcti_size_x(&ar->winrct) + 1, UI_UNIT_Y); | immRecti(pos, 0, ymin, BLI_rcti_size_x(&ar->winrct) + 1, ymin + UI_UNIT_Y); | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| GPU_blend(false); | GPU_blend(false); | ||||
| BLF_size(blf_mono_font, 11 * U.pixelsize, U.dpi); | BLF_size(blf_mono_font, 11 * U.pixelsize, U.dpi); | ||||
| BLF_color3ub(blf_mono_font, 255, 255, 255); | BLF_color3ub(blf_mono_font, 255, 255, 255); | ||||
| ▲ Show 20 Lines • Show All 131 Lines • ▼ Show 20 Lines | #endif | ||||
| } | } | ||||
| else { | else { | ||||
| copy_v4_v4(finalcol, col); | copy_v4_v4(finalcol, col); | ||||
| } | } | ||||
| GPU_blend(false); | GPU_blend(false); | ||||
| dx += 0.25f * UI_UNIT_X; | dx += 0.25f * UI_UNIT_X; | ||||
| BLI_rcti_init(&color_rect, dx, dx + (1.5f * UI_UNIT_X), 0.15f * UI_UNIT_Y, 0.85f * UI_UNIT_Y); | BLI_rcti_init(&color_rect, dx, dx + (1.5f * UI_UNIT_X), ymin + 0.15f * UI_UNIT_Y, ymin + 0.85f * UI_UNIT_Y); | ||||
| /* BLF uses immediate mode too, so we must reset our vertex format */ | /* BLF uses immediate mode too, so we must reset our vertex format */ | ||||
| pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | ||||
| if (channels == 4) { | if (channels == 4) { | ||||
| rcti color_rect_half; | rcti color_rect_half; | ||||
| int color_quater_x, color_quater_y; | int color_quater_x, color_quater_y; | ||||
| ▲ Show 20 Lines • Show All 478 Lines • Show Last 20 Lines | |||||