Make cursors and select tools visible without special blend modes
This commit is contained in:
parent
bd4d662dd9
commit
c85fb11636
8 changed files with 39 additions and 48 deletions
|
|
@ -208,9 +208,11 @@ void BrushTool::draw(SkCanvas* canvas, const DrawData& drawData) {
|
|||
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);
|
||||
linePaint.setColor4f({0.0f, 0.0f, 0.0f, 1.0f});
|
||||
circ = SkPath::Circle(pos.x(), pos.y(), width - 1.0f);
|
||||
canvas->drawPath(circ, linePaint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,15 +125,20 @@ void EraserTool::draw(SkCanvas* canvas, const DrawData& drawData) {
|
|||
float width = relativeWidthResult.first.value() * 0.5f;
|
||||
SkPaint linePaint;
|
||||
linePaint.setAntiAlias(drawData.skiaAA);
|
||||
linePaint.setColor4f({1.0f, 1.0f, 1.0f, 0.5f});
|
||||
linePaint.setColor4f({0.0f, 0.0f, 0.0f, 0.4f});
|
||||
linePaint.setStyle(SkPaint::kStroke_Style);
|
||||
linePaint.setStrokeCap(SkPaint::kRound_Cap);
|
||||
linePaint.setStrokeWidth(width * 2.0f);
|
||||
linePaint.setBlender(CanvasTheme::get_visible_blend_mode());
|
||||
linePaint.setStrokeWidth(width * 2.0f + 1.0f);
|
||||
SkPathBuilder erasePath;
|
||||
erasePath.moveTo(convert_vec2<SkPoint>(lastPos));
|
||||
erasePath.lineTo(convert_vec2<SkPoint>(drawData.main->input.mouse.pos));
|
||||
canvas->drawPath(erasePath.detach(), linePaint);
|
||||
|
||||
SkPath erasePathDetach = erasePath.detach();
|
||||
canvas->drawPath(erasePathDetach, linePaint);
|
||||
|
||||
linePaint.setStrokeWidth(width * 2.0f);
|
||||
linePaint.setColor4f({1.0f, 1.0f, 1.0f, 0.4f});
|
||||
canvas->drawPath(erasePathDetach, linePaint);
|
||||
}
|
||||
|
||||
lastPos = drawData.main->input.mouse.pos;
|
||||
|
|
|
|||
|
|
@ -138,7 +138,10 @@ void LassoSelectTool::draw(SkCanvas* canvas, const DrawData& drawData) {
|
|||
for(Vector2f& p : controls.lassoPoints | std::views::drop(1))
|
||||
lassoPath.lineTo(convert_vec2<SkPoint>(p));
|
||||
|
||||
canvas->drawPath(lassoPath.detach(), drawP.select_tool_line_paint(drawData));
|
||||
auto paintPair = drawP.select_tool_line_paint(drawData);
|
||||
SkPath lassoPathDetach = lassoPath.detach();
|
||||
canvas->drawPath(lassoPathDetach, paintPair.first);
|
||||
canvas->drawPath(lassoPathDetach, paintPair.second);
|
||||
|
||||
canvas->restore();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,7 +100,10 @@ void RectSelectTool::draw(SkCanvas* canvas, const DrawData& drawData) {
|
|||
controls.coords.transform_sk_canvas(canvas, drawData);
|
||||
|
||||
SkRect r = SkRect::MakeLTRB(newT[0].x(), newT[0].y(), newT[2].x(), newT[2].y());
|
||||
canvas->drawRect(r, drawP.select_tool_line_paint(drawData));
|
||||
|
||||
auto paintPair = drawP.select_tool_line_paint(drawData);
|
||||
canvas->drawRect(r, paintPair.first);
|
||||
canvas->drawRect(r, paintPair.second);
|
||||
|
||||
canvas->restore();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue