Blender V4.3
interface_draw.cc File Reference
#include <cmath>
#include <cstring>
#include "DNA_color_types.h"
#include "DNA_curve_types.h"
#include "DNA_curveprofile_types.h"
#include "DNA_movieclip_types.h"
#include "DNA_screen_types.h"
#include "BLI_math_rotation.h"
#include "BLI_polyfill_2d.h"
#include "BLI_rect.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "MEM_guardedalloc.h"
#include "BKE_colorband.hh"
#include "BKE_colortools.hh"
#include "BKE_curveprofile.h"
#include "BKE_tracking.h"
#include "IMB_colormanagement.hh"
#include "IMB_imbuf.hh"
#include "IMB_imbuf_types.hh"
#include "BIF_glutil.hh"
#include "BLF_api.hh"
#include "GPU_batch.hh"
#include "GPU_batch_presets.hh"
#include "GPU_immediate.hh"
#include "GPU_immediate_util.hh"
#include "GPU_matrix.hh"
#include "GPU_shader_shared.hh"
#include "GPU_state.hh"
#include "UI_interface.hh"
#include "interface_intern.hh"

Go to the source code of this file.

Classes

struct  WaveformColorVertex
 

Macros

#define HISTOGRAM_TOT_GRID_LINES   4
 

Functions

void UI_draw_roundbox_corner_set (int type)
 
void UI_draw_roundbox_4fv_ex (const rctf *rect, const float inner1[4], const float inner2[4], float shade_dir, const float outline[4], float outline_width, float rad)
 
void UI_draw_roundbox_3ub_alpha (const rctf *rect, bool filled, float rad, const uchar col[3], uchar alpha)
 
void UI_draw_roundbox_3fv_alpha (const rctf *rect, bool filled, float rad, const float col[3], float alpha)
 
void UI_draw_roundbox_aa (const rctf *rect, bool filled, float rad, const float color[4])
 
void UI_draw_roundbox_4fv (const rctf *rect, bool filled, float rad, const float col[4])
 
void ui_draw_rounded_corners_inverted (const rcti &rect, const float rad, const blender::float4 color)
 
void UI_draw_text_underline (int pos_x, int pos_y, int len, int height, const float color[4])
 
void ui_draw_but_TAB_outline (const rcti *rect, float rad, uchar highlight[3], uchar highlight_fade[3])
 
void ui_draw_but_IMAGE (ARegion *, uiBut *but, const uiWidgetColors *, const rcti *rect)
 
void UI_draw_safe_areas (uint pos, const rctf *rect, const float title_aspect[2], const float action_aspect[2])
 
static void draw_scope_end (const rctf *rect)
 
static void histogram_draw_one (float r, float g, float b, float alpha, float x, float y, float w, float h, const float *data, int res, const bool is_line, uint pos_attr)
 
void ui_draw_but_HISTOGRAM (ARegion *, uiBut *but, const uiWidgetColors *, const rcti *recti)
 
static void waveform_draw_one (const float *waveform, int waveform_num, const float col[3])
 
static void waveform_draw_rgb (const float *waveform, int waveform_num, const float *col, float alpha)
 
static void circle_draw_rgb (float *points, int tot_points, const float *col, GPUPrimType prim)
 
void ui_draw_but_WAVEFORM (ARegion *, uiBut *but, const uiWidgetColors *, const rcti *recti)
 
static float polar_to_x (float center, float diam, float ampli, float angle)
 
static float polar_to_y (float center, float diam, float ampli, float angle)
 
static void vectorscope_draw_target (uint pos, float centerx, float centery, float diam, const float colf[3], char label)
 
void ui_draw_but_VECTORSCOPE (ARegion *, uiBut *but, const uiWidgetColors *, const rcti *recti)
 
static void ui_draw_colorband_handle_tri (uint pos, float x1, float y1, float halfwidth)
 
static void ui_draw_colorband_handle_box (uint pos, float x1, float y1, float x2, float y2)
 
