Android : Rotate Bitmap In Opengl?
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
Sep 24, 2010
As we know, we can rotate a bitmap through 2 ways. The 1st way is: Matrix mt = new Matrix(); mt. postRotate (degree);Bitmap bitmap = CreateBitmap(src, 0, 0, w, h, mt, true); canvs.drawBitmap(bitmap, 0, 0, paint); In this way, we always need create new bitmap for every rotation, it is not good way for high performance game or app.The 2nd way is: canvas.save(); canvas.rotate(degree); canvas.drawBitmap(bitmap, 0, 0, paint); canvas.restore();In this way, we avoid creating new bitmap frequently, but the rotation bitmap is distortion, the bitmap quality is worse than first way.So, Is there 3rd way to rotate bitmap with high performance and good quality? Your any comments are really appreciated!
View 3 Replies
View Related
Jul 22, 2009
I am using bitmap image that i have to rotate on fling. its actually a circular image that will act like a spin wheel. so image resolution is like 1000 x 1000 but when i rotate this image and redraw it android give me an exception " java.lang.OutOfMemoryError: bitmap size exceeds VM budget "
View 2 Replies
View Related
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
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
Feb 18, 2009
All the textures I create from my resource files are fine, but when I create a texture in the following way... <code> mOverlay = Bitmap.createBitmap((int)mWidth, (int)mHeight, Bitmap.Config.ARGB_4444); mOverlay.eraseColor(0); mOverlayCanvas = new Canvas(mOverlay);
...
Canvas c = mOverlayCanvas; c.drawColor(Color.argb(0, 0, 0, 0)); Paint p = new Paint(); p.setColor(Color.RED); c.drawCircle(160, 240, 10, p);
....................
View 4 Replies
View Related
Nov 29, 2009
I am trying to move my code from Java to C, and I have encountered a problem while trying to find a function in C that can take an array of ints and create a bitmap from it for OpenGL. In Java, I used
bitmap = Bitmap.createBitmap( {int array name} , w, h, Config.RGB_565);
Is there a similar function that I can use in C, or a workaround that I could use?
Also, if it matters, I am programming for Android.
View 4 Replies
View Related
Jul 1, 2010
I just bought the Nexus One unlocked for AT&T and really like it. 1 wierd thing is that when I rotate the phone counter clockwise, the screen goes to landscape just fine; but when I rotate it clockwise it does not go to landscape "the other way". And, if I'm holding the phone 'normally' and rotate it 180 degrees ('upside down') it doesn't follow.My youngest daughter delights in telling me that her iPhone does this with no problem. What's up with that?
View 7 Replies
View Related
Oct 2, 2009
I have a HTC Magic (Rogers Canada).And, I see how the Dream (G1) rotates the home screen. can the Magic do that as well? Also, anybody know if it's possible to rotate the screen to the right and not just to the left? Shouldn't the acceleromater detect all the different rotated modes (even upside down?). that'd be cool
View 1 Replies
View Related
Jul 21, 2010
I have a very large image and I only want to display a section the size of the display (no scaling), and the section should just be the center of the image. Because the image is very large I cannot read the entire image into memory and then crop it. This is what I have so far but it will give OutOfMemory for large images. Also I don't think inSampleSize applies because I want to crop the image, not lower the resolution.
Uri data = getIntent().getData();
Input Stream is = getContentResolver().openInputStream(data);
Bitmap bitmap = BitmapFactory.decodeStream(is, null, null);
Any help would be great?
View 3 Replies
View Related
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
Feb 25, 2009
Single Threaded OpenGL game ! (check bottom, you can download and use the helper class) Lighting disabled ! Depth Buffer disabled ! Culling enabled ! Textures disabled !
Just 176 integers (x,y values only) making 88 vertexes along with 132 index numbers making "44 triangles only"
Framerates I get is
with GL_BLENDING disabled - 145 fps approx only! enabled - 110 fps approx only!
I have the screenshot of exact code in the draw function here.. just 2 damn lines ! I have hidden only the comments.. click here to see it http://prasna991.googlepages.com/drawframe.png
variable details in the 2 lines of code =========================== ipts = 176 elements (only x and y for each vertex) totallinetriangles * 3 = 176 lineindexes = 132 elements - type "short"
Here is the screenshot of output drawing and how it will look like http://prasna991.googlepages.com/screen.png
OpenGL single threaded Initialization Helper ================================ Here is my OpenGL helper class.. makes the OpenGL initialization for newbies a cakewalk http://prasna991.googlepages.com/OpenGLHelperclass.txt
I tested by rendering on the touch event only.. frame rate drops only when u touch and drag and here I have just tested by tapping and releasing gently on the emulator and on the device
Is this the device limitations ? So graphics is actually a lot lot lot slower than on iPhone ?
View 8 Replies
View Related
Jul 24, 2010
I would like to be able to use the OpenGL API from both Java and C (via NDK).
In Java, there is a GL object passed, which has all GL methods on it.
In C, you just talk to the native library.
In a single onDrawFrame callback (for which Java is passed a GL), can I use methods on the GL object, and also call NDK methods which access the openGL library?
In other words, is the GL object just a wrapper for the same instance of the native library?
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
Oct 13, 2010
When the AVD screen is in an Eclipse frame there is a button on the frame to rotate orientation. How do I cause the same action when the AVD screen is floating outside Eclipse?
View 4 Replies
View Related
Feb 15, 2010
I am extending the normal android.widget.ProgressBar.This rotates it fine, however I am having alot of sizing issues. It seems as though I have to set the width and the height of the control to be the same thing or else I run into alot of clipping issues. Basically, I want to have a progress bar that, once rotated, is 50dip wide and fills the screen vertically. Can anyone think of a way to do this? Also, it doesn't seem to be actually drawing the progress properly, but I will revisit that once I get the clipping sorted out.
View 4 Replies
View Related
Apr 7, 2009
I need to rotate my view, say a button.I want the button to be 45 degrees rotated, and I want the button to also be functional.I want the touch area to remain only around the button.How can I rotate?
View 5 Replies
View Related
Feb 17, 2009
I want to rotate my view in specified degree, for example 30 degrees, 45 degrees.There is no rotate method in view class, I was trying to rotate its inside canvas, but the view doesn't rotate accordingly.
View 3 Replies
View Related
Jan 29, 2009
I'm fairly new to android development - I'm having trouble finding documentation on how to disable the accelerometer/auto-rotate feature for an app (i.e. when you turn the phone, everything 'corrects' changing the layout). Is it possible to disable in the emulator?
View 2 Replies
View Related
Nov 3, 2009
what i wont for example my g1 is Orentation enable and when my app start with screen rotate 90 then should be no rotating you know help me exam code pls.
View 2 Replies
View Related
Nov 15, 2010
does anyone know of an app that will turn the autorotate on / off from within an app on long search key press (or another key press)?I have searched the market / google and can't find anything..
View 6 Replies
View Related
Jun 28, 2010
Are there any 3rd party apps out there that rotate the screen 180 degrees? I can't seem to find any.Most times, I find it easier to use my Cliq if it is upside down (such as listening to music and charging.)
View 2 Replies
View Related
Feb 2, 2010
I am getting error when I rotate the device (it was HTC with Verizon):
The application My App (process com.mycompany.android) has
stopped unexpectadly. Please try again.
So, I think I need to code for this issue. In order words, when rotate the device from landscape to portable or from portable to landscape, application needs to catch this event.
Is it right ?
How to make it ? What is wrong here ?
Is it possible to test on the emulator ?
View 3 Replies
View Related
Jul 27, 2009
It's actually really easy, and you don't need to use animations. I did something like this recently by using a wrapper layout that adjusts the Canvas and any MotionEvents. (You could also use this approach rotate the entire layout to any arbitrary angle.) I think romainguy told me to use Canvas.concat(mForward) instead of setMatrix(), but I haven't updated the code in awhile...................
View 4 Replies
View Related
Dec 7, 2009
Is there any way to rotate gallery view vertically instead of horizontal.
View 3 Replies
View Related
Jun 27, 2009
I rotate image using setImageMatrix() function. I first use getImageMatrix() function to get matrix then i use matrix.postRotate (90). Rotation works fine. But it rotates around top/left corner of image. i want to change that pivot point to center of the image. how can I do that?
View 3 Replies
View Related
Feb 3, 2010
I have a layout with an image on it (embedded in an ImageView). I need to rotate the image (let's say) 90 degrees CCW. I've written code to animate the image rotating. The image smoothly rotates 90 degrees, but then snaps back to its original state. This is what the Android documentation says will happen after an animation completes. Presumably, on the notification that the animation has ended, I'm supposed to transform the ImageView (or the underlying drawable), and possibly invalidate it to trigger a redraw. All well and good, except that I can't find a way to do it, and I can't find any examples of anyone else doing it. I tried using getImageMatix/setImageMatrix on mImageView, with no apparent effect. There are subclasses of Drawable that will rotate an image, but there is no setDrawable() method on ImageView, so I don't see how to use one.
View 1 Replies
View Related
Oct 12, 2010
I know if you change a android phone from portrait to landscape sometimes the app relays its self out on the screen.. so how do I simulate rotating a phone with the AVD? On the Blackberry emulators there's a button in the menu to turn the phone, but I can't find it or any option on the Android ones?
View 1 Replies
View Related