Transparency on only one side - aframe

I was trying to add some transparency to a text and oddly enough I noticed it was only transparent on one side while being opaque on the other.
The expected behavior was transparent on both sides. Any idea why this happens?
Thank you.

https://aframe.io/docs/0.8.0/components/material.html#transparency-issues
With opacity, A-Frame sets three.js renderer to sortObjects: false. Transparency ordering is based on when objects are added / defined in the scene. Shuffle the order of the text in like the HTML or when they are injected and it should work.

Related

Creating a border container with border sides and separate corner radius

In the Spark BorderContainer component the border sides and corner radius styles were not copied over from the halo component set (see here).
Specifically:
borderSides (left, top, bottom, right)
cornerRadius(TL/TR/BL/BR)
borderThickness(Left/Right/Top/Bottom) * optional
backgroundAttachment (fixed, scroll) * optional
I've been trying to add them manually but I'm having some difficulty.
I've brought over some code from the HaloBorder.as skin and it is sortof working except it is appearing behind the background fill.
It's a lot of code so I pasted it here.
BTW That code was my first approach. But it looks like I could use the insetPath that is already there to draw border. That would be better since it allows me to set all the stroke properties but I don't know how to write path data so I'd have to learn that as well. But at this point I'd be happy to get anything working.
Update:
I found a class that has some methods for generating curved border path data. Look in spark/skins/spark/TabBarButtonSkin.mxml. You can see the code here, in the createPathData() method.

Transparent QGraphicsWebview over QGLWidget leads to super imposed images

I have a transparent QGraphicsWebview inside a QGraphicsView with the following settings:
The QGraphicsView is the high level widget, and is shown in full screen mode
The graphics view uses a QGLWidget as its view port (to use opengl-es)
Alpha channel and double buffering are enabled in this QGLWidget
Transparency is achieved by graphicsView->setStyleSheet("background:transparent")
Following attributes are set for QGraphicsView and QGraphicsWebview
WA_TranslucentBackground = true
WA_NoSystemBackground = true
WA_OpaquePaintEvent = false
The QPalette::Base and QPalette::Window brushes of webview and webview->page() are set to Qt::transparent
At the beginning, the transparency works fine. But as the screen get updated (when I scroll), it looks like the new bitmap is blended on top of the existing one to get a superimposed picture. After about 5-6 screen updates, this blending causes the colors to accumulate and form an opaque rectangle (with a corrupted image). Following images show first, second and final stages of the problem.
How do I tell qt/opengl to stop blending and just draw the new image to the frame buffer?
I tried calling fillRect(boundRect(), Qt::transparent) from overridden Webview::paint and GraphicsView::paintEvent; but it didn't work except for making the updates slower.
I am new to Qt and OpenGl, so I might be missing some basic flags or settings.
I tried all the methods mentioned above. They did not work for me. I then debugged into qtbase code and found that setting the Opacity level make the top browser layer transparent.
this->setOpacity(0.1);
this pointer points to the QGraphicsWebView object.
With this method, the whole front browser contents including background will be transparent. To separate header, paragraph and background and to specify different transparent levels for them, I will have to dig into webkit code a little further to figure out the problem. But for now, setOpacity() did the trick and is good enough for what I am doing.
It turns out the problem is graphicsView->setStyleSheet("background:transparent");. Who would have guessed?!
Yeah, the line that I thought made transparency work was actually causing troubles with transparency. The application works fine without that line (or if you change it to background:none)
In short, steps to get a transparent QGraphicsWebview using QGLWidget:
Set the Base palettes of QGraphicsWebview, QWebpage and the outer QGraphicsView to Qt::transparent
scene->setBackgroundBrush(QBrush(Qt::transparent));
You should also make sure that html body background is set to transparent values:
html, body {
background-color: rgba(127, 127, 0, 0.5);
}

QPushbutton background image from 3 images

I have three background images for a button - left.png, center.png and right.png. The left and right ones have rounded edges and the center one is a single line which need to extend based on the size of the button. How do I create such a button? I have considered the option of constructing the image on the fly and apply it to the button in the resize event, but am looking to see if this is possible through stylesheets. Is this possible?
You can't do it with background-image alone. But it may be done with the help of border-image: http://qt-project.org/doc/qt-4.8/stylesheet-reference.html#border-image
Use background-repeat: repeat-x to fill the button and border-image to round out the edges.
You can do it with QPainter and constructing the image, but honestly for the complexity level and for a button class you might be better off learning how to do it by constructing a paintEvent in full using the standard primitives. It'll give you better fine grain control, just involves a bit of leg work.

IE gradient filter doesn't respond to click event

I want to have a transparent background-color and I use gradient filter as a fallback of RGBA in IE. The code is like this:
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#bfffffff,endColorstr=#bfffffff);
I also want to trigger an event when the user clicks the background, but it seems like the click event doesn't get triggered after I set the filter. Everything is ok without the filter.
So is it another IE bug? How can I solve the problem?
This is probably related to the IE bug that makes links with transparent background no longer clickable: I came across it today. I had a link with a transparent background and display set to block: the main area of the link wasn't clickable, but a 10px border I set on it was. It seems IE also has problems with filters.
This kind of bug is discussed here and here. The first guy's solution is to give a fake background image to the element before setting the filter. The second guy's is to give the element a background colour and set the opacity to 1%, which will make it practically invisible in IE. Hopefully you'll be able to get round it using one of these.
This is not the deal.
Internet explorer creates the filters on a separate layer which is placed above your element and since the new graphic layer is not part of the element - which you have the click event on - there will be no event bubbling.
Recently I made a label element with a nice gradient filter for IE. Only the text can be clicked. If I analyze the label layers from the side with and without the gradient layer, then you will understand the problem.
without gradient filter:
------------------
text layer
------------------
background layer
------------------
with gradient filter:
------------------
text layer
------------------
gradient layer
------------------
background layer
------------------
By the way, that is the reason, why you cannot put a border radius on a gradient filter too. Try it. Create an element, and style it with border radius and give it a gradient filter and run it in IE 9. No matter how you try to force the gradient to stay inside the round borders - with for example overflow:hidden -, it will never obey. Its like a separate element which is positioned absolute and right above your element to cover it up and right under the text.

Flex 3 - Rounded bottom corners on a window?

I'm making a flex 3.5a/air2 application and I've made a popup window but I can't seem to get its bottom corners rounded. Setting cornerRadius seems to only affect the top corners.
There doesn't seem to be a roundedBottomCorners property like there is for panels, and adding a controlbar with a cornerRadius also has no effect.
I'm sure this is a very simple problem but would really appreciate any help as I can't find the answer on google or after searching on here!
If you can give up window header (and paint it yourself), try to make transparent window (with transparent background) and construct it from controls you need. I'm sure you can get window of any shape this way.
Ended up making the window transparent and setting showFlexChrome to false. Then using a container I was able to get rounded corners.
It didn't help my other problem which was trying to get a glow effect around the window and still being able to resize it.. for that I had to override the mouseDownHandler from the window class so I could modify the drag locations to the container canvas. What a pain!

Resources