static void ui_draw_colorband_handle (uint shdr_pos, const rcti *rect, float x, const float rgb[3], ColorManagedDisplay *display, bool active)
 
void ui_draw_but_COLORBAND (uiBut *but, const uiWidgetColors *wcol, const rcti *rect)
 
void ui_draw_but_UNITVEC (uiBut *but, const uiWidgetColors *wcol, const rcti *rect, const float radius)
 
static void ui_draw_but_curve_grid (const uint pos, const rcti *rect, const float zoom_x, const float zoom_y, const float offset_x, const float offset_y, const float step)
 
static void gl_shaded_color_get (const uchar color[3], int shade, uchar r_color[3])
 
static void gl_shaded_color_get_fl (const uchar *color, int shade, float r_color[3])
 
static void gl_shaded_color (const uchar *color, int shade)
 
void ui_draw_but_CURVE (ARegion *region, uiBut *but, const uiWidgetColors *wcol, const rcti *rect)
 
static bool point_draw_handles (CurveProfilePoint *point)
 
void ui_draw_but_CURVEPROFILE (ARegion *region, uiBut *but, const uiWidgetColors *wcol, const rcti *rect)
 
void ui_draw_but_TRACKPREVIEW (ARegion *, uiBut *but, const uiWidgetColors *, const rcti *recti)
 
void ui_draw_dropshadow (const rctf *rct, const float radius, const float width, const float aspect, const float alpha)
 

Variables

static int roundboxtype = UI_CNR_ALL
 

Macro Definition Documentation

◆ HISTOGRAM_TOT_GRID_LINES

#define HISTOGRAM_TOT_GRID_LINES   4

Definition at line 491 of file interface_draw.cc.

Referenced by ui_draw_but_HISTOGRAM().

Function Documentation

◆ circle_draw_rgb()

◆ draw_scope_end()

◆ gl_shaded_color()

static void gl_shaded_color ( const uchar * color,
int shade )
static

Definition at line 1566 of file interface_draw.cc.

References gl_shaded_color_get(), and immUniformColor3ubv().

Referenced by ui_draw_but_CURVE(), and ui_draw_but_CURVEPROFILE().

◆ gl_shaded_color_get()

static void gl_shaded_color_get ( const uchar color[3],
int shade,
uchar r_color[3] )
static

Definition at line 1552 of file interface_draw.cc.

Referenced by gl_shaded_color(), and gl_shaded_color_get_fl().

◆ gl_shaded_color_get_fl()

static void gl_shaded_color_get_fl ( const uchar * color,
int shade,
float r_color[3] )
static

Definition at line 1559 of file interface_draw.cc.

References gl_shaded_color_get(), and rgb_uchar_to_float().

Referenced by ui_draw_but_CURVE(), and ui_draw_but_CURVEPROFILE().

◆ histogram_draw_one()

static void histogram_draw_one ( float r,
float g,
float b,
float alpha,
float x,
float y,
float w,
float h,
const float * data,
int res,
const bool is_line,
uint pos_attr )
static

◆ point_draw_handles()

static bool point_draw_handles ( CurveProfilePoint * point)
static

Helper for ui_draw_but_CURVEPROFILE. Used to tell whether to draw a control point's handles.

Definition at line 1844 of file interface_draw.cc.

References ELEM, HD_ALIGN, HD_FREE, PROF_H1_SELECT, PROF_H2_SELECT, and PROF_SELECT.

Referenced by ui_draw_but_CURVEPROFILE().

◆ polar_to_x()

static float polar_to_x ( float center,
float diam,
float ampli,
float angle )
static

Definition at line 909 of file interface_draw.cc.

References cosf.

Referenced by ui_draw_but_VECTORSCOPE(), and vectorscope_draw_target().

◆ polar_to_y()

static float polar_to_y ( float center,
float diam,
float ampli,
float angle )
static

Definition at line 914 of file interface_draw.cc.

References sinf.

Referenced by ui_draw_but_VECTORSCOPE(), and vectorscope_draw_target().

