gInk icon indicating copy to clipboard operation
gInk copied to clipboard

Smoothing drawing lines

Open JohanCostaRica opened this issue 4 years ago • 17 comments

Hi Guys,

First of all many thanks for developing gInk. It is very useful for the online teaching style I use with my students during COVID19. I was using smoothdraw before to write equations and make sketches and gInk allows me to write on top on my programs making it super effective. However, when I write I find that the lines are a bit pixely and would look better if the path of the cursor would be smoothed over a few pixels. Another way to do it would be lowering the Alpha value but on the edge of the drawing path. Am I making sense? Is someone up for the challenge?

Many thanks !! Take care!

JohanCostaRica avatar Apr 18 '20 15:04 JohanCostaRica

I believe you are talking about anti-aliasing. This is a issue that this software had had since the first week of development. When using mouse and touch screen, the edge of the lines looks smooth, while when using stylus, the edge of the lines is pixely. The anti-aliasing feature stops working for unknown reason. I haven't found a solution.

geovens avatar Apr 24 '20 03:04 geovens

@JohanCostaRica I presume you are talking about the drawing that is one when using the mouse? I think several techniques exist. One advice I can give from one teacher to another; use a tablet; even a cheap one will give you the benefit of anti-aliased drawing, highlighting or writing on-screen in combination with various tools (powerpoint, word, gInk). It takes getting used to, but it's a very wortwhile investment for distance learning to get even a cheap one, in my opinion.

Edit: of course, this doesn't fix the pixelated drawing which does occur when drawing with a mouse.

Joeppie avatar Apr 24 '20 16:04 Joeppie

Thanks for your response. I am not using a mouse but a a wacon writing tablet with a pen/stylus. I love gInk to jump very quickly between colors and going back the my app window with shortcuts. It works great! The only criticism is the pixelated lines when writing (especially when writing slowly). Antialiasing might be an option or smooth average over the path. I was using before Smoothdraw (Freeware) to make my video/tutorials (Khan academy style) and the feel of the lines was better/smoother. But gInk allows me to draw on screen. Nothing is perfect I guess but if we could incorporate the smoothness of SmoothDraw in gInk that would be amazing!! Many thanks!!

JohanCostaRica avatar Apr 24 '20 16:04 JohanCostaRica

Here is an example:

Tareas001

JohanCostaRica avatar Apr 24 '20 16:04 JohanCostaRica

image

JohanCostaRica avatar Apr 24 '20 17:04 JohanCostaRica

@JohanCostaRica That is weird. It works just fine for me in gInk! image

Now, if only my handwriting were as nice as yours. I also use a Wacom tablet, under windows 10. I presume you succesfully installed the driver? Perhaps it has to do with a setting in windows ink? gInk uses the Microsoft Ink library.

Joeppie avatar Apr 24 '20 18:04 Joeppie

Thanks for your fast response Joeppie! Interesting! I am under windows 7. Yes I did install the latest Wacom drivers. What do you think should be my next step? How do I check If I have the MS ink library installed?

JohanCostaRica avatar Apr 24 '20 18:04 JohanCostaRica

@JohanCostaRica Interesting. I suspect it has to do with Windows 7 then, Windows 10 has improved ink support I think, so I suspect the 'strokes' that are made are anti-aliased outside of gInk. gInk 'lets' the MS Ink library do the drawing for it, and then waits for it to complete.

Yet another reason to upgrade to Windows 10? However, I do envy you. Windows 7 was such a pleasant experience.

Joeppie avatar Apr 24 '20 19:04 Joeppie

@geovens I believe that perhaps on Windows 7, the DrawingAttributes (e.g. in PenAttr[0] = new DrawingAttributes(); in Root.cs) has AntiAliased set to false. I can produce similarly jagged lines to @JohanCostaRica only if I manually set this to false. So I believe the fix is to add: PenAttr[0].AntiAliased = true; for all pens.

Edit: Similarly; IgnorePressure should be set to ~~True~~ false explicitly..

It might fix the issue for Windows 7 users, but this would need testing.

Joeppie avatar Apr 24 '20 19:04 Joeppie

ok, changed in Roots.cs image Sorry, I am so ignorant...what should I do next?

JohanCostaRica avatar Apr 24 '20 19:04 JohanCostaRica

@JohanCostaRica If you can run the application from its source, (can you?) then these changes should mean the pens bound by default to keys 0 and 1 now have their strokes antialiased. (You are still missing the pressure sensitivity though)

Joeppie avatar Apr 24 '20 20:04 Joeppie

Can I run it from the source, you ask? Sorry I feel so ignorant... I manage to edit the Root.cs in MS visual studio but I do not know what to do next... image

JohanCostaRica avatar Apr 24 '20 20:04 JohanCostaRica

Making some progress. I have loaded the *.sln file and can run the code but

        PenAttr[1].AntiAliased = true;
        PenAttr[1].IgnorePressure = false;

does not seem to change anything...

JohanCostaRica avatar Apr 24 '20 20:04 JohanCostaRica

@JohanCostaRica Then it might be a lack of support on Windows 7. The values you put in are, and should be the default values... so then it would seem that's what they were already set to.

Joeppie avatar Apr 24 '20 21:04 Joeppie

I use Microsoft Surface Pro 3 in Windows 10 and the lines are jagged when drawing with a stylus.

geovens avatar Apr 24 '20 22:04 geovens

@Joeppie. When I run the modified Root.cs it gets access to Microsoft.Ink version 6.1.0.0 from image but it is an old version of the dll. I have noticed that in the bin folder of gInk there is a newer version of Microsoft.Ink.dll (10.0.10586.0) I have copied it to system32 and SysWOW64 but no change. Could it be a reason why AntiAliasing and the pressure sensitivity is not working? if so, how can direct gInk to the newer dll?

JohanCostaRica avatar Apr 24 '20 23:04 JohanCostaRica

@JohanCostaRica interesting, that is some very good detectivework on your part.

Yes, this most certainly can happen in .NET. When it tries to use a DLL it looks for it in multiple locations. One of them being the application folder itself. It, however, does this after looking in the folder you just showed.

It's worth looking into whether we can force gInk to try and load the newer supplied DLL.

Joeppie avatar Apr 25 '20 07:04 Joeppie