SDL_TTF Wrapping text with background color - sdl-2

I am trying to change the background color of the text to black so it is easier to read. I do want the text to wrap though but when I use TTF_RenderText_Blended_Wrapped I have no option to change the background color. If I use TTF_RenderText_Shaded I can set the background color but can't wrap text. Anybody know a way of doing this?
Scene1::fsurface = TTF_RenderText_Blended_Wrapped(Scene1::font, imu, Scene1::fcolor, 300);
// Scene1::fsurface = TTF_RenderText_Shaded(Scene1::font, imu, Scene1::fcolor,Scene1::bcolor);

Related

Force change label text colour

I have the following codepen: https://codepen.io/conormdowney/pen/dwmpKQ
Is there a way to force the text of the label at the top of the bars to change colour. If I wanted it to be Red for example.
I tried the below but it doesnt do anything
valueLabel.label.fill = am4core.color("#567");
also tried
valueLabel.label.text.fill = am4core.color("#567");

Is there a way to check the color on a text in RCPTT?

Not the foreground/background color, but the color of the text itself.
I need to verify the result text by color (red/green).
The foreground color is the color of the text in case of a Text field.
What kind of Widget are trying to verify?

NSTextField draws partially transparent text when drawsBackground = YES

I have an NSTextField. I want it to draw text and have a background color. But when I set drawsBackground to YES, the text seems to draw partially transparently. For example, if I set the text color to white and background to black, the text comes out gray. Why is this?
Make sure isEnabled set to true.
I was seeing this as well and changing this fixed it for me.

Applying tint() on a BufferedImage in processing

I'm grabbing visual screen contents with the Robot Class which I'm then trying to set to half transparency. I'm following the reference for the tint command like so:
screenshot = robot.createScreenCapture(new Rectangle(0,42,scrdim.width,36));
shot = new PImage(screenshot);
shot.resize(32,1);
tint(255,127);
image(shot,5,5,64-5,4);
But as soon as I use the tint command the image disappears completely, regardless of the actual aplha parameter value. Is it, because it because I'm dealing with a BufferedImage? I've been trying to figure out how to set the alpha of that directly, but with no luck.
Your transparenvcy currently is 100%.
The syntax for tint is:
tint(color, transparency);
Simply invert your tint color for 50% transparency:
tint(255, 127);

How to get the background color of a canvas

What I am trying to do is this:
Using Fabricjs, I wish to alert("the bg color is: "+canvas.getBackgroundColor()) however, that method does not exist.
I also tried canvas.backgroundColor but that returns an empty string.
Despite my efforts, nothing seems to return the background color of a canvas. Does anyone know how to do that?
html canvas is transparent by default.
When an empty canvas is drawn, the body's background will be visible.
To set the background color in fabricJS, do this:
canvas.backgroundColor = 'red';
As long as you have already set the background color, you can retrieve it like this:
var bkColor = canvas.backgroundColor;
Alternatively, you can set the background in CSS because the canvas that fabricJS creates will take the CSS of the canvas element you initially supply:
#myCanvas{ background-color:"skyblue"; }

Resources