◆ ui_draw_but_COLORBAND()

◆ ui_draw_but_CURVE()

void ui_draw_but_CURVE ( ARegion * region,
uiBut * but,
const uiWidgetColors * wcol,
const rcti * rect )

Definition at line 1573 of file interface_draw.cc.

References ARRAY_SET_ITEMS, uiBlock::aspect, BKE_curvemapping_changed(), BLI_rctf_size_x(), BLI_rctf_size_y(), BLI_rcti_isect(), BLI_rcti_size_x(), BLI_rcti_size_y(), uiBut::block, CurveMapping::clipr, CurveMapping::cm, CM_TABLE, col, CUMA_DO_CLIP, CUMA_DRAW_CFRA, CUMA_DRAW_SAMPLE, CUMA_EXTEND_EXTRAPOLATE, CUMA_SELECT, CurveMapping::cur, CurveMapping::curr, CurveMap::curve, uiButCurveMapping::edit_cumap, CurveMap::ext_in, CurveMap::ext_out, CurveMapping::flag, flag, gl_shaded_color(), gl_shaded_color_get_fl(), GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_line_smooth(), GPU_line_width(), GPU_PRIM_LINE_STRIP, GPU_PRIM_LINES, GPU_PRIM_POINTS, GPU_PRIM_TRI_STRIP, GPU_program_point_size(), GPU_scissor(), GPU_scissor_get(), GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR, GPU_SHADER_3D_UNIFORM_COLOR, GPU_vertformat_attr_add(), uiButCurveMapping::gradient_type, IMB_colormanagement_get_luminance(), imm_draw_box_wire_2d(), immAttr1f(), immAttr4fv(), immBegin(), immBindBuiltinProgram(), immEnd(), immRectf(), immUnbindProgram(), immUniformColor3fv(), immUniformColor3ub(), immUniformColor3ubv(), immUniformColor3ubvAlpha(), immUniformColor4fv(), immVertex2f(), immVertexFormat(), uiWidgetColors::inner, interp_v3_v3v3(), uiWidgetColors::item, len_squared_v3(), len_squared_v3v3(), linearrgb_to_srgb_v3_v3(), max_ff(), min_ff(), uiWidgetColors::outline, uiBut::poin, pos, rgb_to_hsv_v(), rgb_uchar_to_float(), CurveMapping::sample, swap_v3_v3(), CurveMap::table, TH_TEXT, TH_TEXT_HI, CurveMap::totpoint, ui_draw_but_curve_grid(), ui_draw_gradient(), UI_GetThemeColor4fv(), UI_GRAD_H, UI_SCALE_FAC, CurveMapPoint::x, rctf::xmax, rcti::xmax, rctf::xmin, rcti::xmin, CurveMapPoint::y, rctf::ymax, rcti::ymax, rctf::ymin, and rcti::ymin.

Referenced by ui_draw_but().

◆ ui_draw_but_curve_grid()

static void ui_draw_but_curve_grid ( const uint pos,
const rcti * rect,
const float zoom_x,
const float zoom_y,
const float offset_x,
const float offset_y,
const float step )
static

◆ ui_draw_but_CURVEPROFILE()

void ui_draw_but_CURVEPROFILE ( ARegion * region,
uiBut * but,
const uiWidgetColors * wcol,
const rcti * rect )

Draws the curve profile widget. Somewhat similar to ui_draw_but_CURVE.

Definition at line 1851 of file interface_draw.cc.

