Aero: How to draw ClearType text on glass? - aero

Using GDI+ to draw text on glass:
graphics.DrawString(s, Length(s), font, MakePointF(x, y), brush);
You'll notice that the ClearType enabled text draws very poorly on glass:
But with glass disabled the text, of course, draw fine:
By way of comparison here is Anti-alias font smoothing:
And here is no font smoothing:
Note: No font smoothing looks better than it really does because StackOverflow resizes the images on your monitor.
How do i draw ClearType text on glass?
Notes
Win32 native
not .NET (i.e. native)
not Winforms (i.e. native)
GDI+ (i.e. native)
What Mark is suggesting is that you cannot honor the user's preferences for text rendering (i.e. "SystemDefault". ClearType does not function on glass, and you cannot use it.
In other words, if you're rendering on glass you must override the text rendering with:
graphics.SetTextRenderingHint(TextRenderingHintAntiAliasGridFit);
Otherwise you should leave the TextRenderingHint at it's default TextRenderingHintSystemDefault.
See also
Aero: How to draw solid colors on glass?
Windows Aero: What color to paint to make “glass” appear?
WPF: Extending glass into client area disables ClearType entirely

The problem is inherent to the way drawing is performed. All of your text is being drawn on a black background, then composited onto a glass background; the semi-transparent font smoothing is being combined with black to make near-black.

Related

Using a black and white icon having antialias for white background on a different color background

I have designed a set of icons in B&W designed to be used on a white background so they are antialiased with different gray pixels. They are very nice so now I would like to use them on a green background but I am not able to "correct" the antialias for the green background. I am quite familiar using paint.net and gimp so I would like to learn how "correct" my icons using one of them.
This is 2022...
In the previous millennium all we had was GIF where pixels were completely opaque or completely transparent, while real edge anti-aliasing requires partial opacity. So you would typically create the image normally with partially opaque anti-aliasing pixels, and then "semi-flatten" it by replacing these partially opaque pixels with fully opaque ones holding the adequate color blend between the object and the intended background. But with modern image formats (PNG and WebP) that support partial opacity this is no longer needed
So:
Open your icon image in Gimp
Make sure it is in RGB mode (Image > Mode > RGB)
Set the Bucket-fill tool to Color erase mode
Bucket-fill the image with the color used for the semi-flattening (white, in your case). Your "gray" pixels should be replaced with the equivalent partially opaque pixels.
So this:
Becomes this:
At that point, if you export your image as a PNG it will be anti-aliased for any background color (and gradients, and patterns...).
If you insist in doing it the old way, you can still use Layer > Transparency > Semi-flatten on that universal image to make sure your image only works on one background:

How to disable Anti-Aliasing for JavaFX Fonts?

I'm making an overlay for a game with JavaFX by putting information on a magenta colored background and ColorKeying it out in OBS.
However, due to the Edges of the Font "mixing" with the background, It can't be properly keyed out (I can't change the parameters of the color key without keying out part of the Overlay).
Is there a way to disable Anti-aliasing for Fonts?
The problem can be seen here

Qt 5.6, how to draw text with a different fill and outline colours

I'm using Qt5.6, I am drawing text on a video window, however sometimes the text is not very readable due to the video content in the window. I'm current drawing the text on the painter context with the 'drawText' method. Whilst I can set the pen colour which controls the fill, I do not seem to be able to set an outline colour.
I would like to draw the text with a black outline to make it stand out. Unfortunately firewall where I am working makes life very difficult and any useful web-site that might help, seems to be blocked, hence this post.
Thank you,
Try using QPainterPath::addText().
You can add the text to a path, then QPainter::fillPath() and QPainter::strokePath() the path.
Or you can direcly use QPainter::drawPath() with a brush and pen set.

Object in Blender turned into a grid [Blender]

I am new to Blender. I was creating an object and a skeleton when suddenly the object basically turned into a grid instead of showing off the default material.
How to make it look normal again ?
The 3dview has several shading modes available, you have switched to wireframe mode.
You can switch back to solid or texture that you had before from the viewport shading menu.
There are some shortcuts to change the shading mode. Z toggles between wireframe and solid shading which is most likely how you switched to wireframe shading, ⎇ AltZ will toggle between solid and textured shading while ⇧ ShiftZ enables rendered shading in the viewport.

Button background appears 3% darker than it should be

I'm adding CSS to a Bootstrap-based web app, to match a PDF from a designer. There's a button image, whose background color Seashore reports as rgb(0,186,158) aka hsl(171,100,36%). So I set the background colour of the button to match the image:
background-image: url('images/elements/small-search-button-up.png');
background-color: hsl(171,100%,36%);
Only...it doesn't.
Subtracting 3% from the luminosity fixes it:
I'd love to know why. I can't see any obvious causes in all of the other CSS styles applied. This happens in both Chrome and Firefox, on OS X Snow Leopard.
I'm seeing something similar with certain fonts (comparing the web rendered output with a provided PDF), but that cause could be different.
EDIT
Here's the original image. Hopefully SO doesn't process it.
EDIT2
Why use PNG? That's how the designer provided the images. I wasn't aware that there was a trade-off with color space information. Also, I would have thought that PNGs are better for glyphs needing flat backgrounds and crisp edges (compared to JPEGs), no?
It's most likely the color of the PNG image that is not displayed consistently.
A PNG image doesn't have color space information, instead it has a gamma value, and there is a problem to interpret that value to determine a color space. You will probably see that there is a color difference between different browsers, so if you adjust the color for how one browser displays the PNG, it won't match in other browsers.
Use a different file format if you need the color match other elements, or make the background of the PNG transparent instead of green.
Rendering text is a different matter. There will always be slight differences in how browsers renders different fonts, depending on the rendering method used, which fonts are installed, and system/user settings. You simply can't expect exactly the same result in different browsers.

Resources