Android :: Canvas And Its Transformation Matrix Have Different Translation Values

Aug 31, 2010

I might be completely off-base here, but I've spent the last two days trying to figure this out and, without success, you're my only hope.What I'm doing is simple:

* I have a canvas where I draw a circle with center on (10, 10), with radius = 5;

* Then, I obtain the canvas transformation matrix

* And then I create a new rectangle, I map it using the matrix and I use the canvas to draw it.

My problem: basically, the rectangle is being drawn in a different position along the Y-axis.I outputed the transformation matrix and, by default, it is translated by zero in the X-axis and by 25.0 in the Y-axis. Please note that I made NO transformations, either translate, scale or rotate. I am unable to understand why this is happening and how to avoid it.

Android :: Canvas and its transformation matrix have different translation values


Android :: Drawing Canvas With Given Matrix Transformation?

Aug 2, 2009

I got this code from another post and modified it to work for me as a TextView. I tried using the code below but no transformation is happening? I trying to draw the canvas of the TextView with the given Matrix transformation.

import android.content.Context; import android.graphics.Canvas; import android.graphics.Matrix; import android.util.AttributeSet; import android.view.MotionEvent; import android.widget.TextView;
public class CTextView extends TextView { private Matrix mForward = new Matrix(); private Matrix mReverse = new Matrix(); private float[] mTemp = new float[2];
public CTextView(Context context) { super(context); mForward.postRotate(90); mForward.invert(mReverse); } public CTextView(Context context, AttributeSet attrs) { super(context, attrs);
mForward.postRotate(90); mForward.invert(mReverse); } public CTextView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle);
mForward.postRotate(90); mForward.invert(mReverse); }
@Override protected void dispatchDraw(Canvas canvas) { canvas.save(); canvas.concat(mForward); canvas.restore(); super.dispatchDraw(canvas); }
@Override public boolean dispatchTouchEvent(MotionEvent event) { final float[] temp = mTemp; temp[0] = event.getX(); temp[1] = event.getY();
mReverse.mapPoints(temp); event.setLocation(temp[0], temp[1]); return super.dispatchTouchEvent(event); }

View 3 Replies View Related

Android :: Getting Transformation Matrix Of An Animation

Apr 1, 2010

I would like to obtain the transformation matrix of an animation to calculate the position of the view that was animated.It seems the Animation class has a method called getTransformation that can be used to obtain the transformation applied to the view.However, if I use getTransformation before starting the animation I obtain the identity matrix.The program enters an infite loop because getTransformation seems to trigger onAnimationEnd (why?).How should I use getTransformation to obtain the transformation matrix of an animation? Is there another way to do this?

View 1 Replies View Related

Android :: How Does PostScale Affect Translation Part Of Matrix?

Aug 7, 2010

Ive been trying to implement a limit to prevent the user from scaling the image too much in my multitouch zoom app. Problem is, when i set the max zoom level by dumping the matrix, the image starts to translate downward once the overall scale of the image hits my limit. I believe it is doing this because the matrix is still being affected by postScale(theScaleFactorX,theScaleFactorY,myMidpointX,myMidpointY) where theScaleFactorX/Y is the amount to multiply the overall scale of the image (so if the theScaleFatorX/Y is recorded as 1.12, and the image is at .60 of its origional size, the overall zoom is now .67). It seems like some sort of math is going on thats creating this translation, and was wondering if anyone knew what it was so i can prevent it from translating, and only allow the user to zoom back out.

View 1 Replies View Related

Android :: Way To Get Pixel Values From Droid Canvas

Jul 9, 2010

I'm currently writing an Android game using surfaceView. I've optimized the game as much as possible and it runs quite smoothly. However, I have collision detection incorporated which is a bit messy. I would like to do collision detection by reading pixels directly from the canvas. Is this possible to do? The closest to this that I have found was to attach a new bitmap to the canvas using setBitmap. Then when I drew to the canvas, the bitmap would be updated. Would this be the way to go?

View 2 Replies View Related

Android :: Get Pixel Color Values Of Canvas / How To Check That Object Reached Upto Boundary

