Nested transparency in OpenSCAD output - transparency

Transparency in OpenSCAD output can be achieved by prepending % to elements, but this doesn't allow to put a transparent element in a surrounding element with a higher degree (e.g. expressed in percentage) of transparency and make it possible to see an (opaque) element in a transparent element inside a transparent element. How to do that?

the a-value of color([r,g,b,a]) can be used to control transparency, e.g.:
color([0.5,0.5,0,0.8]) cube(size=[10,10,10], center=true);
%cube(size=[20,20,20], center=true);
or with different colors:
color([0.5,0.5,0,0.8]) cube(size=[10,10,10], center=true);
color([0,0.5,0.5,0.3]) cube(size=[20,20,20], center=true);

Related

How to style the transform anchors on a Konva element?

How do I style the transform anchors (e.g., blue boxes) on a transformable Konva element? Note I'm using Konva with konva-react.
Example 1:
In other words, what if I wanted to make the boxes grey, and semi-transparent? Or change the size?
Example 2:
Or, what if I waned to remove the anchors and make the entire edge of a Rect able to be grabbed to resize? In other words, make the anchor transparent and full-height/full-width.
I’d start your research using the elements from this example:
https://konvajs.org/docs/sandbox/Image_Resize.html
It shows that the transformer has various bits you can style in your own way. Good luck with that.

Zeroing channels of cut out area

I imagine there is probably going to be an easy solution for this in GIMP, but I for the life of me can't figure it out.
I'm using the color picker tool with the use info window selected to verify pixel values.
Basically, I have some pixels in an image that I need to zero out. By that I mean I want the RGBA values to all be set to 0.
I attempted to:
use the rectangular select tool to select the group of pixels
use bucket fill to set the pixels to black with opacity set to 0.0
Then, to verify it was done correctly, I use the color picker to test the value of the rectangle I just filled.
Unfortunately, it seems to just contain the previous value. What am I missing here?
The "opacity" of the bucket-fill is the opacity of the paint, not the opacity of the resulting pixels. In other words the less opaque it is, the less visible the result. What you want to do is bucket-fill selection with black, then [delete].

Rounded textBox

Is ShapeRenderer class has the ability to do this,I would like to create boundaries for a custom object (such as a rectangle with rounded corners) and then fill it.And after that some text on that filled rounded box.
shapeRenderer.begin(ShapeType.Filled);
shapeRenderer.setColor(Color.RED);
//shapeRenderer.line(...);
shapeRenderer.curve(x1, y1, cx1, cy1, cx2, cy2, x2, y2, segments);
shapeRenderer.line(...);
shapeRenderer.curve(...);
shapeRenderer.line(...);
shapeRenderer.curve(...);
shapeRenderer.line(...);
shapeRenderer.curve(...);
shapeRenderer.setColor(Color.BLACK);
shapeRenderer.fill();
shapeRenderer.end();
Any suggestion to do it in libgdx.
As Lestat said, you can use Scene2d.
Whether you are using Scene2d or not, a NinePatch would probably be suitable if you want to draw a rounded rectangle that scales well (check this link).
If you want to be able to set the color of your image/control, you can use NinePatch.setColor().
Here are two example scenarios regarding colors:
You will always have a black stroke/outline, and an arbitrary fill. In this case make the original image have black stroke/outline and white interior. When you 'tint' the image using NinePatch.setColor(), the stroke/outline will be unaffected and will remain black, while the interior (fill) will be the same as the color provide to the mentioned method.
You have arbitrary fill and arbitrary stroke. In this case you need 2 separate original images. First one would contain the 'fill' and would be completely white. Second one would contain the 'stroke' in white color and would be transparent inside. When drawing you would draw first the fill with its tint and then the stroke with its tint and that's all.
If for some reason you needed different corner curve radii, you would probably need separate images (or image pairs) for each radius to get the best result.

Using Color Structure Descriptor

According to Colour Structure Descriptor (CSD) definition it says, CSD can be use to express the structure of colours in an image using HMMD colour space. But how?
Since it gives number of times a colour appear, how can we derive the position from it?
If it is impossible, what could I do to extract the structure of colours in an image.
(Basically I want an output to express some thing similar. Example: Blue on top part, Green on middle part and Brown on bottom part.)

Combined background color and image in shape

I want to set this style for an SVG <path>:
background-color: red;
background-image: url('myImage.png');
This picture has transparent pixels and I need background color to fill it.
What you would do in SVG is to define a <pattern> that contains a rect with the color you want and the image you want, and then use that as fill for the <path>.
See this example from the SVG testsuite.
'background-image' and 'background-color' don't apply to svg content unless it's handled by the CSS box model (so basically just the root svg element).
I'm reasonably sure you cannot have an image with a background colour in one path.
You can however replicate the effect by having two paths in the same position, with the image path on top of the solid colour path.

Resources