References uiBlock::aspect, BKE_curveprofile_table_size(), BKE_curveprofile_update(), BLI_polyfill_calc(), BLI_rctf_size_x(), BLI_rctf_size_y(), BLI_rcti_isect(), BLI_rcti_size_x(), BLI_rcti_size_y(), uiBut::block, col, uiButCurveProfile::edit_profile, flag, float, gl_shaded_color(), gl_shaded_color_get_fl(), GPU_blend(), GPU_BLEND_ALPHA, GPU_BLEND_NONE, GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_line_smooth(), GPU_line_width(), GPU_point_size(), GPU_polygon_smooth(), GPU_PRIM_LINE_STRIP, GPU_PRIM_LINES, GPU_PRIM_POINTS, GPU_PRIM_TRIS, GPU_scissor(), GPU_scissor_get(), GPU_SHADER_3D_FLAT_COLOR, GPU_SHADER_3D_UNIFORM_COLOR, GPU_vertformat_attr_add(), CurveProfilePoint::h1_loc, CurveProfilePoint::h2_loc, imm_draw_box_wire_2d(), immAttr4fv(), immBegin(), immBindBuiltinProgram(), immEnd(), immRectf(), immUnbindProgram(), immUniformColor3fv(), immUniformColor3ubv(), immUniformColor3ubvAlpha(), immVertex2f(), immVertexFormat(), uiWidgetColors::inner, interp_v3_v3v3(), uiWidgetColors::item, len_squared_v3(), len_squared_v3v3(), max_ff(), MEM_freeN(), MEM_mallocN, MEM_SAFE_FREE, min_ff(), uiWidgetColors::outline, uiBut::poin, point_draw_handles(), pos, PROF_H1_SELECT, PROF_H2_SELECT, PROF_SELECT, PROF_UPDATE_NONE, PROF_USE_CLIP, rgb_uchar_to_float(), swap_v3_v3(), TH_TEXT, TH_TEXT_HI, ui_draw_but_curve_grid(), UI_GetThemeColor4fv(), UI_SCALE_FAC, CurveProfile::view_rect, CurveProfilePoint::x, rcti::xmax, rctf::xmin, rcti::xmin, CurveProfilePoint::y, rcti::ymax, and rcti::ymin.

Referenced by ui_draw_but().

◆ ui_draw_but_HISTOGRAM()

◆ ui_draw_but_IMAGE()

◆ ui_draw_but_TAB_outline()

◆ ui_draw_but_TRACKPREVIEW()

◆ ui_draw_but_UNITVEC()

◆ ui_draw_but_VECTORSCOPE()

◆ ui_draw_but_WAVEFORM()

◆ ui_draw_colorband_handle()

◆ ui_draw_colorband_handle_box()

static void ui_draw_colorband_handle_box ( uint pos,
float x1,
float y1,
float x2,
float y2 )
static

Definition at line 1212 of file interface_draw.cc.

References GPU_PRIM_TRI_STRIP, immBegin(), immEnd(), immVertex2f(), and pos.

Referenced by ui_draw_colorband_handle().

◆ ui_draw_colorband_handle_tri()

static void ui_draw_colorband_handle_tri ( uint pos,
float x1,
float y1,
float halfwidth )
static

Definition at line 1202 of file interface_draw.cc.

References GPU_PRIM_TRIS, immBegin(), immEnd(), immVertex2f(), and pos.

Referenced by ui_draw_colorband_handle().

◆ ui_draw_dropshadow()

◆ UI_draw_roundbox_3fv_alpha()

void UI_draw_roundbox_3fv_alpha ( const rctf * rect,
bool filled,
float rad,
const float col[3],
float alpha )

◆ UI_draw_roundbox_3ub_alpha()

void UI_draw_roundbox_3ub_alpha ( const rctf * rect,
bool filled,
float rad,
const uchar col[3],
uchar alpha )

◆ UI_draw_roundbox_4fv()

◆ UI_draw_roundbox_4fv_ex()

◆ UI_draw_roundbox_aa()

void UI_draw_roundbox_aa ( const rctf * rect,
bool filled,
float rad,
const float color[4] )

◆ UI_draw_roundbox_corner_set()

void UI_draw_roundbox_corner_set ( int type)

Definition at line 54 of file interface_draw.cc.

References roundboxtype.