Jun 16, 2009

How can I get Pixel color of a coordinate? There is no method like canvas.getColor(x,y).

Actually, I am new to game developement. I am developing a Game which will restrict object if it comes to that boundary like in pac-man. How can I check that object has reached upto the boundary?

View 2 Replies View Related

Android :: Reset Canvas - Draw A New Bitmap Into The Canvas

Jul 7, 2010

My loadMap() method generate a canvas.throwIfRecycled exception when i try to load a new map.
When i start the game, the initial map loads and work fine though,
its only when i try to load a new map that i get the exception ..

How can i "reset" canvas and the bitmap i use to draw into, so i can startover fresh with them ?
here's what i use to create and draw my maps:

CODE:.........

So basicaly once i created and used picDest and canvas, i cannot figure how to reset it all for when i want to load a new map..

View 1 Replies View Related

Android :: XSLT Transformation Or Other Mechanism For Converting SVG Drawing?

Jun 3, 2010

I'm wondering how vector drawing in Android with the Shape class may resemble another vector drawing standard. Since Shape is a Drawable, and Drawables are usually defined as XML, it sounds a lot like the vector drawing commands in SVG. My question is this: Has anybody created an XSLT transformation, or other mechanism, for converting an SVG drawing description into Android Shapes?

View 3 Replies View Related

Android : Way To Resize Layout After An Image Transformation Droid?

Oct 11, 2010

I have a layout in which I resize an image by doing a transformation with prescale. After the scale the image has the right size, but the layout container around it cuts its size of. I want the layout container arround it to show to complete image. I just tried invalidate on the image, the container as well as requestLayout().

View 1 Replies View Related

General :: How To Edit Default Values Of Memory Min-free Values Of Rom Reside

Apr 9, 2014

I want to ask where does the defaults values of memory min-free values of a Rom reside? I mean what file I would have to edit to edit those values?

View 1 Replies View Related

Android :: Translation Tools Available?

Sep 25, 2010

I am just going through a translation of resource files and I am wondering if there is additional support. At the moment I have both the base strings.xml and the localised version opened parallel in Eclipse. This quite works, but I am thinking of the following tools: - Showing both (or more) versions of a key together - Showing missing keys in a version - Integrating a lookup service (Google Translate, Wikipedia). I didn't find anything like this, is such a tool available?

View 3 Replies View Related

Android :: J2ME Converting/translation

Apr 25, 2010

I want to know if exists a converter for a j2me source-code to android. Listen, itīs not a runner, like a midp runner for android, it īs a converter for a source code. A tool for translate a source code for a new plataform, from j2me to android.

View 6 Replies View Related

Android :: Translation App Use In Europe Without Connection?

Jul 9, 2010

I understand EVO 4G is CDMA thus can't be used roaming in European countries say in Germany (mostly GSM I believe).
Is there a way to still use "Google Translate" without connection? (is there another translation app, which can be completely downloaded to SD Card and can be used without 3g or wifi ?)

View 1 Replies View Related

Android :: Translation App That Works Offline?

Aug 19, 2010

Google Translate is great, but it's crippling fault is that it needs a data connection to work. Obviously the only time I am going to need language translation tools, is the same time I don't want to pay for roaming data access!!

Are there any good (and preferably free, or minimal cost) language apps for Android that work offline? I need English > Italian initially, but the major languages would need to be supported too.

View 1 Replies View Related

Android :: Have Translation Service In Droid App?

Feb 24, 2010

How can a translation service be called in an Android app? Can we have an app that can translate multiple languages into another?

View 3 Replies View Related

Android :: Translation Animation In Code?

Jun 23, 2010

I was able to get the animation to work on the emulator -- however my problem is that it animates for a second, but then then goes back to its original posistion right after it finishes animating. How can I stop this for happening.

This is how I animate my objects:

CODE:.................

View 2 Replies View Related

Android :: Instant Dictionary Translation Interface

Jun 27, 2010

Is there such a thing in Android...? For example, I'm writing an email and would like to lookup a word, but don't want to switch to the other app, is there an app which can invoke the dictionary within another app...?

