Giter Site home page Giter Site logo

image_grabber's Introduction

Canvas Image Grabber

用HTML5 Canvas实现的类似Photoshop钢笔和魔棒工具。

操作说明:

  1. 拖拽图片到浏览器窗口
  2. 使用+和-进行缩放
  3. 魔棒工具点击图片,使用Delete/Backspace键可以删除所选的像素
  4. 钢笔工具绘制一个路径,按选项面板的Mask按钮可以只显示路径内的图像
  5. 使用钢笔工具时可以配合Option/Alt键来操作节点和控制杆
  6. 点击Save按钮会将当前画布状态输出成图片

实现说明:

  • 魔棒工具的算法使用的是Flood Fill,用了Web Workers来做计算,尽可能保证界面的响应
  • 蚁线参考Code Pen这个示例。当图像缩放到尺寸较大时有渲染性能问题
  • 钢笔工具为了方便判断,直线去曲线都是用bezierCurveTo方法来绘制,借鉴了Photoshop的交互,简化了组合键和选择交互
  • Mask遮罩选项使用Canvas Global Composite Operation提供的destination-in方式来绘制

image_grabber's People

Contributors

cyjake avatar kfitfk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.