I want to achieve the result like in the image below:
I assume, solutiuon is:
Cut the custom shape.
Scale received shape.
Apply blur to main texture.
Draw the shape on top.
Draw the real transparent drop on the top of shape.
My question is how to cut the texture in drop shape using vertex and/or fragment shader? Appreciate any ideas and suggestions abot the way to go.
Related
I'd like to blink out a texture in an android live wallpaper. I can easily just not draw that shape for a second, but I'd like it to look more realistic.
How can I blink (like an eye blink) a shape. I'd like it to progressively close. One idea was to have another duplicate shape with a fragment shader that only covered a percentage of the shape on each iteration of draw, but I'm not sure how to determine if the pixel should be transparent or not from within the shader. Any ideas?
Or is there a better way to accomplish this?
I've been trying to figure out how to draw a transparent rectangle with rounded corners and border with no avail.
Being new to andengine, I'm wondering if it is possible at all. Can someone please provide some pointers or help with a link to a sample. Wasn't able to find any when searching over the internet.
There already Rectangle class in andengine..
Rectangle rec=new Rectangle(x,y,width,height,....);
For transparency:
rec.setAlpha(0):
Attach to your scene, if you are using rectangle as physics object like used for collision then create box body from PhysicsFactory.createBoxBody();
scene.attachChild(rec);
Instead of using a Rectangle can you use a Sprite. Just create an image in Photoshop or another program, apply some transparency and export as .png. Then just load the image as Sprite.
I want to apply the border to this custom view shape
which created by many canvas.draw...() in onDraw()
The border that i want to create and apply to my custom view should have equal range all the way with some distance from the custom view and it should also cover small circle in each slice.
Any idea how to make this?
Thanks.
This isn't so much an answer, but more of a recommendation. Take a look at the Porter-Duff modes available to you. Worst case you may need to do some per pixel image manipulation which should be fine as long as the view isn't animated.
On second thought, here's an idea: why not create two images: one large circle which will always draw behind everything and a second which will always draw behind the small circles. The large circle would just be the complete border you want displayed, whereas the small circles would actually only be a semi circle border, which would render on top of the large circle (covering the large circle border under it). The key would then be to rotate the small border circle depending on where it's located. I hippie that makes sense, but it should work and be very efficient too.
Another option would be to separate the rendering into white circles and slightly larger border color circles. If you render the slightly larger (border color) circles first, then render the normal circles (white) on top, then you won't have to worry about any rotations and it will render correctly if the small outer circles begin to overlap.
So the idea is similar to the first suggestion. You'll still need a large circle and small circle (both white), but in addition, you'll need slightly larger border colored large and small circles.
I hope this description is a little clearer, but I assume that you are comfortable enough with compound drawables to figure out the rest, given that you've gotten this far in making your view.
All the best implementing it, and feel free to ask for any clarification! :)
This is my first question...
I've a square (triangle strip) with a texture (.png).
This .png have smooth corners like a play card.
The four extremities (corners) are transparent.
When draw the square, in the corners, i see the white color of the shape.
(Like a background behind the texture)
My question is:
How can i draw a transparent color for the shape, but mantain the color of the texture with a full apha?
(If i set transparent colors.... then also the texture become transparent)
How can i separate the two contexts?
Thanks in advance.. and sorry for my bad english.
First of all, you must use a texture format with alpha channel.
Then if you are using fixed function pipeline, you must enable blending.
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
If you are not using fixed function pipeline, please share the fragment shader code; and a little more details on how you are using it.
On an android Canvas, if I draw a circle with alpha 0xCC and color Color.RED and then draw another circle which partially overlaps the first circle with the same parameters, I'll end up with a venn diagram.
Here is a random example I found (just ignore the [Text] in there). I want to draw overlapping circles like in this diagram, but I don't want the center to be darker, but I do want the whole thing to have alpha so that the map underneath is visible.
Is there a way to do this directly or do I need to draw to a bitmap without alpha and then set the alpha for the whole bitmap and draw it to a canvas? (I haven't used bitmaps yet, so I am not sure how they are used yet.)
The easy way would be your suggested solution, ie. drawing all circles with no alpha to a bitmap, then draw that bitmap to another one using the desired alpha.
The hard way would be using blend modes, specifically PorterDuff.Mode in Android. An example can be found here.