Referenced by acf_generic_root_backdrop(), acf_group_backdrop(), acf_nla_controls_backdrop(), acf_nlaaction_backdrop(), acf_summary_backdrop(), draw_current_frame(), draw_keylist_block(), draw_keylist_block_gpencil(), draw_scope_end(), draw_tile_background(), ED_screen_draw_edges(), file_draw_list(), blender::ed::space_node::frame_node_draw_background(), gizmo_axis_draw(), nla_draw_strip(), blender::ed::space_node::node_draw_basis(), blender::ed::space_node::node_draw_extra_info_panel_back(), blender::ed::space_node::node_draw_hidden(), blender::ed::space_node::node_draw_link_end_marker(), blender::ed::space_node::node_draw_panels_background(), blender::ed::space_node::node_draw_preview(), blender::ed::space_node::node_draw_shadow(), blender::ed::space_node::node_socket_draw_multi_input(), blender::ed::outliner::outliner_draw_active_indicator(), panel_draw_aligned_backdrop(), panel_draw_highlight_border(), region_draw_azone_tab_arrow(), region_draw_status_text(), screen_draw_area_closed(), screen_draw_area_drag_tip(), screen_draw_dock_preview(), screen_draw_join_highlight(), screen_draw_move_highlight(), screen_draw_split_preview(), textview_draw_string(), ui_draw_but_HISTOGRAM(), ui_draw_but_TRACKPREVIEW(), ui_draw_but_UNITVEC(), ui_draw_but_VECTORSCOPE(), ui_draw_but_WAVEFORM(), ui_draw_button_sections_alignment_separator(), ui_draw_button_sections_background(), ui_draw_layout_panels_backdrop(), UI_fontstyle_draw_simple_backdrop(), UI_panel_category_draw_all(), and widget_softshadow().

◆ ui_draw_rounded_corners_inverted()

void ui_draw_rounded_corners_inverted ( const rcti & rect,
const float rad,
const blender::float4 color )

Draws rounded corner segments but inverted. Imagine each corner like a filled right triangle, just that the hypotenuse is nicely curved inwards (towards the right angle of the triangle).

Useful for connecting orthogonal shapes with a rounded corner, which can look quite nice.

Definition at line 150 of file interface_draw.cc.

References GPU_COMP_F32, GPU_FETCH_FLOAT, GPU_PRIM_TRI_FAN, GPU_SHADER_3D_UNIFORM_COLOR, GPU_vertformat_attr_add(), immBegin(), immBindBuiltinProgram(), immEnd(), immUnbindProgram(), immUniformColor4fv(), immVertex2f(), immVertexFormat(), mul_v2_fl(), pos, roundboxtype, UI_CNR_BOTTOM_LEFT, UI_CNR_BOTTOM_RIGHT, UI_CNR_TOP_LEFT, UI_CNR_TOP_RIGHT, rcti::xmax, rcti::xmin, rcti::ymax, and rcti::ymin.

Referenced by ui_draw_button_sections_alignment_separator().

◆ UI_draw_safe_areas()

void UI_draw_safe_areas ( uint pos,
const rctf * rect,
const float title_aspect[2],
const float action_aspect[2] )

Draw title and text safe areas.

Note
This function is to be used with the 2D dashed shader enabled.
Parameters
posis a #PRIM_FLOAT, 2, GPU_FETCH_FLOAT vertex attribute.
rectThe offsets for the view, not the zones.

Definition at line 385 of file interface_draw.cc.

References ARRAY_SIZE, imm_draw_box_wire_2d(), pos, rctf::xmax, rctf::xmin, rctf::ymax, and rctf::ymin.

Referenced by drawviewborder(), and sequencer_draw_borders_overlay().

◆ UI_draw_text_underline()

void UI_draw_text_underline ( int pos_x,
int pos_y,
int len,
int height,
const float color[4] )

◆ vectorscope_draw_target()

static void vectorscope_draw_target ( uint pos,
float centerx,
float centery,
float diam,
const float colf[3],
char label )
static

◆ waveform_draw_one()

◆ waveform_draw_rgb()

Variable Documentation

◆ roundboxtype