# this file saves brushorder
# the first one (upper left) will be selected at startup
+s001
subtle_pencil
ink
aspec_fun_5
// aspect ratio (needs to be caluclated here because it can affect the dab spacing)
- float aspect_ratio = settings_value[BRUSH_ASPECT_RATIO];
+ float ratio = settings_value[BRUSH_ELLIPTICAL_DAB_RATIO];
//float angle = atan2(states[STATE_NORM_DY_SLOW], -states[STATE_NORM_DX_SLOW]) / M_PI * 180;
- float angle = settings_value[BRUSH_ASPECT_RATIO_ANGLE];
- states[STATE_ACTUAL_ASPECT_RATIO] = aspect_ratio;
- states[STATE_ACTUAL_ANGLE] = angle;
+ float angle = settings_value[BRUSH_ELLIPTICAL_DAB_ANGLE];
+ states[STATE_ACTUAL_ELLIPTICAL_DAB_RATIO] = ratio;
+ states[STATE_ACTUAL_ELLIPTICAL_DAB_ANGLE] = angle;
}
// Called only from stroke_to(). Calculate everything needed to
// the functions below will CLAMP most inputs
hsv_to_rgb_float (&color_h, &color_s, &color_v);
return surface->draw_dab (x, y, radius, color_h, color_s, color_v, opaque, hardness, eraser_target_alpha,
- states[STATE_ACTUAL_ASPECT_RATIO], states[STATE_ACTUAL_ANGLE]);
+ states[STATE_ACTUAL_ELLIPTICAL_DAB_RATIO], states[STATE_ACTUAL_ELLIPTICAL_DAB_ANGLE]);
}
// How many dabs will be drawn between the current and the next (x, y, pressure, +dt) position?
//dp = pressure - pressure; // Not useful?
// TODO: control rate with pressure (dabs per pressure) (dpressure is useless)
- if (states[STATE_ACTUAL_ASPECT_RATIO] > 1.0) {
- float angle_rad=states[STATE_ACTUAL_ANGLE]*M_PI/180.0;
+ if (states[STATE_ACTUAL_ELLIPTICAL_DAB_RATIO] > 1.0) {
+ // code duplication, see tiledsurface::draw_dab()
+ float angle_rad=states[STATE_ACTUAL_ELLIPTICAL_DAB_ANGLE]*2*M_PI;
float cs=cos(angle_rad);
float sn=sin(angle_rad);
- float yyr=(yy*cs+xx*sn)*states[STATE_ACTUAL_ASPECT_RATIO];
- float xxr=-yy*sn+xx*cs;
+ float yyr=(yy*cs-xx*sn)*states[STATE_ACTUAL_ELLIPTICAL_DAB_RATIO];
+ float xxr=yy*sn+xx*cs;
dist = sqrt(yyr*yyr + xxr*xxr);
} else {
dist = hypotf(xx, yy);
#['dab2_opacity_fac', 'second dab opaque', False, 0.0, 0.0, 2.0, "0.0 disable the second dab\n1.0 as opaque as the first dab\n2.0 twice as opaque as the first dab"],
#['dab2_position_noise', 'second position noise',
- ['aspect_ratio', 'aspect ratio', False, 1.0, 1.0, 10.0, "[EXPERIMENTAL] aspect ratio, must be >= 1.0"],
- ['aspect_ratio_angle', 'aspect ratio angle', False, 0.0, 45.0, 360.0, "[EXPERIMENTAL] dab angle in degrees"],
+ ['elliptical_dab_ratio', 'elliptical dab: ratio', False, 1.0, 1.0, 10.0, "aspect ratio of the dabs; must be >= 1.0, where 1.0 means a perfectly round dab. TODO: linearize? start at 0.0 maybe, or log?"],
+ ['elliptical_dab_angle', 'elliptical dab: angle', False, 0.0, 0.0, 0.5, "this defines the angle by which eliptical dabs are tilted\n 0.0 horizontal dabs\n 0.25 vertical dabs\n 0.5 horizontal again"],
]
settings_hidden = 'color_h color_s color_v'.split()
custom_input
rng_seed
-actual_aspect_ratio, actual_angle # used by count_dabs_to
+actual_elliptical_dab_ratio, actual_elliptical_dab_angle # used by count_dabs_to
'''
class BrushInput:
if (x1 > TILE_SIZE-1) x1 = TILE_SIZE-1;
if (y1 > TILE_SIZE-1) y1 = TILE_SIZE-1;
- float angle_rad=angle*M_PI/180.0;
+ float angle_rad=angle*2*M_PI;
float cs=cos(angle_rad);
float sn=sin(angle_rad);
yy = (yp + 0.5 - yc);
for (xp = x0; xp <= x1; xp++) {
xx = (xp + 0.5 - xc);
- float yyr=(yy*cs+xx*sn)*aspect_ratio;
- float xxr=-yy*sn+xx*cs;
+ // code duplication, see brush::count_dabs_to()
+ float yyr=(yy*cs-xx*sn)*aspect_ratio;
+ float xxr=yy*sn+xx*cs;
rr = (yyr*yyr + xxr*xxr) * one_over_radius2;
// rr is in range 0.0..1.0*sqrt(2)