Disable Antialiasing with HatchBrush? - c#

I want to use Graphics.FillRectangle with a HatchBrush, drawing on a transparent window with a ControlStyles.SupportsTransparentBackColor style.
Therefore I must disable the line smoothing that appears when the (diagonal) lines are drawn by the hatch brush, otherwise I get a combined color of the brush's color and Magenta, which is the transparency key color, resulting in a somehow Magenta hatch, regardless of my chosen color.
I have tried various mode properties of my Graphics object, without luck.

Related

How to use a brush over an image in c# so that the background appears highlighted

We have an image and are using Graphics. We want to overlay a rectangle on an image and make it appear highlighted in Yellow (or some other color). What we have done is create rectangle and fill it with a brush. We could use a solid brush and turn down the opacity but it appears muddy. We believe that we could use a gradient brush and use a blend mode to create the highlight.
We want to do something similar to this ( https://www.graphicsmill.com/docs/gm/blending-modes.htm#Multiply ) in c# with the Microsoft library. Does such a thing exist?
Any help would be appreciated.

What pixel shader can I use to remove a background color, but keep transparent pixels?

I can use a pixel shader in WPF to remove a specific color, but there are alpha pixels layered over the background. I want to remove a background color, but keep alpha pixels.
For example, I have Image 1. It is a red rectangle with opacity 50% overlaid on a solid black background. I want to remove the black background so that the red rectangle stays alpha 50% and then I can overlay the resulted image on blue background like on Image 2-3 (left).
But by using a pixel shader to remove a specific color, I get Image 2-3 (right), which is not what I want.
Image 2-3.
Is it possible?
How is this process called?
What pixel shader can I use to do it in WPF?

Ellipse Stroke background color

I have an ellipse with a stroke, so:
myEllipse.Stroke = Brushes.Yellow;
I need it to be yellow, but it doesn't always show up nicely on white backgrounds, which is pretty common in this scenario.
I was wondering if there was a way to put the Yellow Stroke on a black background.
myEllipse.Stroke = Brushes.Black;
myEllipse.Stroke = Brushes.Yellow;
Where instead of the yellow replacing the black, it would be a combination so that it always appears yellow as if the background image was black.
You could draw two ellipses on top of each other. The first would be black and slightly thicker than the second which would be yellow.
They get drawn in the order they are added to their container object (view, grid or whatever), so make sure you add them in the order "black" then "yellow".

BorderBrush and Background not match

I am having a problem with BorderBrush and Background. They both are set to the same gradient but as border starts higher, they don't match. How do I make it match? These are 5 buttons in the image:
Edited: I need border for rounded corners. It's not in the picture but I need 'em.
Why not make it harder on yourself? To achieve this (keep rounded corners), you can do one of two things: Adjust the border gradient (trial and error, most likely) or you will have to change the button's Template so that the face of the button is represented by a Border that has radiused corners (with a border of thickness 0) and a Background of your gradient.
Of course, since the Button template is very complex you'll have to reproduce all the animations, overlays etc on your new template.

Changing Windows Vista/7's Transparency Color

Ok, so I've heard that the color Microsoft decided to use for there Transparency is Black. Which would explain why black text is invisible when drawn/placed onto a Glass surface.
Wouldn't it just make sense for us to change the transparency color (black) BACK to Magenta? Why didn't they do this again? Is it even possible to change this color?
I'm not sure about chainging the transparent color, but you could render #010101 text and it should be dark enough for black, no? On a glass surface pure black could be hard to see anyway.

Categories

Resources