Android :: Draw A Bitmap - Using OpenGL
Aug 30, 2010
I have a byte array of RGB values, just like the contents(without header) of a *.bmp file. What I want to do is, draw the corresponding bitmap on Android, using OpenGL.
It seems that OpenGL ES doesn't have a single API that will do, it true?
If true, how can I do this?
Actually, I can draw it in JAVA code, but it's too slow and costs too much CPU time. So I want to try drawing it with OpenGL. Is there any other advises? Or maybe OpenGL can't be the right answer?
View 2 Replies
Apr 2, 2009
I am 1) taking a picture and 2) then draw another Bitmap on top of it 3) then I store it
I am doing it as follows and it works on the emulator.
On the device I get a OutOfMemoryError: bitmap size exceeds VM budget android.graphics.Bitmap.nativeCopy(Native Method) android.graphics.Bitmap.copy(Bitmap.java:199) in the line copy the Bitmap to get a mutable Bitmap.
CODE:...........
What I am asking:
a) Is there a better way to do what I am doing? 1) take a picture 2) draw another Bitmap on top of it 3) then I store it
b) What is the best way to create a mutable Bitmap from the picture I just took with the camera?
In my app, resolution is not an issue. If it works better for small photos that would be fine.
View 3 Replies
View Related
Oct 8, 2009
I have two questions actually:
Is it better to draw an image on a bitmap or create a bitmap as resource and then draw it over a bitmap? Performance wise... which one is better?
If I want to draw something transparent over a bitmap, how would I go about doing it?
If I want to overlay one transparent bitmap over another, how would I do it?
View 1 Replies
View Related
Mar 22, 2009
My goal is the draw a bitmap onto another bitmap but rotated 90 degress. whats the most efficient way to do that. My current method is as follows which is horribly bad because it creates a new bitmap every time.
CODE:.....................
View 4 Replies
View Related
Jun 22, 2010
I want to draw a shape(many circles particularly) into a Specific Bitmap. I have never used canvas / 2D graphs etc. As i see it i create a Drawable put the bitmap in it then "canvas-it" to the shapes i want etc.
View 1 Replies
View Related
Nov 11, 2010
I'm trying to figure out how to draw on a bitmap in android, and keep a copy of these changed bitmaps for an undo function.
Bitmap b = ...
Paint p = new Paint();
canvas.drawBitmap(b, new Matrix(), null);
canvas.drawCircle(0,0,20,20);
//does Bitmap b have the circle drawn on it next time?
Or how do I get the bitmap after its been drawn on with the canvas(I want to preserve a stack of bitmaps with the changes applied by canvas drawing)? Maybe I'm going about this entirely wrong.
View 1 Replies
View Related
Aug 27, 2009
I'm currently developing a small OpenGL game for the Android platform and I wonder if there's an easy way to render text on top of the rendered frame (like a HUD with the player´s score etc). The text would need to use a custom font also. I've seen an example using a View as an overlay, but I don't know if I want to do that since I might want to port the game to other platforms later.
View 4 Replies
View Related
Mar 14, 2009
Is it possible to draw a png image and then to run opengl operations on it with android? Is this the right forum to ask this? where can i get more information on doing such stuff?
View 2 Replies
View Related
Apr 28, 2010
How to draw different types of lines like thick line, dashed line etc using opengl android?
View 6 Replies
View Related
Sep 7, 2012
How I can draw a sphere with opengl es in android?
View 1 Replies
View Related
Jun 14, 2009
Can i draw text on a bitmap? I cannot find any API support this.
View 4 Replies
View Related
Nov 4, 2009
I have an application that uses GLSurfaceView to draw OpenGL ES graphics. This is all working (mostly) how I would expect.
Now, I would like to implement a screenshot feature. For normal views, it seems that the standard practice is to create a new Canvas with a Bitmap and then draw to that Canvas using View.onDraw(Canvas).
I've tried using SurfaceView.draw(Canvas) in a similar fashion, but it always results in a blank (black) image.
I've also tried using the drawing cache with the exact same result.
View 3 Replies
View Related
Dec 2, 2009
Any one know about how to draw a bitmap image?...
View 6 Replies
View Related
Nov 12, 2009
I've been trying almost everything and been searching and reading everywhere on the net. I just can't seem to find the correct way of doing this.
I have a MapActivity with a MapView and I want to draw something on an Overlay. I'm overwriting the draw-method, and I can easily draw straight on the canvas using a paint. My problem is I want to merge some circles and afterwards color them. Therefore I want to create a Bitmap and then draw on that. I just don't know what to use. Should I use a mutable Bitmap, a BitmapDrawable or am I simply going in the wrong direction.
The reason I want to do this is because I want to draw some kind of heatmap upon the Google Maps, and I need to merge and blend different circles, so they appear to be just one big blob.
View 6 Replies
View Related
Mar 9, 2009
I'm creating a simple game for Android and faced with a problem: Idea is to have a huge "map" image file and re-draw only small part of it (320*480) depending on user actions.
I didn't find a better solution than using "public static Bitmap createBitmap (Bitmap source, int x, int y, int width, int height)" method and decided to try it (expected huge performance degradation), but actually it's appeared that this method changes source bitmap and when i call it second time source size is significantly reduced. For instance this code:
CODE:.................
View 4 Replies
View Related
Feb 6, 2010
the draw_texture function is the fastest and VBO is 2nd faster. But I don't understand how to use it(the draw_texture method or the VBO way).
View 2 Replies
View Related
Dec 26, 2009
I'm making a game for android where I need to draw a lot of points that change position every frame. I use the ndk to get faster processing performance of the math/physics section of the game, so I need to use OpenGL to get the fastest performance. Right now, I make a texture every frame out of an array that holds the colors of every pixel. I am only able to get ~10 frames per second with this method. Is there anyway I could speed this up? ...
View 2 Replies
View Related
Dec 25, 2009
What 's the fastest way to display a bitmap? Now I am using Bitmap.setPixels and ImageView.setImageBitmap all time that this change. It has a refresh of 15 fps. It work good, but I am not sure that is the best method to get best performance. Is better use Canvas.drawBitmap with a SurfaceView ? or opengl ?
View 3 Replies
View Related
Mar 26, 2009
In my Java code I am setting the content of an ImageView to a Bitmap. However, before doing so I want to clip the Bitmap to a circular region. How would I go about this? I've been looking for some API that would let me set the alpha channel of the Bitmap to fully transparent for all pixels outside the circular region.
View 4 Replies
View Related
Mar 1, 2010
I want to draw a bitmap on the screen by specifying the x,y locations of the four corners. I.e. I have a square bitmap and I would like to draw the:
CODE:.........
I have seen the Canvas method: public void drawBitmap (Bitmap bitmap, Rect src, RectF dst, Paint paint)
However I believe this takes the top, right, bottom and left coordinates to draw the Bitmap and not the corner coordinates. I need to specify the CORNER coordinates to draw the bitmap as I may need to stretch/distort the Bitmap (I am drawing the Bitmap on a 3D spherical model).
View 9 Replies
View Related
Aug 6, 2009
I created a layout xml file that contains an extended textview. What I want is to draw the textview in a bitmap. What do I have to do after inflating the view so that I can use the draw method on the my canvas?
View 2 Replies
View Related
Oct 12, 2010
Hints to draw a spot(small filled circle) on a bitmap image.
View 1 Replies
View Related
Oct 10, 2010
I am trying to rotate a bitmap in OpenGL. I have searched around and come up with this. code...
Drawing the bitmaps indicated with the "ids" works fine but no rotation happens. I am no expert at openGL. Is is possible I need to set some sort of mode prior to the rotation?
View 8 Replies
View Related
Oct 29, 2010
I'm trying to create a MapView in a service (live wallpaper), but have it hidden so that I can render it to a Bitmap, and then map it to a texture to render in opengl. I have a Canvas and a Bitmap, and I intended to call myMap.draw(myCanvas) in order to get it into the correct bitmap so that I could then bind it as a texture.
When I Initialize I do the following:
myMap = new MapView(ctx, APPSTATICS.MAP_API_KEY);
I get an error:
java.lang.RuntimeException: stub at com.google.android.maps.MapView.<init> (Unknown Source)
Why I can't create a new mapview which I can use to draw to a offscreen bitmap?
View 7 Replies
View Related
Jul 2, 2010
I want to draw a bitmap into a shape (in this case an isosceles trapezoid); not clipped, but with the bitmap transformed to fit the shape. For example, if the height of the left side is greater than that of the right side then I want the bitmap evenly transformed in height from left to right to match the height difference. The only method I can find to do this is drawBitmapMesh, however this produces some strange results. I have searched extensively and can find no concrete information on drawBitmapMesh.
To demonstrate the example, I have a bitmap which contains an even grid of vertical and horizontal lines. I use bitmap mesh with the code shown below. However, the horizontal lines of the grid do not evenly merge downwards from the top and upwards from the bottom towards the target. Rather, horizontal lines to the left of the line dissecting the top-left to bottom-right diagonal of the shape slant downwards to the left, lines to the right of the same diagonal slant downwards to the right. I also note that that the top line of the bitmap increases slightly in height from left before descending again to the right.
Perhaps drawBitmapMesh is not the method I should be using, or perhaps I am using it incorrectly.
CODE:...................
View 2 Replies
View Related
Sep 13, 2010
I have a somewhat large (i.e. not fit in most phones' memory) bitmap on disk. I want to draw only parts of it on the screen in a way that isn't scaled (i.e. inSampleSize == 1)
Is there a way to load/draw just the part I want given a Rect specifying the area without loading the entire bitmap content?
View 2 Replies
View Related
May 2, 2010
I would like to be able to use OpenGL in the Android to render into a bitmap (or any other sort of buffer I can turn into one), without actually displaying a GLSurfaceView.
The purpose is to dynamically create very complex images using OpenGL, and then drawing those images on the canvas of a MapView.
I have tried overlaying a translucent GLSurfaceView over a MapView, my preferred approach, but it has some problems:
1) I have complex menus I need to display from either the MapView or the GLSurfaceView. I have been doing this using a ListView with its own activity. Unfortunately, that activity pushes the MapView down the stack. The result is a bit of flickering when the ListView activity finishes, popping the MapView back to the top. Even worse, if I use the ListView to overlay the GLSurfaceView (giving it the same complex menu capabilities), when it finishes, the GLSurfaceView reappears but the MapView doesn't display.
2)As soon as the GLSurfaceView is created, the MapView stops fetching and rendering tiles. There seems to be no way to know when the MapView is complete, so I have to delay an arbitrary interval before creating the surfaceview.
3) When the GLSurfaceView is present, the MapView's built-in user interface functions are obscured.
Anyone know if there is a way around any of these problems?
View 4 Replies
View Related
Mar 17, 2010
I have a Bitmap object and want to render it to a Canvas object with varying levels of translucency (i.e. make the whole bitmap partially see through). For example, I have sprites in a game (that are drawn over the top of a bitmap background) that I want to fade out from being opaque to being invisible. Can I do this without having to resort to OpenGL?
View 2 Replies
View Related
Sep 13, 2009
I'm trying to draw Arabic text onto a Bitmap for display:
CODE:...........
However, the bitmap that is generated looks like this:
When it should look like............
I believe the issue is because, unlike a TextView, the Bitmap class is not BiDi aware, so it draws the letters from left to write.
Try as I might, I can't figure out how to draw the text in the correct order.
View 2 Replies
View Related
May 18, 2009
I'm doing performance tweaks for my new game and I seem to have come across something that isn't discussed much but I think is strange.
I have a static background bitmap loaded as RGB_565 and it draws lightning fast to the SurfaceView.
I then have all of the dynamic stuff, one of which is a full view width/height bitmap and all of these things need transparency so they are ARGB_8888. I thought that switching to ARGB_4444 for everything would speed up drawing because that's half the number of bytes to process but what I'm finding is that under no circumstances is 2D drawing any faster with ARGB_4444. All my tests are showing that it's actually twice as slow to draw an ARGB_4444 bitmap than a ARGB_8888 one on to the default RGB_565 surface!
Would any engineers care to enlighten me as to why this is? Is ARGB_8888 the fastest way to draw bitmaps with transparency?
My target platform is 1.0, btw. My friend just got a new phone and out of the box it was 1.0, not even 1.1, so I want to make sure this works as a first app on new phones. If there are 1.5-specific tweaks, I will incorporate them in a few months but for now it's gotta run well on 1.0.
View 2 Replies
View Related