Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WPF Font Scaling Problem with Render Target Bitmap at Format1bppIndexed #346

Open
vsfeedback opened this issue Feb 12, 2019 · 15 comments
Open
Labels
Bug Product bug (most likely)
Milestone

Comments

@vsfeedback
Copy link

vsfeedback commented Feb 12, 2019

I am using .Net framework 4.6.1 and faced following scaling problem in Arial Font.

Below image is generated with same program at DPI 96 for [100% windows 10 Scaling] and

DPI 120 for [125% recommended windows 10 Scaling]

In the result we can clearly see non homogeneity in rendering

Image:58888-resultarial.png

I am also attaching project file,

You can experience same with program and executable (Its based on Arial Font)
Steps to reproduce:
Drag/move canvas elements on left and you will see Format1bppIndexed Image

image generated on left side.

All I want is to have homogeneous and smooth text rendering under different windows 10 scaling when rendering target bitmap @ Format1bppIndexed from WPF Element.

I am also attaching solution for reproducing,

scalingissuewpf.zip

This issue has been moved from https://developercommunity.visualstudio.com/content/problem/449544/wpf-font-scaling-problem-with-render-target-bitmap.html
VSTS ticketId: 789260

These are the original issue comments:
(no comments)
These are the original issue solutions:
(no solutions)

@ssalmanshah
Copy link

Hi Blair Wang,
What’s possible solution for this problem now?

Do I need to clone repository of Git and its fixed there?

Please let me know.
Waiting for response.

Thanks.

@mikedn
Copy link

mikedn commented Feb 12, 2019

All I want is to have homogeneous and smooth text rendering under different windows 10 scaling when rendering target bitmap @ Format1bppIndexed from WPF Element.

Smooth text rendering on a 1bpp bitmap is rather contradictory. 1bpp is black & white so you basically end up drawing up text without any kind of antialiasing.

@walterlv
Copy link
Contributor

@vsfeedback It's recommended to use ![](imageurl) to post an image so that we can read your question directly without clicking into the linked images.

@rladuca
Copy link
Member

rladuca commented Feb 13, 2019

@walterlv @vsfeedback is a bot that shuffles bugs from the VS Feedback site to GitHub. WPF doesn't own the code to it, but we'll bring up your suggestion to them. There might be specific reasons they don't want to embed images like that, perhaps to cut down traffic.

@ssalmanshah
Copy link

This is image difference when dragging canvas object

@Rand-Random
Copy link

Out of curiousity, why is here the correct place for this issue?
OP is stating that he is using .Net framework 4.6.1, so why would the GitHub page for WPF .Net Core 3.0, be the correct place?

@stevenbrix
Copy link
Contributor

This is still a valid place to put all WPF related issues. The fact that it happens in .Net Framework 4.6.1 just means we might get to it after the initial release, since we're focusing on ensuring parity right now. Presumably this is still an issue in the netcore3 version of WPF, @ssalmanshah have you been able to confirm that?

@stevenbrix stevenbrix added this to the Future milestone Apr 4, 2019
@stevenbrix stevenbrix added the Bug Product bug (most likely) label Apr 4, 2019
@ssalmanshah
Copy link

ssalmanshah commented Apr 5, 2019 via email

@mikedn
Copy link

mikedn commented Apr 5, 2019

It's still not clear how do you expect this to work. You are basically rendering text without antialiasing. It's simply not going to look smooth.

@ssalmanshah
Copy link

ssalmanshah commented Apr 5, 2019 via email

@mikedn
Copy link

mikedn commented Apr 5, 2019

As far as I can tell the lag has nothing to do with 1bpp images and fonts, it's just the consequence of the way the image is updated - on a timer that fires every 200ms.

@ssalmanshah
Copy link

ssalmanshah commented Apr 5, 2019 via email

@mikedn
Copy link

mikedn commented Apr 5, 2019

But Image should be smooth every time as this is doing with other image generation formats.

Hmm, can't seem to reproduce this. For me things are pretty smooth with a timer interval of 30ms. Changing the bitmap format doesn't seem to have any effect.

That said, the format conversion code that you're using is pretty convoluted and it involves System.Drawing. You could try to use FormattedConvertedBitmap instead of all that:

DiagramImage.Source = new FormatConvertedBitmap(targetBitmap, PixelFormats.BlackWhite, null, 0);

though it produces a different image and that may be a problem for you.
image

@ssalmanshah
Copy link

ssalmanshah commented Apr 8, 2019 via email

@ssalmanshah
Copy link

Please see variation of middle image in this video

https://www.screencast.com/t/TmzJEdS6AZiR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Product bug (most likely)
Projects
None yet
Development

No branches or pull requests

7 participants