misohena / el-easydraw

Embedded drawing tool for Emacs
https://misohena.jp/blog/2021-09-21-emacs-easy-draw.html
GNU General Public License v3.0
721 stars 21 forks source link

feature request: able to draw free stroke with cursor or stylus #9

Closed jobez closed 2 years ago

jobez commented 2 years ago

Thank you so much for your excellent work!

I have a 2-in-1 laptop and I would love to be able to do some handwritten notes in emacs. I've seen an example of 'freehand' svg here and was wondering if there was any interest in implementing something like it: https://lifeofpenguin.blogspot.com/2021/08/scribble-notes-in-gnu-emacs.html.

Bonus points if you could also integrate pressure sensitivity!

misohena commented 2 years ago

(Google Translate) Hello jobez.

2-in-1 laptop PC is good.

I added Freehand Tool. (Tips: You can turn the grid on / off with the # key)

https://github.com/misohena/el-easydraw/commit/9936954ddfcfcec5f9e8dd3b18c55d0189c6d5c6

However, don't expect too much as it may be very slow in some environments. It flickers quite a bit in my environment.

Path simplification has not been implemented yet. I think that removing unnecessary points will improve the data size and speed a little.

I implemented the smoothing of the path by diverting the function that has already been implemented, but I would like to adjust it a little more.

Bonus points if you could also integrate pressure sensitivity!

Emacs doesn't have the ability to get pressure, so if you do, you'll need to extend Emacs in some way. Source code modifications and rebuilds, Emacs modules, window hooks by external applications, and more. In any case, I think it will take a lot of effort for each OS.

freehand

(Original Message) jobezさんこんにちは。

2-in-1 laptop PC良いですね。

Freehand Toolを追加してみました。(Tips: #キーでグリッドをON/OFFできます)

https://github.com/misohena/el-easydraw/commit/9936954ddfcfcec5f9e8dd3b18c55d0189c6d5c6

ただし、環境によっては非常に動作が遅いかもしれないのであまり期待しないでください。私の環境ではかなりチラつきます。

パスの簡略化はまだ未実装です。無駄な点を削除するとデータサイズや速度が多少改善されると思います。

パスのスムーズ化は既に実装されている機能を流用して実装しましたがもう少し調整したいところです。

Bonus points if you could also integrate pressure sensitivity!

Emacsには圧力を取得する機能は無いのでやるならば何らかの形でEmacsを拡張する必要があります。ソースコードの修正とリビルド、Emacsモジュール、外部アプリケーションによるウィンドウのフック等々。いずれにせよOS毎に沢山の努力が必要になると思います。

jobez commented 2 years ago

Thank you! I appreciate your effort and response!