Android :: How To Paint Transparency - Swiss Cheese Style
Apr 4, 2010
To explain i have a bitmap which is constructed as follows
Paint a rectangle color yellow I want now to paint a smaller circle over the top of the rectangle, but i want to use transparency. so that the circle results as a hole in the rectangle. {like swiss cheese with holes }
So if i painted the bitmap over a background the background would still be visible in the Circle/hole.
setting the drawcolor drawColor(Color.TRANSPARENT) just paints a transparent object. i.e. it doesn't erase the circle area of the rectangle.
How to do...?
One option is to set the circle color to say black and then look for an option to replace black with transparent within the bitmap.... but i can't find a solution for this either.
View 5 Replies
Nov 15, 2010
Any View have a constructor public View (Context context, AttributeSet attrs, int defStyle) which called when View declared with a style attribute So, if I have some class inherited from View class, I can access to declared attributes (like "android:layout_width" or "android:background") via AttributeSet attrs in a constructor. But when I move attributes to style I cannot see attributes and values exists in a style - I want to read items declared in style but I have only styleID in defStyle parameter. Is there some way to read style Items using styleID?
View 2 Replies
View Related
Jan 8, 2014
I've developed a fairly extensive application. The problem began when I started programming...my spinners are the solid gray rectangular style (unlike the newer style with the triangle in the lower right corner). When I started developing this app several months ago, I couldn't figure out why my spinners were different (after many hours) so I just ignored it. I'm at the point now of polishing my program and want the newer spinner style. So, I'm beating my head against the wall again. I went to my Android SDK Mananger in Eclipse and updated my Android SDK Tools, Platform-tools, and Build-tools. I have the lastest versions of all of these (22.3 and 19.0.1). When I create a new project, the newer spinner style appears. However, none of my older projects changed. They still have the same old gray, rectangular type spinners. I tried using a "android format" line command I found while Googling, but no luck with that either.I'm using ADT Bundle with build v22.2.1-833290 on a Mac OSX Mavericks.
View 1 Replies
View Related
Jul 8, 2009
I'm creating my own View class, and defining custom xml attributes with a attrs.xml. As long as I provide each attribute manually, there is no problem, but
code:...................
The android:text is properly set in my instance, but the borderDrawable is not. I guess this has something to do with namespaces, because inside the styles.xml, the name="mypack:borderDrawable" is not handled by the XML parser's namespace facility, because its inside an attribute value. So "mypack" is in no way connected to "http://some.weird.url.com/seems/not/to/ matter" and adding it via xmlns:mypack... to the stylefile would not help, I guess. In the same file, "android:text" is somehow recognized, even though "android" is AFAIK only a ns-defintion for [url], which is also not declared in that file.
So what is the proper way to set a custom attribute in a style?
View 3 Replies
View Related
May 27, 2009
I am rendering this PNG with no transparency just fine: http://n4te.com/temp/test.png However if I try to render this PNG (with transparency) with the exact same code, I just get a white box: http://n4te.com/temp/ball.png
I am loading the PNG into a texture like this: Bitmap bitmap = BitmapFactory.decodeStream(input); int[] temp = new int[1]; gl.glGenTextures(1, temp, 0); textureID = temp[0]; gl.glBindTexture(GL10.GL_TEXTURE_2D, textureID); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_NEAREST); // GL_LINEAR for quality. gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE); gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE); GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0); bitmap.recycle();
I am using this blending: gl.glBlendFunc(GL10.GL_SRC_ALPHA, GL10.GL_ONE_MINUS_SRC_ALPHA); How is it possible to render a PNG with transparency in OpenGL ES?
View 7 Replies
View Related
Jul 14, 2010
I would like to change the transparency of a whole View in Android. How can I do that? The View has a nontransparent background.
View 2 Replies
View Related
Mar 20, 2010
Is there a way to set the Astrid widget to be partially transparent/translucent? I'd like it to let some of the background show through like the default search widget and the default calendar widget.
View 5 Replies
View Related
Mar 3, 2010
why is the transparency for drawables attached to ImageButtons not honoured? i have to change them to ImageViews so they look right.
View 5 Replies
View Related
Feb 1, 2010
I need to set initial transparency for a TextView but I don't know how to do it. On iPhone it can be done easily with alpha property. I've tried to set alpha using AlphaAnimation but no good it doesn't work. It just returns to 100% alpha when it ends.
CODE:................
View 2 Replies
View Related
Apr 2, 2010
I am having problems getting transparency to work well on an ImageView. The images at(http://img265.imageshack.us/img265/6233/whatn.png) were screen captured from a Droid (hdpi). The top image I made in Photoshop and left the background white. The bottom image is the same image with the background transparent and the layout's color (white) shows through. Whenever I have transparent backgrounds in images it dithers shadows like this. Also, it only happens on hdpi devices, on my G1 (mdpi) it looks just fine. What is going on? How can I make the bottom image look as good as the top one?
View 1 Replies
View Related
Oct 25, 2009
I have a problem with one of my app. I try to make a paint application but nothing is draw on the screen (except the first circle which is draw on the launch).The log Cat seems to be correct and i get the right x/y coordinates.I think i do something wrong on the ondraw.do you see my problem?
View 3 Replies
View Related
Sep 14, 2010
I am trying to code an app where you can paint (Finger paint) free hand on a running video in a VideoView.I have the two things running separately but not together.I can draw my paint on a balance screen and i can play my video on my videoView, which is implementer in an xml layout.Is there a way to overlay the xml videoview View with an other View which can be drawable?
View 1 Replies
View Related
Jan 12, 2010
I'd like to include a simple draw feature on my app. A friend told me I can't use canvas because I need to control the frame buffer and not redraw the entire screen every for every frame.He suggested I find a openGL 2d engine.I've searched around and I've only found Rokon which doesn't have any documentation and the examples aren't quite what I need.Any suggestions?
View 2 Replies
View Related
Apr 25, 2009
I have a lot of Views where I have set a background image on the top LinearLayout and then I have nested a new linear layout below with a background that is semi-transparent. This works great in 1.1, but in 1.5 the transparency is just disregarded and this breaks my app as the text on top is now unreadable.
Is this a bug or a feature? Is there a better way of doing this? Very grateful for any tips!
Code example:
CODE:....................
View 13 Replies
View Related
Nov 19, 2010
Basically I have a fully functional ogl program (2D game) in opengl es 1.1, everything works fine except for one problem: glcolor
I'm trying to set some of my texture to half transparent and I would like to do it as follows;
gl.glColor4f(1f, 1f, 1f, .5f);
obj.draw(gl);
...
gl.glColor4f(1f, 1f, 1f, 1f);
I'm using VBO for my vertice, my textures and indices. (if that is relevant)
the problem is that nothing gets set to 50% transparency...
I'm don't think relevant to post all my code (mainly because it is spread out several classes with several GL options changing (blends, scissors etc etc).
What I would like is for people to tell me what state of OGL could prevent glcolor form working like I want, what functions should I check, what state should I call.
View 1 Replies
View Related
Jul 1, 2009
I have to get the height of the text for i have specified the text size. is this possible? i need to get the width using the Paint object and without.
View 2 Replies
View Related
Mar 29, 2010
Is there an app out there that lets you take a picture of your room with the camera,then preview different wall colors?
View 1 Replies
View Related
Jun 22, 2009
I have tried to replicate the Transparency/Translucency effects created in the API Demo(which works flawlessly) and the code i wrote works on the emulator but not on my actual device(Google ION)I copied the styles and colors.xml files from the API demos code and set the theme of my activity I want to be transparent to "@style/ Theme.Transparent" in my activity i set my content view to a layout which contains only a TextView containing : <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/text" android:layout_width="fill_parent" android:layout_height="fill_parent" android:gravity="center_vertical|center_horizontal" android:text="should have transparent background" /> i have also tried setting the theme using: setTheme (R.style.Theme_Transparent).
View 2 Replies
View Related
Oct 17, 2009
Anyone know if you can make part (i.e. a section which you could measure in pixels) of an image transparent? What graphics features would I need to look at?
View 4 Replies
View Related
Jun 17, 2010
Is it possible to change the unit for Paint.setTextSize?As far as I know,it's pixel but I like to set the text size in DIP for multiple screen support.
View 1 Replies
View Related
Sep 8, 2010
I want to create a paint and update loop in android for game animation on a canvas but I am having trouble as I can't seem to get the threading to work appropriately. It seems to crash almost immediately.
Here is what I have tried:
CODE:................
Also when I drop the wait down lower it crashes faster. Is there a more appropriate way to approach this?
Changed to this:
CODE:........
This results in the same error...
View 2 Replies
View Related
Aug 7, 2009
When applying an alpha value to an imageview, Eclipse displays the view accurately in layout mode. But when exporting to a target device (such as a phone), the alpha appears to be ignored. This impacts developers trying to create fade ins/outs of elements in a widget. Has anyone else come across this issue yet? Not sure if this behavior is by design or by error.
View 2 Replies
View Related
Aug 21, 2010
I'm new to Android and Java programming and I've manage to create a simple paint program, but how do I add a zoom feature? Right now I'm just extending the View class and using the "on Draw()" method. Do I have to use a Drawable to be able to add zooming functionality? I'm not really understanding the differences between the two. If I am way off base then please point me to a good tutorial on paint/zooming.
View 1 Replies
View Related
Jun 2, 2010
My app uses a custom View that does a lot of text drawing.To ensure my text is always readable I've been using the result of calling getTextSize() on a newly-created Paint() instance as the minimum size. Docs say calling 'new Paint()' sets attributes like text size to default values.One of my European users just got a Motorola Milestone phone and reports that some text is unreadably small.I believe I've duplicated this using the WVGA854 skin in a 2.1 emulator.Run in that emulator my app's smallest TextViews look fine, but the text I'm drawing myself using Paint instances where I haven't changed the text size from the default is too small. I confirmed this by commenting out all setTextSize() calls in my View subclass: the text becomes too small to read comfortably.
View 5 Replies
View Related
Nov 24, 2010
I'm looking for an application that will allow one to open an image (or pdf, preferably) of a worksheet and allow one to "do" that worksheet; in other words draw/write on the image/pdf.
View 4 Replies
View Related
Sep 28, 2010
I'm trying to develop an RPG for Android, so I need to paint a scenario where I'll move my character.
My idea is to do it 2D. I've developed 3D games and Java games for desktop, but in Android i don't get how to star the scenario.
Could it be developed with a matrix of information, so I could know where my character steps?
View 1 Replies
View Related
Aug 21, 2010
I'm designing a custom view which is an X/Y Plot. It's a moving graph that scrolls to the left with time and new Y values are continuously coming in at 10 per second.
I've been able to make it work with an array of integers where the array index is the X value and the integer value is the Y value, but this seems horribly inefficient (Because every time it comes time to re-paint, I have to loop 800+ times to paint the graph). Then we do it all again 10 times a second. yuck.
Can anybody think of a paintable object that I can draw points to and perform some kind of scroll transformation and then just draw the new points each time, rather than the whole canvas?
Any other ideas out there?
View 1 Replies
View Related
Apr 3, 2012
The issue I am experiencing is that the SurfaceView I am using flickers. Once in a while, the objects I draw flicker and they change their size or colour.
It looks like that sometimes the application skips my calls to 'Paint.setColor()' and the one to 'Paint.setStrokeWidth()'.
I have made methods which change the used paint and then, in order to try to fix this issue, to set it back to the default paint values. Still the issue persists. I have also read that the problem might be due to the double buffering. Is it the case? I am using this code for the DrawingThread:
I also tried to use a dirty Rectangle to try to see if the issue can be fixed, but still nothing. [I might not have understood what it actually does.
Code:
class DrawingThread extends Thread {
private SurfaceHolder _surfaceHolder;
private CustomView _cv;
private boolean _run = false;
[Code] .....
I have read somewhere I should draw on a single bitmap and then draw the bitmap on the canvas. I have tried several times but I cannot manage to do so.
View 9 Replies
View Related
Jul 19, 2013
I want to edit the transparency in my statusbar (Stock Gingerbread 2.3.5), I read I had to edit in systemui.apk value/drawable.xml. But I only get hide the status bar, really nice, but isn't what i want. I am editing the wrong file.
View 1 Replies
View Related
Jul 31, 2012
How to remove transperency from themes and roms. Galaxy s3
View 1 Replies
View Related