View 3 Replies View Related

Android :: Efficient Matrix Library

Jun 21, 2010

Is there any efficient linear algebra library for android? I need to compute matrices of different sizes(also bigger than 4x4) and rectangular too.

View 1 Replies View Related

Android :: How Would I Create Equivalent Matrix Using Sdk?

Aug 20, 2010

Suppose I initialize an AffineTransform as below:AffineTransform af = new AffineTransform(2, 3, 4, 5, 6, 7); How would I create an equivalent Matrix using android's sdk?

View 1 Replies View Related

Android :: AR Get Rotation Matrix / Camera Overlay?

Feb 23, 2010

I spend two weeks now trying to get this working with no success. Here is what I want to do: I have several geo points around the user and his phone. I want to display this point overlaying them on the input from the camera (kind of standard AR (Augmented Reality) app). Part of my requirements are that the user can use the phone in either landscape or portrait mode.My plan was like this.
1. Register for Sensor.TYPE_ACCELEROMETER, Sensor.TYPE_MAGNETIC_FIELD 2. Pass the result to Sensor Manager.getRotationMatrix(), getting back the R matrix that should be telling me how to translate points from the Phone coordinate system (defined here: http://developer.android.com/reference/android/hardware/SensorEvent.html) to World coordinate system (x -> East, y -> North, z -> Sky) 3. I want to translate points from World to Phone so I take the inverse of R (I'm using Matrix.invertM()) to get R_In 4. Using the GPS I translate the geo points I want to display on the camera to points in the World coordinate system and then I run them through the R_In matrix to get their coordinates in the Phone system. 5. Draw the points in the screen only if the have (phone coordinates) z < 0 and x and y such that they are visible. This is my grand plan... however I have problems quite early (2). I do get the R matrix back and it looks good when I align the phone to the world coordinate system ( I get the identity matrix ). However when I try to translate an imaginary point from the Phone coordinate system say (0, 1, 0) to the World coordinate system I don't get the numbers I expect.

View 2 Replies View Related

Android :: Matrix.rotateM Does Heap Allocations

Sep 24, 2010

Are you meticulous in removing all per-frame heap allocations from your game? (At least the allocations that you can control and that have practical alternatives.)

While trying to reduce per-frame heap allocations from my running game, I found that method

android.opengl.Matrix rotateM(float[] m, int mOffset, float a, float x, float y, float z)

Does a heap allocation. This means maybe 10 or so extra heap allocations per frame and is the only per-frame allocation left in my application (well, the only one that I can directly control). I am thinking of replacing this with my own version - one that does not do any heap allocations.

I also had some lists that I replaced with my own list implementation because I found that some standard list iterations would create new iteration objects, putting more pressure on the heap and forcing more frequent garbage collection.

I know that I can't eliminate all the heap allocations. In particular, input seems to trigger a bunch of allocations.

I can't help but think that anything reasonable I can do to reduce pressure on the heap will improve the user's experience (if garbage collection is going to stall my game). Obviously there are diminishing returns at some point, so ultimately I have to make a judgement call.

View 8 Replies View Related

Android :: Kernel / Userland Input Events Translation Process

Oct 22, 2009

I am now learning how android handles linux input events from kernel raw input events to the userland level KeyEvent and so on. And I want to handle input events in native language. I've do some experiments on handling events using NDK but the touch screen events are very hard to handle(when I touch the screen, It generates a lot of kernel events).

I've read the eventhub class in framework base dir in the android source repo. And I now I know how android collects linux kernel raw events using eventhub class by reading from /dev/input/event* , but I still have no idea how it translates these raw events into the userland logic input events like KeyEvent. The file keyinput service only wrappers eventhub to JNI functions but there are no translation. So please give me some hints on the kernel event and userland event translation process.

View 3 Replies View Related

Android :: Use An OpenCV Rotation And Translation Vector With OpenGL ES In Droid?

Sep 14, 2010

I'm am working on a basic augmented reality application on Android. What I did so far is detect a square with opencv and then using cvFindExtrinsicCameraParams2() I calculated a rotation and translation vector. For this I used 4 object points, which are just the corners of a square around (0,0,0) and the 4 corners of the square in the image.

This yields me a pretty good rotation and translation matrix. I also calculated the rotation matrix with cvRodrigues2() since using this is easier than the rotation vector. As long as I use these to draw some points in the image everything works fine. My next step is however to pass these vectors and the matrix back to java and then use them with OpenGL to draw a square in an OpenGLView. The square should be exactly around the square in the image which is displayed behind the OpenGLView.

My problem is that I cannot find the correct way of using the rotation matrix and translation vector in OpenGL. I started of with exactly the same object points as used for the openCV functions. Then I applied the rotation matrix and translation vector in pretty much any possible way I could think of. Sadly none of these approaches produce a result which is anyway near what I hoped for. So my question is can anyone tell me how to use them correctly?

So far the "closest" results I have gotten, was when randomly multiplying the whole matrix with -1. But most of the time the squares still look mirror inverted or rotated for 180 degrees. So I guess it was just a lucky hit, but not the right approach.

View 1 Replies View Related

Android :: Build A Language Translation Tool For Smart Phones?

Nov 8, 2010

I am implementing a language conversion tool, to convert Spanish to English, on a variety of smart phones: Android, BlackBerry, iPhone, Windows Phone 7.

How do I implement language conversions? Searching, I am not finding a tutorial about this, and I don't having any experience with this.

View 1 Replies View Related

General :: No Menu In Translation App?

May 18, 2013

I have the Google Translate app on my Samsung Galaxy Tablet (running ICS) and it works great, including the offline. I also have it on my Samsung Galaxy Ace phone (running Gingerbread 2.3.7) but I cannot even see a menu option (whichis needed to use the offline facility) on the phone version. I have downloaded the latest verions from Google Play. Review of Google Translate say the offline bit shuld work with Android 2.3 and later..

View 2 Replies View Related

Android :: OpenGL Works Incorrectly When Projection Matrix Is Set To Identity?

Jun 23, 2010

I have an OpenGL app that manipulates it's geometry in screen space to acheive some effects, and therefore bypasses OpenGL's matrices by setting modelview and projection to identity. For some reason, Android's OpenGL implementation seems to be unhappy with this, and doesn't draw anything. The same app, compiled from the same code base, works fine on windows and on iPhone. If I load the app's projection matrix into GL's matrix, and multiply it's inverse with the final geometry prior to drawing it (which is effectively a no-op) it displays correctly.

View 6 Replies View Related

General :: HTC Legend - Twitter And Translation Functionality?

Jan 26, 2012

I'm interested in having a Twitter app in my HTC legend in order to translate some tweets, if possible Japanese tweets.

Last year I was using TweetDeck wich translated the tweets, even from Japanese in English, but I know don't why, since september i'm unable to translate them anymore.Twitter app on Android with the translation functionality ? (To translate from Japanese if possible)

View 1 Replies View Related

HTC Incredible :: PenTile Matrix Confirmed

Apr 29, 2010

Just wanted to let folks know I put my Incredible under an inspection scope today and confirmed the PenTile matrix layout is present on the AMOLED screen, similar to the Nexus One. Not a big surprise since it's probably the same stock screen acquired from Samsung, but I thought I'd let everyone know for certain. If you're not familiar with the PenTile matrix arrangement:I'll try to get some real high mag pictures, but it's basically as shown in the first link.Picture of the Incredible's AMOLED screen under high mag.

View 2 Replies View Related

General :: How To Root Matrix 2 On MacBook Pro

Apr 22, 2012

I am super new and I want to root my matrix 2 on my MacBook pro any

View 2 Replies View Related

Sprint HTC Hero :: Launcher From Matrix Rom Not Installing?

Apr 7, 2010

I'm using Matrix 0.6 rom,and it's AOSP based, so it had landscape launcher and android keyboard. I was successfully able to pull the .apk for the keyboard, and install it on a different rom, but for the launcher, it failed. Anyone have any ideas?

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved