static TempBuf * gimp_brush_generated_scale_mask (GimpBrush *gbrush, gdouble scale) { GimpBrushGenerated *brush = GIMP_BRUSH_GENERATED (gbrush); return gimp_brush_generated_calc (brush, brush->shape, brush->radius * scale, brush->spikes, brush->hardness, brush->aspect_ratio, brush->angle, NULL, NULL); }
static void gimp_brush_generated_dirty (GimpData *data) { GimpBrushGenerated *brush = GIMP_BRUSH_GENERATED (data); GimpBrush *gbrush = GIMP_BRUSH (brush); if (gbrush->mask) temp_buf_free (gbrush->mask); gbrush->mask = gimp_brush_generated_calc (brush, brush->shape, brush->radius, brush->spikes, brush->hardness, brush->aspect_ratio, brush->angle, &gbrush->x_axis, &gbrush->y_axis); GIMP_DATA_CLASS (parent_class)->dirty (data); }
static TempBuf * gimp_brush_generated_transform_mask (GimpBrush *gbrush, gdouble scale, gdouble aspect_ratio, gdouble angle, gdouble hardness) { GimpBrushGenerated *brush = GIMP_BRUSH_GENERATED (gbrush); gdouble ratio; if (aspect_ratio == 0.0) { ratio = brush->aspect_ratio; } else { ratio = MIN (fabs (aspect_ratio) + 1, 20); /* Since generated brushes are symmetric the dont have input * for aspect ratios < 1.0. its same as rotate by 90 degrees and * 1 / ratio. So we fix the input up for this case. */ if (aspect_ratio < 0.0) { angle = angle + 0.25; } } return gimp_brush_generated_calc (brush, brush->shape, brush->radius * scale, brush->spikes, brush->hardness * hardness, ratio, (brush->angle + 360 * angle), NULL, NULL); }
static GimpTempBuf * gimp_brush_generated_transform_mask (GimpBrush *gbrush, gdouble scale, gdouble aspect_ratio, gdouble angle, gdouble hardness) { GimpBrushGenerated *brush = GIMP_BRUSH_GENERATED (gbrush); gdouble ratio; ratio = fabs (aspect_ratio) * 19.0 / 20.0 + 1.0; ratio = MIN (ratio, 20); /* Since generated brushes are symmetric they don't have aspect * ratios < 1.0. it's the same as rotating by 90 degrees and 1 / * ratio, so we fix the input for this case. */ if (aspect_ratio < 0.0) angle = angle + 0.25; angle *= 360; if (angle < 0.0) angle = -1.0 * fmod (angle, 180.0); else if (angle > 180.0) angle = fmod (angle, 180.0); return gimp_brush_generated_calc (brush, brush->shape, brush->radius * scale, brush->spikes, hardness, ratio, angle, NULL, NULL); }