Improved visibility of brush, eraser, and selection tools
This commit is contained in:
parent
15e98c6e1f
commit
10ee12254c
5 changed files with 45 additions and 12 deletions
|
|
@ -522,6 +522,7 @@ SkPaint DrawingProgram::select_tool_line_paint() {
|
|||
selectLinePaint.setStrokeWidth(3);
|
||||
selectLinePaint.setColor4f(world.canvasTheme.get_tool_front_color());
|
||||
selectLinePaint.setPathEffect(lassoLineDashEffect);
|
||||
selectLinePaint.setBlender(CanvasTheme::get_visible_blend_mode());
|
||||
|
||||
return selectLinePaint;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -187,17 +187,21 @@ void BrushTool::draw(SkCanvas* canvas, const DrawData& drawData) {
|
|||
if(!drawP.world.main.input.isTouchDevice && drawData.main->world->drawProg.controls.cursorHoveringOverCanvas) {
|
||||
auto relativeWidthResult = drawP.world.main.toolConfig.get_relative_width_stroke_size(drawP, drawP.world.drawData.cam.c.inverseScale);
|
||||
if(relativeWidthResult.first.has_value()) {
|
||||
SkPaint linePaint;
|
||||
linePaint.setColor4f(drawP.world.canvasTheme.get_tool_front_color());
|
||||
linePaint.setStroke(true);
|
||||
linePaint.setStrokeWidth(0.0f);
|
||||
float width = relativeWidthResult.first.value();
|
||||
if(objInfoBeingEdited)
|
||||
width *= penWidth * 0.5f;
|
||||
else
|
||||
width *= 0.5f;
|
||||
width += 1.0f;
|
||||
Vector2f pos = drawData.main->input.mouse.pos;
|
||||
canvas->drawCircle(pos.x(), pos.y(), width, linePaint);
|
||||
SkPaint linePaint;
|
||||
linePaint.setColor4f({1.0f, 1.0f, 1.0f, 1.0f});
|
||||
linePaint.setStyle(SkPaint::kStroke_Style);
|
||||
linePaint.setStrokeCap(SkPaint::kRound_Cap);
|
||||
linePaint.setStrokeWidth(0.0f);
|
||||
linePaint.setBlender(CanvasTheme::get_visible_blend_mode());
|
||||
SkPath circ = SkPath::Circle(pos.x(), pos.y(), width);
|
||||
canvas->drawPath(circ, linePaint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include "../DrawingProgram.hpp"
|
||||
#include "../../MainProgram.hpp"
|
||||
#include "../../DrawData.hpp"
|
||||
#include <include/core/SkBlendMode.h>
|
||||
#include <include/core/SkPathBuilder.h>
|
||||
|
||||
EraserTool::EraserTool(DrawingProgram& initDrawP):
|
||||
|
|
@ -118,14 +119,12 @@ void EraserTool::draw(SkCanvas* canvas, const DrawData& drawData) {
|
|||
auto relativeWidthResult = drawP.world.main.toolConfig.get_relative_width_stroke_size(drawP, drawP.world.drawData.cam.c.inverseScale);
|
||||
if(relativeWidthResult.first.has_value()) {
|
||||
float width = relativeWidthResult.first.value() * 0.5f;
|
||||
SkColor4f c = drawP.world.canvasTheme.get_tool_front_color();
|
||||
c.fA = 0.5f;
|
||||
|
||||
SkPaint linePaint;
|
||||
linePaint.setColor4f(c);
|
||||
linePaint.setColor4f({1.0f, 1.0f, 1.0f, 0.5f});
|
||||
linePaint.setStyle(SkPaint::kStroke_Style);
|
||||
linePaint.setStrokeCap(SkPaint::kRound_Cap);
|
||||
linePaint.setStrokeWidth(width * 2.0f);
|
||||
linePaint.setBlender(CanvasTheme::get_visible_blend_mode());
|
||||
SkPathBuilder erasePath;
|
||||
erasePath.moveTo(convert_vec2<SkPoint>(lastPos));
|
||||
erasePath.lineTo(convert_vec2<SkPoint>(drawData.main->input.mouse.pos));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue