本文整理汇总了C++中UI_ThemeColor函数的典型用法代码示例。如果您正苦于以下问题:C++ UI_ThemeColor函数的具体用法?C++ UI_ThemeColor怎么用?C++ UI_ThemeColor使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了UI_ThemeColor函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: time_draw_keyframes
/* draw keyframe lines for timeline */
static void time_draw_keyframes(const bContext *C, ARegion *ar)
{
Scene *scene = CTX_data_scene(C);
Object *ob = CTX_data_active_object(C);
View2D *v2d = &ar->v2d;
bool onlysel = ((scene->flag & SCE_KEYS_NO_SELONLY) == 0);
/* set this for all keyframe lines once and for all */
glLineWidth(1.0);
/* draw grease pencil keyframes (if available) */
UI_ThemeColor(TH_TIME_GP_KEYFRAME);
if (scene->gpd) {
time_draw_idblock_keyframes(v2d, (ID *)scene->gpd, onlysel);
}
if (ob && ob->gpd) {
time_draw_idblock_keyframes(v2d, (ID *)ob->gpd, onlysel);
}
/* draw scene keyframes first
* - don't try to do this when only drawing active/selected data keyframes,
* since this can become quite slow
*/
if (onlysel == 0) {
/* set draw color */
UI_ThemeColorShade(TH_TIME_KEYFRAME, -50);
time_draw_idblock_keyframes(v2d, (ID *)scene, onlysel);
}
/* draw keyframes from selected objects
* - only do the active object if in posemode (i.e. showing only keyframes for the bones)
* OR the onlysel flag was set, which means that only active object's keyframes should
* be considered
*/
UI_ThemeColor(TH_TIME_KEYFRAME);
if (ob && ((ob->mode == OB_MODE_POSE) || onlysel)) {
/* draw keyframes for active object only */
time_draw_idblock_keyframes(v2d, (ID *)ob, onlysel);
}
else {
bool active_done = false;
/* draw keyframes from all selected objects */
CTX_DATA_BEGIN (C, Object *, obsel, selected_objects)
{
/* last arg is 0, since onlysel doesn't apply here... */
time_draw_idblock_keyframes(v2d, (ID *)obsel, 0);
/* if this object is the active one, set flag so that we don't draw again */
if (obsel == ob)
active_done = true;
}
CTX_DATA_END;
/* if active object hasn't been done yet, draw it... */
if (ob && (active_done == 0))
time_draw_idblock_keyframes(v2d, (ID *)ob, 0);
}
示例2: format_draw_color
/* Sets the current drawing color based on the format character specified */
static void format_draw_color(char formatchar)
{
switch (formatchar) {
case FMT_TYPE_WHITESPACE:
break;
case FMT_TYPE_SYMBOL:
UI_ThemeColor(TH_SYNTAX_S);
break;
case FMT_TYPE_COMMENT:
UI_ThemeColor(TH_SYNTAX_C);
break;
case FMT_TYPE_NUMERAL:
UI_ThemeColor(TH_SYNTAX_N);
break;
case FMT_TYPE_STRING:
UI_ThemeColor(TH_SYNTAX_L);
break;
case FMT_TYPE_DIRECTIVE:
UI_ThemeColor(TH_SYNTAX_D);
break;
case FMT_TYPE_SPECIAL:
UI_ThemeColor(TH_SYNTAX_V);
break;
case FMT_TYPE_RESERVED:
UI_ThemeColor(TH_SYNTAX_R);
break;
case FMT_TYPE_KEYWORD:
UI_ThemeColor(TH_SYNTAX_B);
break;
case FMT_TYPE_DEFAULT:
default:
UI_ThemeColor(TH_TEXT);
break;
}
}
示例3: draw_render_info
static void draw_render_info(Scene *scene, Image *ima, ARegion *ar)
{
RenderResult *rr;
rcti rect;
float colf[3];
rr= BKE_image_acquire_renderresult(scene, ima);
if(rr && rr->text) {
rect= ar->winrct;
rect.xmin= 0;
rect.ymin= ar->winrct.ymax - ar->winrct.ymin - HEADER_HEIGHT;
rect.xmax= ar->winrct.xmax - ar->winrct.xmin;
rect.ymax= ar->winrct.ymax - ar->winrct.ymin;
/* clear header rect */
UI_GetThemeColor3fv(TH_BACK, colf);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
glColor4f(colf[0]+0.1f, colf[1]+0.1f, colf[2]+0.1f, 0.5f);
glRecti(rect.xmin, rect.ymin, rect.xmax, rect.ymax+1);
glDisable(GL_BLEND);
UI_ThemeColor(TH_TEXT_HI);
UI_DrawString(12, rect.ymin + 5, rr->text);
}
BKE_image_release_renderresult(scene, ima);
}
示例4: ANIM_draw_cfra
/* General call for drawing current frame indicator in animation editor */
void ANIM_draw_cfra(const bContext *C, View2D *v2d, short flag)
{
Scene *scene = CTX_data_scene(C);
float vec[2];
/* Draw a light green line to indicate current frame */
vec[0] = (float)(scene->r.cfra * scene->r.framelen);
UI_ThemeColor(TH_CFRAME);
if (flag & DRAWCFRA_WIDE)
glLineWidth(3.0);
else
glLineWidth(2.0);
glBegin(GL_LINE_STRIP);
vec[1] = v2d->cur.ymin - 500.0f; /* XXX arbitrary... want it go to bottom */
glVertex2fv(vec);
vec[1] = v2d->cur.ymax;
glVertex2fv(vec);
glEnd();
glLineWidth(1.0);
/* Draw current frame number in a little box */
if (flag & DRAWCFRA_SHOW_NUMBOX) {
UI_view2d_view_orthoSpecial(CTX_wm_region(C), v2d, 1);
draw_cfra_number(scene, v2d, vec[0], (flag & DRAWCFRA_UNIT_SECONDS) != 0);
}
}
示例5: clip_draw_cfra
void clip_draw_cfra(SpaceClip *sc, ARegion *ar, Scene *scene)
{
View2D *v2d = &ar->v2d;
float xscale, yscale;
float vec[2];
/* Draw a light green line to indicate current frame */
vec[0] = (float)(sc->user.framenr * scene->r.framelen);
UI_ThemeColor(TH_CFRAME);
glLineWidth(2.0);
glBegin(GL_LINE_STRIP);
vec[1] = v2d->cur.ymin;
glVertex2fv(vec);
vec[1] = v2d->cur.ymax;
glVertex2fv(vec);
glEnd();
glLineWidth(1.0);
UI_view2d_view_orthoSpecial(ar, v2d, 1);
/* because the frame number text is subject to the same scaling as the contents of the view */
UI_view2d_scale_get(v2d, &xscale, &yscale);
glScalef(1.0f / xscale, 1.0f, 1.0f);
ED_region_cache_draw_curfra_label(sc->user.framenr, (float)sc->user.framenr * xscale, 18);
/* restore view transform */
glScalef(xscale, 1.0, 1.0);
}
示例6: draw_image_grid
static void draw_image_grid(ARegion *ar, float zoomx, float zoomy)
{
float gridsize, gridstep= 1.0f/32.0f;
float fac, blendfac;
int x1, y1, x2, y2;
/* the image is located inside (0,0),(1, 1) as set by view2d */
UI_ThemeColorShade(TH_BACK, 20);
UI_view2d_to_region_no_clip(&ar->v2d, 0.0f, 0.0f, &x1, &y1);
UI_view2d_to_region_no_clip(&ar->v2d, 1.0f, 1.0f, &x2, &y2);
glRectf(x1, y1, x2, y2);
/* gridsize adapted to zoom level */
gridsize= 0.5f*(zoomx+zoomy);
if(gridsize<=0.0f) return;
if(gridsize<1.0f) {
while(gridsize<1.0f) {
gridsize*= 4.0f;
gridstep*= 4.0f;
}
}
else {
while(gridsize>=4.0f) {
gridsize/= 4.0f;
gridstep/= 4.0f;
}
}
/* the fine resolution level */
blendfac= 0.25f*gridsize - floorf(0.25f*gridsize);
CLAMP(blendfac, 0.0f, 1.0f);
UI_ThemeColorShade(TH_BACK, (int)(20.0f*(1.0f-blendfac)));
fac= 0.0f;
glBegin(GL_LINES);
while(fac<1.0f) {
glVertex2f(x1, y1*(1.0f-fac) + y2*fac);
glVertex2f(x2, y1*(1.0f-fac) + y2*fac);
glVertex2f(x1*(1.0f-fac) + x2*fac, y1);
glVertex2f(x1*(1.0f-fac) + x2*fac, y2);
fac+= gridstep;
}
/* the large resolution level */
UI_ThemeColor(TH_BACK);
fac= 0.0f;
while(fac<1.0f) {
glVertex2f(x1, y1*(1.0f-fac) + y2*fac);
glVertex2f(x2, y1*(1.0f-fac) + y2*fac);
glVertex2f(x1*(1.0f-fac) + x2*fac, y1);
glVertex2f(x1*(1.0f-fac) + x2*fac, y2);
fac+= 4.0f*gridstep;
}
glEnd();
}
示例7: drawFlyPixel
static void drawFlyPixel(const struct bContext *UNUSED(C), ARegion *UNUSED(ar), void *arg)
{
FlyInfo *fly = arg;
rctf viewborder;
int xoff, yoff;
float x1, x2, y1, y2;
if (fly->scene->camera) {
ED_view3d_calc_camera_border(fly->scene, fly->ar, fly->v3d, fly->rv3d, &viewborder, false);
xoff = viewborder.xmin;
yoff = viewborder.ymin;
}
else {
xoff = 0;
yoff = 0;
}
/* draws 4 edge brackets that frame the safe area where the
* mouse can move during fly mode without spinning the view */
x1 = xoff + 0.45f * fly->width;
y1 = yoff + 0.45f * fly->height;
x2 = xoff + 0.55f * fly->width;
y2 = yoff + 0.55f * fly->height;
UI_ThemeColor(TH_VIEW_OVERLAY);
glBegin(GL_LINES);
/* bottom left */
glVertex2f(x1, y1);
glVertex2f(x1, y1 + 5);
glVertex2f(x1, y1);
glVertex2f(x1 + 5, y1);
/* top right */
glVertex2f(x2, y2);
glVertex2f(x2, y2 - 5);
glVertex2f(x2, y2);
glVertex2f(x2 - 5, y2);
/* top left */
glVertex2f(x1, y2);
glVertex2f(x1, y2 - 5);
glVertex2f(x1, y2);
glVertex2f(x1 + 5, y2);
/* bottom right */
glVertex2f(x2, y1);
glVertex2f(x2, y1 + 5);
glVertex2f(x2, y1);
glVertex2f(x2 - 5, y1);
glEnd();
}
示例8: drawPropCircle
/* called from drawview.c, as an extra per-window draw option */
void drawPropCircle(const struct bContext *C, TransInfo *t)
{
if (t->flag & T_PROP_EDIT) {
RegionView3D *rv3d = CTX_wm_region_view3d(C);
float tmat[4][4], imat[4][4];
float center[3];
int depth_test_enabled;
UI_ThemeColor(TH_GRID);
if (t->spacetype == SPACE_VIEW3D && rv3d != NULL) {
copy_m4_m4(tmat, rv3d->viewmat);
invert_m4_m4(imat, tmat);
}
else {
unit_m4(tmat);
unit_m4(imat);
}
glPushMatrix();
copy_v3_v3(center, t->center);
if ((t->spacetype == SPACE_VIEW3D) && t->obedit) {
mul_m4_v3(t->obedit->obmat, center); /* because t->center is in local space */
}
else if (t->spacetype == SPACE_IMAGE) {
float aspx, aspy;
if (t->options & CTX_MASK) {
/* untested - mask aspect is TODO */
ED_space_image_get_aspect(t->sa->spacedata.first, &aspx, &aspy);
}
else {
ED_space_image_get_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
}
glScalef(1.0f / aspx, 1.0f / aspy, 1.0);
}
depth_test_enabled = glIsEnabled(GL_DEPTH_TEST);
if (depth_test_enabled)
glDisable(GL_DEPTH_TEST);
set_inverted_drawing(1);
drawcircball(GL_LINE_LOOP, center, t->prop_size, imat);
set_inverted_drawing(0);
if (depth_test_enabled)
glEnable(GL_DEPTH_TEST);
glPopMatrix();
}
}
示例9: drawPropCircle
/* called from drawview.c, as an extra per-window draw option */
void drawPropCircle(const struct bContext *C, TransInfo *t)
{
if (t->flag & T_PROP_EDIT) {
RegionView3D *rv3d = CTX_wm_region_view3d(C);
float tmat[4][4], imat[4][4];
int depth_test_enabled;
UI_ThemeColor(TH_GRID);
if (t->spacetype == SPACE_VIEW3D && rv3d != NULL) {
copy_m4_m4(tmat, rv3d->viewmat);
invert_m4_m4(imat, tmat);
}
else {
unit_m4(tmat);
unit_m4(imat);
}
glPushMatrix();
if (t->spacetype == SPACE_VIEW3D) {
/* pass */
}
else if (t->spacetype == SPACE_IMAGE) {
glScalef(1.0f / t->aspect[0], 1.0f / t->aspect[1], 1.0f);
}
else if (ELEM(t->spacetype, SPACE_IPO, SPACE_ACTION)) {
/* only scale y */
rcti *mask = &t->ar->v2d.mask;
rctf *datamask = &t->ar->v2d.cur;
float xsize = BLI_rctf_size_x(datamask);
float ysize = BLI_rctf_size_y(datamask);
float xmask = BLI_rcti_size_x(mask);
float ymask = BLI_rcti_size_y(mask);
glScalef(1.0f, (ysize / xsize) * (xmask / ymask), 1.0f);
}
depth_test_enabled = glIsEnabled(GL_DEPTH_TEST);
if (depth_test_enabled)
glDisable(GL_DEPTH_TEST);
set_inverted_drawing(1);
drawcircball(GL_LINE_LOOP, t->center_global, t->prop_size, imat);
set_inverted_drawing(0);
if (depth_test_enabled)
glEnable(GL_DEPTH_TEST);
glPopMatrix();
}
}
示例10: draw_image_cache
void draw_image_cache(const bContext *C, ARegion *ar)
{
SpaceImage *sima = CTX_wm_space_image(C);
Scene *scene = CTX_data_scene(C);
Image *image = ED_space_image(sima);
float x, cfra = CFRA, sfra = SFRA, efra = EFRA, framelen = ar->winx / (efra - sfra + 1);
Mask *mask = NULL;
if (!ED_space_image_show_cache(sima)) {
return;
}
if (sima->mode == SI_MODE_MASK) {
mask = ED_space_image_get_mask(sima);
}
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
/* Draw cache background. */
ED_region_cache_draw_background(ar);
/* Draw cached segments. */
if (image != NULL && image->cache != NULL && ELEM(image->source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) {
int num_segments = 0;
int *points = NULL;
IMB_moviecache_get_cache_segments(image->cache, IMB_PROXY_NONE, 0, &num_segments, &points);
ED_region_cache_draw_cached_segments(ar, num_segments, points, sfra + sima->iuser.offset, efra + sima->iuser.offset);
}
glDisable(GL_BLEND);
/* Draw current frame. */
x = (cfra - sfra) / (efra - sfra + 1) * ar->winx;
UI_ThemeColor(TH_CFRAME);
glRecti(x, 0, x + ceilf(framelen), 8 * UI_DPI_FAC);
ED_region_cache_draw_curfra_label(cfra, x, 8.0f * UI_DPI_FAC);
if (mask != NULL) {
ED_mask_draw_frames(mask, ar, cfra, sfra, efra);
}
}
示例11: gp_draw_status_text
/* draw a short status message in the top-right corner */
static void gp_draw_status_text(bGPdata *gpd, ARegion *ar)
{
rcti rect;
/* Cannot draw any status text when drawing OpenGL Renders */
if (G.f & G_RENDER_OGL)
return;
/* Get bounds of region - Necessary to avoid problems with region overlap */
ED_region_visible_rect(ar, &rect);
/* for now, this should only be used to indicate when we are in stroke editmode */
if (gpd->flag & GP_DATA_STROKE_EDITMODE) {
const char *printable = IFACE_("GPencil Stroke Editing");
float printable_size[2];
int xco, yco;
BLF_width_and_height_default(printable, BLF_DRAW_STR_DUMMY_MAX, &printable_size[0], &printable_size[1]);
xco = (rect.xmax - U.widget_unit) - (int)printable_size[0];
yco = (rect.ymax - U.widget_unit);
/* text label */
UI_ThemeColor(TH_TEXT_HI);
#ifdef WITH_INTERNATIONAL
BLF_draw_default(xco, yco, 0.0f, printable, BLF_DRAW_STR_DUMMY_MAX);
#else
BLF_draw_default_ascii(xco, yco, 0.0f, printable, BLF_DRAW_STR_DUMMY_MAX);
#endif
/* grease pencil icon... */
// XXX: is this too intrusive?
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
xco -= U.widget_unit;
yco -= (int)printable_size[1] / 2;
UI_icon_draw(xco, yco, ICON_GREASEPENCIL);
glDisable(GL_BLEND);
}
}
示例12: drawPropCircle
/* called from drawview.c, as an extra per-window draw option */
void drawPropCircle(const struct bContext *C, TransInfo *t)
{
if (t->flag & T_PROP_EDIT) {
RegionView3D *rv3d = CTX_wm_region_view3d(C);
float tmat[4][4], imat[4][4];
float center[3];
UI_ThemeColor(TH_GRID);
if(t->spacetype == SPACE_VIEW3D && rv3d != NULL)
{
copy_m4_m4(tmat, rv3d->viewmat);
invert_m4_m4(imat, tmat);
}
else
{
unit_m4(tmat);
unit_m4(imat);
}
glPushMatrix();
VECCOPY(center, t->center);
if((t->spacetype == SPACE_VIEW3D) && t->obedit)
{
mul_m4_v3(t->obedit->obmat, center); /* because t->center is in local space */
}
else if(t->spacetype == SPACE_IMAGE)
{
float aspx, aspy;
ED_space_image_uv_aspect(t->sa->spacedata.first, &aspx, &aspy);
glScalef(1.0f/aspx, 1.0f/aspy, 1.0);
}
set_inverted_drawing(1);
drawcircball(GL_LINE_LOOP, center, t->prop_size, imat);
set_inverted_drawing(0);
glPopMatrix();
}
}
示例13: clip_draw_curfra_label
void clip_draw_curfra_label(SpaceClip *sc, float x, float y)
{
uiStyle *style = UI_GetStyle();
int fontid = style->widget.uifont_id;
char numstr[32];
float font_dims[2] = {0.0f, 0.0f};
/* frame number */
BLF_size(fontid, 11.0f, U.dpi);
BLI_snprintf(numstr, sizeof(numstr), "%d", sc->user.framenr);
BLF_width_and_height(fontid, numstr, &font_dims[0], &font_dims[1]);
glRecti(x, y, x + font_dims[0] + 6.0f, y + font_dims[1] + 4.0f);
UI_ThemeColor(TH_TEXT);
BLF_position(fontid, x + 2.0f, y + 2.0f, 0.0f);
BLF_draw(fontid, numstr, sizeof(numstr));
}
示例14: draw_textscroll
static void draw_textscroll(SpaceText *st, rcti *scroll, rcti *back)
{
bTheme *btheme = UI_GetTheme();
uiWidgetColors wcol = btheme->tui.wcol_scroll;
unsigned char col[4];
float rad;
UI_ThemeColor(TH_BACK);
glRecti(back->xmin, back->ymin, back->xmax, back->ymax);
uiWidgetScrollDraw(&wcol, scroll, &st->txtbar, (st->flags & ST_SCROLL_SELECT) ? UI_SCROLL_PRESSED : 0);
uiSetRoundBox(UI_CNR_ALL);
rad = 0.4f * min_ii(BLI_rcti_size_x(&st->txtscroll), BLI_rcti_size_y(&st->txtscroll));
UI_GetThemeColor3ubv(TH_HILITE, col);
col[3] = 48;
glColor4ubv(col);
glEnable(GL_BLEND);
uiRoundBox(st->txtscroll.xmin + 1, st->txtscroll.ymin, st->txtscroll.xmax - 1, st->txtscroll.ymax, rad);
glDisable(GL_BLEND);
}
示例15: draw_cfra_number
/* Draw current frame number in a little green box beside the current frame indicator */
static void draw_cfra_number(Scene *scene, View2D *v2d, const float cfra, const bool time)
{
const uiFontStyle *fstyle = UI_FSTYLE_WIDGET;
float xscale, yscale, x, y;
char numstr[32] = " t"; /* t is the character to start replacing from */
int slen;
/* because the frame number text is subject to the same scaling as the contents of the view */
UI_view2d_scale_get(v2d, &xscale, &yscale);
glScalef(1.0f / xscale, 1.0f, 1.0f);
/* get timecode string
* - padding on str-buf passed so that it doesn't sit on the frame indicator
* - power = 0, gives 'standard' behavior for time
* but power = 1 is required for frames (to get integer frames)
*/
if (time) {
BLI_timecode_string_from_time(&numstr[4], sizeof(numstr) - 4, 0, FRA2TIME(cfra), FPS, U.timecode_style);
}
else {
BLI_timecode_string_from_time_seconds(&numstr[4], sizeof(numstr) - 4, 1, cfra);
}
slen = UI_fontstyle_string_width(fstyle, numstr) - 1;
/* get starting coordinates for drawing */
x = cfra * xscale;
y = 0.9f * U.widget_unit;
/* draw green box around/behind text */
UI_ThemeColorShade(TH_CFRAME, 0);
glRectf(x, y, x + slen, y + 0.75f * U.widget_unit);
/* draw current frame number - black text */
UI_ThemeColor(TH_TEXT);
UI_fontstyle_draw_simple(fstyle, x - 0.25f * U.widget_unit, y + 0.15f * U.widget_unit, numstr);
/* restore view transform */
glScalef(xscale, 1.0, 1.0);
}