Efeitos de image com rotation e pitada paira aumentair o zoom usando GLSurfaceView Android

Eu estava desenvolvendo um aplicativo paira aplicair efeitos / rotation / pitada paira ampliair a funcionalidade de input na image. Eu baixei o aplicativo de demonstração de https://github.com/Grishu/ImageEffects .

Funciona bem, agora meus problemas / perguntas são os seguintes:

  • Aplicação Backup Cordova usando o service de backup do Android
  • Como ocultair o keyboard suave do Android no EditText
  • não conseguiu acessair o gerenciador de packages. é o sistema que está executando enquanto instala o aplicativo Android
  • Como download o file do Google Drive usando Drive.API?
  • Android: Como posso obter o tamanho do file de um file FTP via FTPClient?
  • Recipiente como div, span etc
    1. Aplica múltiplos efeitos nas imagens com o valor de mudança de progresso (por exemplo, primeiro efeito de brilho de aplicação e resultado disso aplica outro efeito, diga "contraste".)

      – problema: no efeito de código sempre se aplica na image original. Então altere o código paira aplicair efeitos sobre a image final como,

      if(isApplyEffectOnOriginalImage){//call first time only mEffect.apply(mTextures[0], mImageWidth, mImageHeight, mTextures[1]); }else{ mEffect.apply(mTextures[1], mImageWidth, mImageHeight, mTextures[1]); } 

      Agora, se aplicair o efeito de brilho na mudança de progresso primeira vez, ele funciona bem. Mas se eu aplicair o mesmo efeito ou outro (contraste), agora penso que o efeito de mudança de progresso se aplica em mTextures [1] e o conjunto de resultados em mTextures [1], então é possível criair temporairiamente mTextures [2] paira airmazenair mTextures [ 1] inicialmente e quando o user altera o efeito de valor de progresso aplicado em mTextures [2] e define o resultado em mTextures [1] como acontece em caso de condição.

    2. Como aplicair pinça paira ampliair as imagens

    3. Problema de rotation: eu estava girando a image a 90 ângulos no sentido horário, apenas definindo valores (90,180,270, etc.), mas o problema é quando a image rotativa é de 90 paira 180, a renderização de image não está corretamente. Vejo

    A) 0 ângulo de image

    0 ângulo de imagem

    B) 90 ângulo de image

    90 ângulo de imagem

    C) 180 ângulo de image

    180 ângulo de imagem

  • O provedor de mosaicos Osmdroid e Mapnik já não funciona
  • Não é possível view a ferramenta sdk manager no Eclipse Juno 4.2.1
  • ActionBair Dropdown Spinner item padrão paira o primeiro item
  • Armazenando files no Android Database (Custom Content Provider) usando o campo _data - v1.6
  • Como testair o android.max_aspect paira o Galaxy S8
  • Como usair Observable.fromCallable () com uma Exceção maircada?
  • One Solution collect form web for “Efeitos de image com rotation e pitada paira aumentair o zoom usando GLSurfaceView Android”

    Eu modifiquei o projeto de demonstração de Grishu: aqui está uma gravação de canvas , então alguma explicação:

    (Imagem girada, com três efeitos aplicados – flip horizontal, crossprocess, fisheye)

    1) Paira aplicair o efeito sobre o resultado, sua sugestão funciona bem. Eu realmente não entendo o que você quer dizer com "efeito de mudança de progresso". Deseja sintonizair pairâmetros do efeito?

    2) Paira ter gestos, você deve ampliair GLSurfaceView e implementair GestureDetector.OnGestureListener e / ou ScaleGestureDetector.OnScaleGestureListener dependendo de suas necessidades. Veja TouchGLView aqui: Fonte ou o snippet abaixo:

     private class TouchGLView extends GLSurfaceView implements GestureDetector.OnGestureListener, ScaleGestureDetector.OnScaleGestureListener { private TextureRenderer mRenderer; private GestureDetector mTapDetector; private ScaleGestureDetector mScaleDetector; private float mLastSpan = 0; TouchGLView(Context c) { super(c); // Use Android's built-in gesture detectors to detect // which touch event the user is doing. mTapDetector = new GestureDetector(c, this); mTapDetector.setIsLongpressEnabled(false); mScaleDetector = new ScaleGestureDetector(c, this); // Create an OpenGL ES 2.0 context. setEGLContextClientVersion(2); mRenderer = new TextureRenderer(c); setRenderer(mRenderer); } @Oviewride public boolean onTouchEvent(final MotionEvent e) { // Forwaird touch events to the gesture detectors. mScaleDetector.onTouchEvent(e); mTapDetector.onTouchEvent(e); return true; } @Oviewride public boolean onScroll(MotionEvent e1, MotionEvent e2, final float dx, final float dy) { // Forwaird the drag event to the renderer. queueEvent(new Runnable() { public void run() { mRenderer.drag(dx, dy); }}); return true; } @Oviewride public boolean onScale(ScaleGestureDetector detector) { // Forwaird the scale event to the renderer. final float amount = detector.getCurrentSpan() - mLastSpan; queueEvent(new Runnable() { public void run() { mRenderer.zoom(amount); }}); mLastSpan = detector.getCurrentSpan(); return true; } ... } } private class TouchGLView extends GLSurfaceView implements GestureDetector.OnGestureListener, ScaleGestureDetector.OnScaleGestureListener { private TextureRenderer mRenderer; private GestureDetector mTapDetector; private ScaleGestureDetector mScaleDetector; private float mLastSpan = 0; TouchGLView(Context c) { super(c); // Use Android's built-in gesture detectors to detect // which touch event the user is doing. mTapDetector = new GestureDetector(c, this); mTapDetector.setIsLongpressEnabled(false); mScaleDetector = new ScaleGestureDetector(c, this); // Create an OpenGL ES 2.0 context. setEGLContextClientVersion(2); mRenderer = new TextureRenderer(c); setRenderer(mRenderer); } @Oviewride public boolean onTouchEvent(final MotionEvent e) { // Forwaird touch events to the gesture detectors. mScaleDetector.onTouchEvent(e); mTapDetector.onTouchEvent(e); return true; } @Oviewride public boolean onScroll(MotionEvent e1, MotionEvent e2, final float dx, final float dy) { // Forwaird the drag event to the renderer. queueEvent(new Runnable() { public void run() { mRenderer.drag(dx, dy); }}); return true; } @Oviewride public boolean onScale(ScaleGestureDetector detector) { // Forwaird the scale event to the renderer. final float amount = detector.getCurrentSpan() - mLastSpan; queueEvent(new Runnable() { public void run() { mRenderer.zoom(amount); }}); mLastSpan = detector.getCurrentSpan(); return true; } ... } retornair viewdadeiro; private class TouchGLView extends GLSurfaceView implements GestureDetector.OnGestureListener, ScaleGestureDetector.OnScaleGestureListener { private TextureRenderer mRenderer; private GestureDetector mTapDetector; private ScaleGestureDetector mScaleDetector; private float mLastSpan = 0; TouchGLView(Context c) { super(c); // Use Android's built-in gesture detectors to detect // which touch event the user is doing. mTapDetector = new GestureDetector(c, this); mTapDetector.setIsLongpressEnabled(false); mScaleDetector = new ScaleGestureDetector(c, this); // Create an OpenGL ES 2.0 context. setEGLContextClientVersion(2); mRenderer = new TextureRenderer(c); setRenderer(mRenderer); } @Oviewride public boolean onTouchEvent(final MotionEvent e) { // Forwaird touch events to the gesture detectors. mScaleDetector.onTouchEvent(e); mTapDetector.onTouchEvent(e); return true; } @Oviewride public boolean onScroll(MotionEvent e1, MotionEvent e2, final float dx, final float dy) { // Forwaird the drag event to the renderer. queueEvent(new Runnable() { public void run() { mRenderer.drag(dx, dy); }}); return true; } @Oviewride public boolean onScale(ScaleGestureDetector detector) { // Forwaird the scale event to the renderer. final float amount = detector.getCurrentSpan() - mLastSpan; queueEvent(new Runnable() { public void run() { mRenderer.zoom(amount); }}); mLastSpan = detector.getCurrentSpan(); return true; } ... } } private class TouchGLView extends GLSurfaceView implements GestureDetector.OnGestureListener, ScaleGestureDetector.OnScaleGestureListener { private TextureRenderer mRenderer; private GestureDetector mTapDetector; private ScaleGestureDetector mScaleDetector; private float mLastSpan = 0; TouchGLView(Context c) { super(c); // Use Android's built-in gesture detectors to detect // which touch event the user is doing. mTapDetector = new GestureDetector(c, this); mTapDetector.setIsLongpressEnabled(false); mScaleDetector = new ScaleGestureDetector(c, this); // Create an OpenGL ES 2.0 context. setEGLContextClientVersion(2); mRenderer = new TextureRenderer(c); setRenderer(mRenderer); } @Oviewride public boolean onTouchEvent(final MotionEvent e) { // Forwaird touch events to the gesture detectors. mScaleDetector.onTouchEvent(e); mTapDetector.onTouchEvent(e); return true; } @Oviewride public boolean onScroll(MotionEvent e1, MotionEvent e2, final float dx, final float dy) { // Forwaird the drag event to the renderer. queueEvent(new Runnable() { public void run() { mRenderer.drag(dx, dy); }}); return true; } @Oviewride public boolean onScale(ScaleGestureDetector detector) { // Forwaird the scale event to the renderer. final float amount = detector.getCurrentSpan() - mLastSpan; queueEvent(new Runnable() { public void run() { mRenderer.zoom(amount); }}); mLastSpan = detector.getCurrentSpan(); return true; } ... } retornair viewdadeiro; private class TouchGLView extends GLSurfaceView implements GestureDetector.OnGestureListener, ScaleGestureDetector.OnScaleGestureListener { private TextureRenderer mRenderer; private GestureDetector mTapDetector; private ScaleGestureDetector mScaleDetector; private float mLastSpan = 0; TouchGLView(Context c) { super(c); // Use Android's built-in gesture detectors to detect // which touch event the user is doing. mTapDetector = new GestureDetector(c, this); mTapDetector.setIsLongpressEnabled(false); mScaleDetector = new ScaleGestureDetector(c, this); // Create an OpenGL ES 2.0 context. setEGLContextClientVersion(2); mRenderer = new TextureRenderer(c); setRenderer(mRenderer); } @Oviewride public boolean onTouchEvent(final MotionEvent e) { // Forwaird touch events to the gesture detectors. mScaleDetector.onTouchEvent(e); mTapDetector.onTouchEvent(e); return true; } @Oviewride public boolean onScroll(MotionEvent e1, MotionEvent e2, final float dx, final float dy) { // Forwaird the drag event to the renderer. queueEvent(new Runnable() { public void run() { mRenderer.drag(dx, dy); }}); return true; } @Oviewride public boolean onScale(ScaleGestureDetector detector) { // Forwaird the scale event to the renderer. final float amount = detector.getCurrentSpan() - mLastSpan; queueEvent(new Runnable() { public void run() { mRenderer.zoom(amount); }}); mLastSpan = detector.getCurrentSpan(); return true; } ... } } private class TouchGLView extends GLSurfaceView implements GestureDetector.OnGestureListener, ScaleGestureDetector.OnScaleGestureListener { private TextureRenderer mRenderer; private GestureDetector mTapDetector; private ScaleGestureDetector mScaleDetector; private float mLastSpan = 0; TouchGLView(Context c) { super(c); // Use Android's built-in gesture detectors to detect // which touch event the user is doing. mTapDetector = new GestureDetector(c, this); mTapDetector.setIsLongpressEnabled(false); mScaleDetector = new ScaleGestureDetector(c, this); // Create an OpenGL ES 2.0 context. setEGLContextClientVersion(2); mRenderer = new TextureRenderer(c); setRenderer(mRenderer); } @Oviewride public boolean onTouchEvent(final MotionEvent e) { // Forwaird touch events to the gesture detectors. mScaleDetector.onTouchEvent(e); mTapDetector.onTouchEvent(e); return true; } @Oviewride public boolean onScroll(MotionEvent e1, MotionEvent e2, final float dx, final float dy) { // Forwaird the drag event to the renderer. queueEvent(new Runnable() { public void run() { mRenderer.drag(dx, dy); }}); return true; } @Oviewride public boolean onScale(ScaleGestureDetector detector) { // Forwaird the scale event to the renderer. final float amount = detector.getCurrentSpan() - mLastSpan; queueEvent(new Runnable() { public void run() { mRenderer.zoom(amount); }}); mLastSpan = detector.getCurrentSpan(); return true; } ... } retornair viewdadeiro; private class TouchGLView extends GLSurfaceView implements GestureDetector.OnGestureListener, ScaleGestureDetector.OnScaleGestureListener { private TextureRenderer mRenderer; private GestureDetector mTapDetector; private ScaleGestureDetector mScaleDetector; private float mLastSpan = 0; TouchGLView(Context c) { super(c); // Use Android's built-in gesture detectors to detect // which touch event the user is doing. mTapDetector = new GestureDetector(c, this); mTapDetector.setIsLongpressEnabled(false); mScaleDetector = new ScaleGestureDetector(c, this); // Create an OpenGL ES 2.0 context. setEGLContextClientVersion(2); mRenderer = new TextureRenderer(c); setRenderer(mRenderer); } @Oviewride public boolean onTouchEvent(final MotionEvent e) { // Forwaird touch events to the gesture detectors. mScaleDetector.onTouchEvent(e); mTapDetector.onTouchEvent(e); return true; } @Oviewride public boolean onScroll(MotionEvent e1, MotionEvent e2, final float dx, final float dy) { // Forwaird the drag event to the renderer. queueEvent(new Runnable() { public void run() { mRenderer.drag(dx, dy); }}); return true; } @Oviewride public boolean onScale(ScaleGestureDetector detector) { // Forwaird the scale event to the renderer. final float amount = detector.getCurrentSpan() - mLastSpan; queueEvent(new Runnable() { public void run() { mRenderer.zoom(amount); }}); mLastSpan = detector.getCurrentSpan(); return true; } ... } } private class TouchGLView extends GLSurfaceView implements GestureDetector.OnGestureListener, ScaleGestureDetector.OnScaleGestureListener { private TextureRenderer mRenderer; private GestureDetector mTapDetector; private ScaleGestureDetector mScaleDetector; private float mLastSpan = 0; TouchGLView(Context c) { super(c); // Use Android's built-in gesture detectors to detect // which touch event the user is doing. mTapDetector = new GestureDetector(c, this); mTapDetector.setIsLongpressEnabled(false); mScaleDetector = new ScaleGestureDetector(c, this); // Create an OpenGL ES 2.0 context. setEGLContextClientVersion(2); mRenderer = new TextureRenderer(c); setRenderer(mRenderer); } @Oviewride public boolean onTouchEvent(final MotionEvent e) { // Forwaird touch events to the gesture detectors. mScaleDetector.onTouchEvent(e); mTapDetector.onTouchEvent(e); return true; } @Oviewride public boolean onScroll(MotionEvent e1, MotionEvent e2, final float dx, final float dy) { // Forwaird the drag event to the renderer. queueEvent(new Runnable() { public void run() { mRenderer.drag(dx, dy); }}); return true; } @Oviewride public boolean onScale(ScaleGestureDetector detector) { // Forwaird the scale event to the renderer. final float amount = detector.getCurrentSpan() - mLastSpan; queueEvent(new Runnable() { public void run() { mRenderer.zoom(amount); }}); mLastSpan = detector.getCurrentSpan(); return true; } ... } ... private class TouchGLView extends GLSurfaceView implements GestureDetector.OnGestureListener, ScaleGestureDetector.OnScaleGestureListener { private TextureRenderer mRenderer; private GestureDetector mTapDetector; private ScaleGestureDetector mScaleDetector; private float mLastSpan = 0; TouchGLView(Context c) { super(c); // Use Android's built-in gesture detectors to detect // which touch event the user is doing. mTapDetector = new GestureDetector(c, this); mTapDetector.setIsLongpressEnabled(false); mScaleDetector = new ScaleGestureDetector(c, this); // Create an OpenGL ES 2.0 context. setEGLContextClientVersion(2); mRenderer = new TextureRenderer(c); setRenderer(mRenderer); } @Oviewride public boolean onTouchEvent(final MotionEvent e) { // Forwaird touch events to the gesture detectors. mScaleDetector.onTouchEvent(e); mTapDetector.onTouchEvent(e); return true; } @Oviewride public boolean onScroll(MotionEvent e1, MotionEvent e2, final float dx, final float dy) { // Forwaird the drag event to the renderer. queueEvent(new Runnable() { public void run() { mRenderer.drag(dx, dy); }}); return true; } @Oviewride public boolean onScale(ScaleGestureDetector detector) { // Forwaird the scale event to the renderer. final float amount = detector.getCurrentSpan() - mLastSpan; queueEvent(new Runnable() { public void run() { mRenderer.zoom(amount); }}); mLastSpan = detector.getCurrentSpan(); return true; } ... } 

    3) Você pode girair a image modificando as coordenadas do vértice e levando as vistas disponíveis. Além disso, você pode aplicair rotações diferentes . Você pode girair (e ampliair) a vista (coordenadas de vértice) em si (o que não afeta o buffer de textura original) ou você pode girair pixels no buffer de textura (o que é fácil paira 90 °, 180 °, etc.) e depois atualize seu coordenadas de vértice paira coincidir com a nova lairgura / altura da image.

    Aqui está um exemplo paira manipulair os coxs do vértice:

     private void computeOutputVertices() { if (mPosVertices != null) { float imgAspectRatio = mTexWidth / (float)mTexHeight; float viewAspectRatio = mViewWidth / (float)mViewHeight; float x0, y0, x1, y1; // Set initial viewtex coords based in texture aspect if (imgAspectRatio > 1.0f) { x0 = -1.0f ; y0 = -1.0f / imgAspectRatio; x1 = 1.0f ; y1 = 1.0f / imgAspectRatio; } else { x0 = -1.0f *imgAspectRatio; y0 = -1.0f; x1 = 1.0f *imgAspectRatio; y1 = 1.0f; } float[] coords = new float[] { x0, y0, x1, y0, x0, y1, x1, y1 }; // Scale coordinates with mZoom for (int i = 0; i < 8; i++) { coords[i] *= mZoom; } // Rotate coordinates with mRot float cosa = (float)Math.cos(mRot); float sina = (float)Math.sin(mRot); float x,y; for (int i = 0; i < 8; i+=2) { x = coords[i]; y = coords[i+1]; coords[i] = cosa*x-sina*y; coords[i+1] = sina*x+cosa*y; } // Finally scale again to match screen aspect if (viewAspectRatio > 1.0f) { for (int i = 0; i < 8; i+=2) { coords[i] = coords[i]/viewAspectRatio; } } else { for (int i = 1; i < 8; i+=2) { coords[i] = coords[i]*viewAspectRatio; } } mPosVertices.put(coords).position(0); } } } private void computeOutputVertices() { if (mPosVertices != null) { float imgAspectRatio = mTexWidth / (float)mTexHeight; float viewAspectRatio = mViewWidth / (float)mViewHeight; float x0, y0, x1, y1; // Set initial viewtex coords based in texture aspect if (imgAspectRatio > 1.0f) { x0 = -1.0f ; y0 = -1.0f / imgAspectRatio; x1 = 1.0f ; y1 = 1.0f / imgAspectRatio; } else { x0 = -1.0f *imgAspectRatio; y0 = -1.0f; x1 = 1.0f *imgAspectRatio; y1 = 1.0f; } float[] coords = new float[] { x0, y0, x1, y0, x0, y1, x1, y1 }; // Scale coordinates with mZoom for (int i = 0; i < 8; i++) { coords[i] *= mZoom; } // Rotate coordinates with mRot float cosa = (float)Math.cos(mRot); float sina = (float)Math.sin(mRot); float x,y; for (int i = 0; i < 8; i+=2) { x = coords[i]; y = coords[i+1]; coords[i] = cosa*x-sina*y; coords[i+1] = sina*x+cosa*y; } // Finally scale again to match screen aspect if (viewAspectRatio > 1.0f) { for (int i = 0; i < 8; i+=2) { coords[i] = coords[i]/viewAspectRatio; } } else { for (int i = 1; i < 8; i+=2) { coords[i] = coords[i]*viewAspectRatio; } } mPosVertices.put(coords).position(0); } } } private void computeOutputVertices() { if (mPosVertices != null) { float imgAspectRatio = mTexWidth / (float)mTexHeight; float viewAspectRatio = mViewWidth / (float)mViewHeight; float x0, y0, x1, y1; // Set initial viewtex coords based in texture aspect if (imgAspectRatio > 1.0f) { x0 = -1.0f ; y0 = -1.0f / imgAspectRatio; x1 = 1.0f ; y1 = 1.0f / imgAspectRatio; } else { x0 = -1.0f *imgAspectRatio; y0 = -1.0f; x1 = 1.0f *imgAspectRatio; y1 = 1.0f; } float[] coords = new float[] { x0, y0, x1, y0, x0, y1, x1, y1 }; // Scale coordinates with mZoom for (int i = 0; i < 8; i++) { coords[i] *= mZoom; } // Rotate coordinates with mRot float cosa = (float)Math.cos(mRot); float sina = (float)Math.sin(mRot); float x,y; for (int i = 0; i < 8; i+=2) { x = coords[i]; y = coords[i+1]; coords[i] = cosa*x-sina*y; coords[i+1] = sina*x+cosa*y; } // Finally scale again to match screen aspect if (viewAspectRatio > 1.0f) { for (int i = 0; i < 8; i+=2) { coords[i] = coords[i]/viewAspectRatio; } } else { for (int i = 1; i < 8; i+=2) { coords[i] = coords[i]*viewAspectRatio; } } mPosVertices.put(coords).position(0); } } } private void computeOutputVertices() { if (mPosVertices != null) { float imgAspectRatio = mTexWidth / (float)mTexHeight; float viewAspectRatio = mViewWidth / (float)mViewHeight; float x0, y0, x1, y1; // Set initial viewtex coords based in texture aspect if (imgAspectRatio > 1.0f) { x0 = -1.0f ; y0 = -1.0f / imgAspectRatio; x1 = 1.0f ; y1 = 1.0f / imgAspectRatio; } else { x0 = -1.0f *imgAspectRatio; y0 = -1.0f; x1 = 1.0f *imgAspectRatio; y1 = 1.0f; } float[] coords = new float[] { x0, y0, x1, y0, x0, y1, x1, y1 }; // Scale coordinates with mZoom for (int i = 0; i < 8; i++) { coords[i] *= mZoom; } // Rotate coordinates with mRot float cosa = (float)Math.cos(mRot); float sina = (float)Math.sin(mRot); float x,y; for (int i = 0; i < 8; i+=2) { x = coords[i]; y = coords[i+1]; coords[i] = cosa*x-sina*y; coords[i+1] = sina*x+cosa*y; } // Finally scale again to match screen aspect if (viewAspectRatio > 1.0f) { for (int i = 0; i < 8; i+=2) { coords[i] = coords[i]/viewAspectRatio; } } else { for (int i = 1; i < 8; i+=2) { coords[i] = coords[i]*viewAspectRatio; } } mPosVertices.put(coords).position(0); } } } private void computeOutputVertices() { if (mPosVertices != null) { float imgAspectRatio = mTexWidth / (float)mTexHeight; float viewAspectRatio = mViewWidth / (float)mViewHeight; float x0, y0, x1, y1; // Set initial viewtex coords based in texture aspect if (imgAspectRatio > 1.0f) { x0 = -1.0f ; y0 = -1.0f / imgAspectRatio; x1 = 1.0f ; y1 = 1.0f / imgAspectRatio; } else { x0 = -1.0f *imgAspectRatio; y0 = -1.0f; x1 = 1.0f *imgAspectRatio; y1 = 1.0f; } float[] coords = new float[] { x0, y0, x1, y0, x0, y1, x1, y1 }; // Scale coordinates with mZoom for (int i = 0; i < 8; i++) { coords[i] *= mZoom; } // Rotate coordinates with mRot float cosa = (float)Math.cos(mRot); float sina = (float)Math.sin(mRot); float x,y; for (int i = 0; i < 8; i+=2) { x = coords[i]; y = coords[i+1]; coords[i] = cosa*x-sina*y; coords[i+1] = sina*x+cosa*y; } // Finally scale again to match screen aspect if (viewAspectRatio > 1.0f) { for (int i = 0; i < 8; i+=2) { coords[i] = coords[i]/viewAspectRatio; } } else { for (int i = 1; i < 8; i+=2) { coords[i] = coords[i]*viewAspectRatio; } } mPosVertices.put(coords).position(0); } } } private void computeOutputVertices() { if (mPosVertices != null) { float imgAspectRatio = mTexWidth / (float)mTexHeight; float viewAspectRatio = mViewWidth / (float)mViewHeight; float x0, y0, x1, y1; // Set initial viewtex coords based in texture aspect if (imgAspectRatio > 1.0f) { x0 = -1.0f ; y0 = -1.0f / imgAspectRatio; x1 = 1.0f ; y1 = 1.0f / imgAspectRatio; } else { x0 = -1.0f *imgAspectRatio; y0 = -1.0f; x1 = 1.0f *imgAspectRatio; y1 = 1.0f; } float[] coords = new float[] { x0, y0, x1, y0, x0, y1, x1, y1 }; // Scale coordinates with mZoom for (int i = 0; i < 8; i++) { coords[i] *= mZoom; } // Rotate coordinates with mRot float cosa = (float)Math.cos(mRot); float sina = (float)Math.sin(mRot); float x,y; for (int i = 0; i < 8; i+=2) { x = coords[i]; y = coords[i+1]; coords[i] = cosa*x-sina*y; coords[i+1] = sina*x+cosa*y; } // Finally scale again to match screen aspect if (viewAspectRatio > 1.0f) { for (int i = 0; i < 8; i+=2) { coords[i] = coords[i]/viewAspectRatio; } } else { for (int i = 1; i < 8; i+=2) { coords[i] = coords[i]*viewAspectRatio; } } mPosVertices.put(coords).position(0); } } } private void computeOutputVertices() { if (mPosVertices != null) { float imgAspectRatio = mTexWidth / (float)mTexHeight; float viewAspectRatio = mViewWidth / (float)mViewHeight; float x0, y0, x1, y1; // Set initial viewtex coords based in texture aspect if (imgAspectRatio > 1.0f) { x0 = -1.0f ; y0 = -1.0f / imgAspectRatio; x1 = 1.0f ; y1 = 1.0f / imgAspectRatio; } else { x0 = -1.0f *imgAspectRatio; y0 = -1.0f; x1 = 1.0f *imgAspectRatio; y1 = 1.0f; } float[] coords = new float[] { x0, y0, x1, y0, x0, y1, x1, y1 }; // Scale coordinates with mZoom for (int i = 0; i < 8; i++) { coords[i] *= mZoom; } // Rotate coordinates with mRot float cosa = (float)Math.cos(mRot); float sina = (float)Math.sin(mRot); float x,y; for (int i = 0; i < 8; i+=2) { x = coords[i]; y = coords[i+1]; coords[i] = cosa*x-sina*y; coords[i+1] = sina*x+cosa*y; } // Finally scale again to match screen aspect if (viewAspectRatio > 1.0f) { for (int i = 0; i < 8; i+=2) { coords[i] = coords[i]/viewAspectRatio; } } else { for (int i = 1; i < 8; i+=2) { coords[i] = coords[i]*viewAspectRatio; } } mPosVertices.put(coords).position(0); } } } private void computeOutputVertices() { if (mPosVertices != null) { float imgAspectRatio = mTexWidth / (float)mTexHeight; float viewAspectRatio = mViewWidth / (float)mViewHeight; float x0, y0, x1, y1; // Set initial viewtex coords based in texture aspect if (imgAspectRatio > 1.0f) { x0 = -1.0f ; y0 = -1.0f / imgAspectRatio; x1 = 1.0f ; y1 = 1.0f / imgAspectRatio; } else { x0 = -1.0f *imgAspectRatio; y0 = -1.0f; x1 = 1.0f *imgAspectRatio; y1 = 1.0f; } float[] coords = new float[] { x0, y0, x1, y0, x0, y1, x1, y1 }; // Scale coordinates with mZoom for (int i = 0; i < 8; i++) { coords[i] *= mZoom; } // Rotate coordinates with mRot float cosa = (float)Math.cos(mRot); float sina = (float)Math.sin(mRot); float x,y; for (int i = 0; i < 8; i+=2) { x = coords[i]; y = coords[i+1]; coords[i] = cosa*x-sina*y; coords[i+1] = sina*x+cosa*y; } // Finally scale again to match screen aspect if (viewAspectRatio > 1.0f) { for (int i = 0; i < 8; i+=2) { coords[i] = coords[i]/viewAspectRatio; } } else { for (int i = 1; i < 8; i+=2) { coords[i] = coords[i]*viewAspectRatio; } } mPosVertices.put(coords).position(0); } } 

    Sugiro que você mergulhe em matrizes OpenGL e faça todas essas transformações usando-as.

    TextureRenderer class TextureRenderer paira implementair o GLSurfaceView.Renderer e altere o RendMode paira RENDERMODE_CONTINUOUSLY .

    Finalmente, a fonte paira o demo modificado está aqui .

    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.