/* Paint ------------------------------------- */ void draw_background(t_hoa_gain *x, t_object *view, t_rect *rect, char isHoriz) { t_jgraphics *g = jbox_start_layer((t_object *)x, view, hoa_sym_background_layer, rect->width, rect->height); if (g) { long zerodBpos = (long)hoa_gain_dBvaltopos(x, 0, rect, isHoriz); // Background jgraphics_rectangle(g, 0, 0, rect->width, rect->height); jgraphics_set_source_jrgba(g, &x->j_brgba); jgraphics_fill(g); // Border : jgraphics_rectangle(g, 0., 0., rect->width, rect->height); jgraphics_set_source_jrgba(g, &x->j_knobcolor); jgraphics_set_line_width(g, 1.); jgraphics_stroke(g); jgraphics_set_source_jrgba(g, &x->j_knobcolor); if (isHoriz) { jgraphics_line_draw_fast(g, zerodBpos - hoa_gain_DISPLAYINSET*0.5-knobMargin, knobMargin*0.5, zerodBpos + hoa_gain_DISPLAYINSET, knobMargin*0.5, 1); jgraphics_line_draw_fast(g, zerodBpos - hoa_gain_DISPLAYINSET*0.5-knobMargin, rect->height - knobMargin*0.5, zerodBpos + hoa_gain_DISPLAYINSET, rect->height - knobMargin*0.5, 1); } else { jgraphics_line_draw_fast(g, knobMargin*0.5, zerodBpos - hoa_gain_DISPLAYINSET*0.5-knobMargin, knobMargin*0.5, zerodBpos + hoa_gain_DISPLAYINSET, 1); jgraphics_line_draw_fast(g, rect->width - knobMargin*0.5, zerodBpos - hoa_gain_DISPLAYINSET*0.5-knobMargin, rect->width - knobMargin*0.5, zerodBpos + hoa_gain_DISPLAYINSET, 1); } jbox_end_layer((t_object*)x, view, hoa_sym_background_layer); } jbox_paint_layer((t_object *)x, view, hoa_sym_background_layer, 0, 0); }
void draw_rotation(t_space *x, t_object *view, t_rect *rect) { t_jgraphics *g = jbox_start_layer((t_object *)x, view, gensym("rotation_layer"), rect->width, rect->height); if (g) { for(int i = 0; i < 24; i++) { double angle = x->f_rotation * -1 - CICM_PI2 + CICM_2PI * (double)i / 24.; jgraphics_set_source_jrgba(g, &x->f_color_circle); jgraphics_line_draw_fast(g, Tools::abscisse((double)5.5 * x->f_rayonCircle, angle) + rect->width * 0.5, Tools::ordinate((double)5.5 * x->f_rayonCircle,angle) + rect->width * 0.5,Tools::abscisse((double)5.8 * x->f_rayonCircle, angle) + rect->width * 0.5, Tools::ordinate((double)5.8 * x->f_rayonCircle, angle) + rect->width * 0.5, 5.); } jbox_end_layer((t_object*)x, view, gensym("rotation_layer")); } jbox_paint_layer((t_object *)x, view, gensym("rotation_layer"), 0., 0.); }