Convert image to true black and white - skiasharp

To print an image on a non-colour printer I need to convert the image to a single colour format. Ive managed to convert to Gray8 using the ColorFilter example here: https://learn.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/graphics/skiasharp/effects/color-filters but gray scale is not the same as black and white. When it prints it gets dithered by the printer because the image contains colour channels.
There doesnt seem to be any ColorType or simple way to do this with SkiaSharp. Am I missing something?
We are printing by generating an XPS.. not sure how relevant that is.

Related

Stripes in background in RDL

Is it possible to add stripes in the textbox in report?
So the result looks like in the picture?
User chooses color for the column in the application
color
This is no built in way of doing this (no fill style) but you could use an image of the stripes as a background image. You would need to create and save images for each colour and style and add them as embedded images in the report.
You can then set the background image of a textbox to the required image.
... or better still use an expression to select the image based on conditions.
=SWITCH(
Fields!ItemCode.Value >10 , "RedStripe",
Fields!ItemCode.Value >50 , "GreenStripe",
True, Nothing
)
Where Redstripe and GreenStripe are the image names you embedded.
You can set the image to repeat etc from the properties panel
Update after OP stated that colour is parameterised.
If the colour is a parameter then we need a slightly different approach.
First you need to create an image with stripes (any colour will do ), and then remove the stripe pixels so that the stipes are now transparent. Save this as a PNG.
I created one quickly whist testing which you can save from here hopefully. You'll just have to move the mouse around in the area below as it's a white on white image! Or switch StackOverflow to the dark theme, then you can right-click and save the image. If not you'll just have to create one yourself.
Image below here.. switch StackOverflow to Dark theme to see it
Image above here..
Now you will need to set the background image to this image but also set the backgroundcolor property to an expression. In this exmaple, I set the background to the value of my parameter.
My parameter is just text and I typed in some hex values in the form #FFFFFF. You will have to work out how to get the value from your color pickers to the report yourself, ask a new question if required.
Here's the report design
and here is the report running using a few sample hex values.

Drawing html with transparent background

I'm currently trying to draw an HTML formatted text of a QTextEdit into a QPixmap with a transparent background, to use it as an overlay for another widget.
My first attempt was, to use the QTextDocument of the QTextEdit and use drawContents() to draw it to a QPixmap.
As a second attempt, I passed the HTML to a QStaticText and painted this to my QPixmap, using a QPainter.
Both approaches paint the final text as expected, however, the background of the QPixmap is always grey. Also setting the background-color of the QTextEdit, inside the StyleSheet, to transparent does no change.
Is there any way, that I can make the background transparent?
Apparently, after some more research, I found the solution.
My QPixmap was not transparent at all, even before rendering the text. I came across this blog post, in which the composition mode of the QPainter is set to CompositionMode_Source using a call to setCompositionMode().

Correctly print custom CSS shape with transparent borders

When I try to print a custom CSS shape (say triangle) as pdf, the transparent areas get printed in black colour.
So what I see is not what I get (printed)!
example: http://cssdeck.com/labs/6jsbafpp
this what I get when printing the example page:
http://i.stack.imgur.com/qzzAm.png
Is there any workarounds to print exactly what I see?

Native/default colors for hovered title text and background

Natively in chrome/firefox, hovering over an element shows its title with a yellow background with black text.
Does anyone know the exact HEX or RGB colors for each?
thanks,
tim
Took a screen capture, opened it in photoshop, used the color picker to find the values.
In OSX/Chrome the tooltip yellow background is:
#ffffca
In OSX/Chrome the tooltip text is:
#000023
In OSX/FF the tooltip yellow background is:
#feffcd
in OSX/FF the tooltip text is:
#000
There are actually minor variations at some points in the Chrome bg, it's not a purely solid color. I'm not sure what would cause that anomaly. But the hex value I took was the most consistent, and any variations are negligible anyway.
Text is of course antialiased, and values were taken from what I perceived to be the darkest area of the text, which would correspond to its actual RGB/HEX value.
Hexidecimal color value for Windows tooltip background:
FFFFE1
Hexidecimal color value for Linux:
F6F6B9
RGB color value for Windows tooltip background:
(255,255,225)
RGB color value for Linux tooltip background:
(246,246,185)
From RGB space, you convert to Hunter-Lab space, use L condition(>0.5) to set the appropriate value,
http://dataanalysers.com/00ff00

Can you change the default color for selected text in MS Access?

I haven't found an existing post about this so I'll give it a shot.
I'd like to know if there is a way to change the default highlight color for selected text? Right now, whenever I invoke .SetFocus on a field, Access "selects" the contents of the field. The color it uses is black, and makes the data very hard to see. Is there a way to change that color?
Access simply swaps the background and foreground color as its means of highlighting text in a text box. As far as I know there is no way to change this behavior.
Obviously you can change the foreground and background colors themselves, but there is no separate "highlight" color that you can set independent of the foreground/background.
Although this isn't specificity for List Boxes I still think it is worth a note that List Boxes work slightly different (not sure why... maybe a different developer!) the selected row on a list box will inverts the colour of the background and foreground separately instead of swapping them.
For example if you had a light blue text on a white background normally the selected row would be a red text on a black background. The white inverts to black and the light blue inverts to red.
Or if you had
Not sure which method I like better but it would be nice if they where the same! Makes UI's look a lot better when they are consistent throughout the form!
Sometimes this problem can be caused by using a transparent text box on a background that is the same or similar color (with contrasting-colored text). Make sure you have the text box back color set to a same/similar color as the background.
Basically, you need the text box back color to contrast with the text. When highlighted, the highlight will be a contrasting color to the text box background color.