klaus Expert Licensed User Longtime User Jul 14, 2016 #1 It seems that the DrawImage and DrawImage2 methods have an antialiasing included. Is there a way to remove this. Attached a small test program. The first line at the left side is drawn with DrawLine. Then the image of this line is copied besides the provious line with DrawImage2, we see that the line is blurred. Then we copy this new line to its right, again with DrawImage2, and the same once more. We notice that the more we copy the line the more blurred it becomes. Attachments DrawImage.zip DrawImage.zip 1.7 KB · Views: 463
It seems that the DrawImage and DrawImage2 methods have an antialiasing included. Is there a way to remove this. Attached a small test program. The first line at the left side is drawn with DrawLine. Then the image of this line is copied besides the provious line with DrawImage2, we see that the line is blurred. Then we copy this new line to its right, again with DrawImage2, and the same once more. We notice that the more we copy the line the more blurred it becomes.
Cableguy Expert Licensed User Longtime User Jul 14, 2016 #2 nice finding! I guess there will be cases where the anti-aliasing will come in handy, and some cases where it wont! Upvote 0
nice finding! I guess there will be cases where the anti-aliasing will come in handy, and some cases where it wont!
Erel B4X founder Staff member Licensed User Longtime User Jul 14, 2016 #3 I don't think that it is possible to disable the canvas antialiasing. Upvote 0
klaus Expert Licensed User Longtime User Jul 14, 2016 #4 I am a bit disapointed because it seems that you cannot copy an image as it is. Sounds somewhat strange to me !? Upvote 0
I am a bit disapointed because it seems that you cannot copy an image as it is. Sounds somewhat strange to me !?
Cableguy Expert Licensed User Longtime User Jul 14, 2016 #5 Correct me if I'm wrong, but, won't the anti-aliasing only affect the outer edges of the copied image? (opposed to anti-aliasing every pixel/color) Upvote 0
Correct me if I'm wrong, but, won't the anti-aliasing only affect the outer edges of the copied image? (opposed to anti-aliasing every pixel/color)
klaus Expert Licensed User Longtime User Jul 14, 2016 #6 ... won't the anti-aliasing only affect the outer edges of the copied image? Click to expand... No. In the test project I have a Canvas with a width of 400 and a height of 250 pixels. I first draw a line from x0 = 0, y0 = 100 to x1 = 100 and y1 = 200, then I copy the left part of the image containing the line. The copie image has a width = 100 pixels and height = 250 pixels. The line is in the middle of the height not at an edge. The line has an antialiasing which smoothes the line edges. But I don't want this. Upvote 0
... won't the anti-aliasing only affect the outer edges of the copied image? Click to expand... No. In the test project I have a Canvas with a width of 400 and a height of 250 pixels. I first draw a line from x0 = 0, y0 = 100 to x1 = 100 and y1 = 200, then I copy the left part of the image containing the line. The copie image has a width = 100 pixels and height = 250 pixels. The line is in the middle of the height not at an edge. The line has an antialiasing which smoothes the line edges. But I don't want this.
klaus Expert Licensed User Longtime User Jul 14, 2016 #7 Erel, I had a look at the Java documentaion and found the Graphics2 and the RenderingHints class and Controlling Rendering Quality. Can't this be used ? Unfortunately I don't have the Java knowledge. Upvote 0
Erel, I had a look at the Java documentaion and found the Graphics2 and the RenderingHints class and Controlling Rendering Quality. Can't this be used ? Unfortunately I don't have the Java knowledge.
Daestrum Expert Licensed User Longtime User Jul 14, 2016 #8 I found a library that allows you to turn off the antialiasing - only minor code changes required library from http://www.jfree.org/fxgraphics2d/ (not included here as there may be license restriction) To be honest I can't see a difference, but then I have bad eyes. Attachments antialias.zip antialias.zip 2.1 KB · Views: 458 Upvote 0
I found a library that allows you to turn off the antialiasing - only minor code changes required library from http://www.jfree.org/fxgraphics2d/ (not included here as there may be license restriction) To be honest I can't see a difference, but then I have bad eyes.
Erel B4X founder Staff member Licensed User Longtime User Jul 15, 2016 #9 klaus said: I had a look at the Java documentaion and found the Graphics2 and the RenderingHints class and Controlling Rendering Quality. Can't this be used ? Click to expand... No. These are Java AWT classes. This is the "old" UI toolkit. This is what I get when I test your program (from post #1): It looks sharp here. Are you using non-standard dpi settings? Upvote 0
klaus said: I had a look at the Java documentaion and found the Graphics2 and the RenderingHints class and Controlling Rendering Quality. Can't this be used ? Click to expand... No. These are Java AWT classes. This is the "old" UI toolkit. This is what I get when I test your program (from post #1): It looks sharp here. Are you using non-standard dpi settings?
klaus Expert Licensed User Longtime User Jul 16, 2016 #10 Erel said: Are you using non-standard dpi settings? Click to expand... I used text size 150%. I set it back to 100% and the lines are sharp. I set it to 150% again, and now the lines are sharp !!!??? Thank you for the hint ! Upvote 0
Erel said: Are you using non-standard dpi settings? Click to expand... I used text size 150%. I set it back to 100% and the lines are sharp. I set it to 150% again, and now the lines are sharp !!!??? Thank you for the hint !