/* * Created on 19/08/2006 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */ /** * @author ting * * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates * * Este programa demonstra o uso do mapeamento "esférico" * para criar efeitos de reflexões. * * Pode-se chavear entre as duas imagens pela tecla 't'. */ import java.awt.*; import java.awt.event.*; import java.io.InputStream; import java.io.Serializable; import java.nio.IntBuffer; import java.nio.ByteBuffer; import java.nio.FloatBuffer; import javax.swing.*; import javax.media.opengl.*; import javax.media.opengl.glu.*; public class Tex_boneco extends JFrame implements GLEventListener, KeyListener { public static final Dimension PREFERRED_FRAME_SIZE = new Dimension(500, 500); static float[][] vdata = { {-1.0f, -1.0f, -1.0f}, {1.0f, -1.0f, -1.0f}, {1.0f, 1.0f, -1.0f}, {-1.0f, 1.0f, -1.0f}, {-1.0f, -1.0f, 1.0f}, {1.0f, -1.0f, 1.0f}, {1.0f, 1.0f, 1.0f}, {-1.0f, 1.0f, 1.0f} }; static float[][] ndata = { {0.0f, 0.0f, -1.0f},{0.0f, 1.0f, 0.0f},{-1.0f, 0.0f, 0.0f}, {1.0f, 0.0f, 0.0f},{0.0f, 0.0f, 1.0f},{0.0f, -1.0f, 0.0f} }; static int[][] vindices = { {0,3,2,1}, {2,3,7,6}, {0,4,7,3}, {1,2,6,5}, {4,5,6,7}, {0,1,5,4} }; static float[] ambient = {0.f, 0.f, 0.f, 1.0f}; static float[] diffuse = {1.0f, 1.0f, 1.0f, 1.0f}; static float[] specular = {1.0f, 1.0f, 1.0f, 1.0f}; static float[] position = {0.0f, 0.0f, 4.0f, 1.0f}; static float[] fog_color = {0.0f, 0.0f, 0.0f, 1.0f}; static float[] mat_ambient = {0.0f, 0.0f, 0.0f, 1.0f}; static float[] mat_shininess = {90.0f}; static float[] mat_specular = {1.0f, 1.0f, 1.0f, 1.0f}; static float[] mat_diffuse = {0.8f, 0.8f, 0.8f, 1.0f}; static float[] lmodel_ambient = {0.2f, 0.2f, 0.2f, 1.0f}; static int[] texName = new int[2]; static LoadImage image1, image2; static int indice=0; static float spin_x=0.0f; static float spin_y=0.0f; static float spin_z=0.0f; static float ant=.0f, bra=.0f, cab=.0f; static int braco, busto, cabeca, perna; /** Constructor. */ public Tex_boneco() { // init JFrame super ("Boneco Espelho - JMDM version "); System.out.println("Constructor"); } /** We'd like to be 500x500, please. */ public Dimension getPreferredSize(){ return PREFERRED_FRAME_SIZE; } /* * METHODS DEFINED BY GLEventListener */ /** Called by drawable to initiate drawing. */ public void display(GLAutoDrawable drawable) { GL gl = drawable.getGL(); /* "CLEAR" o display */ gl.glClear (GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); /* setar a cor de desenho em branco (1,1,1) */ gl.glColor3f (1.0f, 1.0f, 1.0f); /* Habilitar a textura */ gl.glEnable(GL.GL_TEXTURE_2D); /* carregar a matriz de identidade na pilha de matriz de transformacao */ gl.glLoadIdentity(); /* concatenar a matriz de translacao com a do topo da pilha */ gl.glTranslatef(.0f,.0f,-3.8f); /* concatenar a matriz de rotacao com a do topo da pilha */ gl.glRotatef(spin_x,1.0f,.0f,.0f); /* concatenar a matriz de rotacao com a do topo da pilha */ gl.glRotatef(spin_y,.0f,1.0f,.0f); /* concatenar a matriz de rotacao com a do topo da pilha */ gl.glRotatef(spin_z,.0f,.0f,1.0f); /* concatenar a matriz de mudanca de escala com a do topo da pilha */ gl.glScalef(6.0f,6.0f,6.0f); /* desenhar a figura */ /* ativar a textura */ gl.glBindTexture (GL.GL_TEXTURE_2D, texName[indice]); /* desenhar o busto */ gl.glPushMatrix(); gl.glCallList(busto); gl.glPopMatrix(); /* desenhar as pernas */ gl.glPushMatrix(); gl.glTranslatef(0.2f,-1.12f,.0f); gl.glCallList(perna); gl.glPopMatrix(); gl.glPushMatrix(); gl.glTranslatef(-0.2f,-1.12f,.0f); gl.glCallList(perna); gl.glPopMatrix(); /* desenhar a cabeça */ gl.glPushMatrix(); gl.glTranslatef(.0f,.75f,.0f); /* rotacionar a cabeça no sentido anti-horário em torno de y */ gl.glRotatef(cab, .0f, 1.0f, .0f); gl.glCallList(cabeca); gl.glPopMatrix(); /* desenhar os braços */ gl.glPushMatrix(); gl.glTranslatef(-0.45f,0.26f,.0f); gl.glPushMatrix(); gl.glCallList(braco); gl.glPopMatrix(); gl.glPushMatrix(); gl.glTranslatef(0.f,-0.59f,.0f); gl.glCallList(braco); gl.glPopMatrix(); gl.glPopMatrix(); gl.glPushMatrix(); gl.glTranslatef(0.45f,0.26f,.0f); /* rotacionar o braço no sentido anti-horário em torno do eixo x */ gl.glTranslatef(.0f, 0.28f, .0f); gl.glRotatef(bra, 1.0f, .0f, .0f); gl.glTranslatef(.0f, -0.28f, .0f); gl.glPushMatrix(); gl.glCallList(braco); gl.glPopMatrix(); gl.glPushMatrix(); gl.glTranslatef(.0f,-0.59f,.0f); /* rotacionar o anti-braço no sentido anti-horário em torno do eixo x */ gl.glTranslatef(.0f, 0.28f, .0f); gl.glRotatef(ant, 1.0f, .0f, .0f); gl.glTranslatef(.0f, -0.28f, .0f); gl.glCallList(braco); gl.glPopMatrix(); gl.glPopMatrix(); /* forcar a execucao dos comandos enviados a OpenGL */ gl.glFlush (); } /** Called by drawable to indicate mode or device has changed. */ public void displayChanged(GLAutoDrawable drawable, boolean modeChanged, boolean deviceChanged){} /** Called after OpenGL is init'ed */ public void init(GLAutoDrawable drawable) { System.out.println("init()"); GL gl = drawable.getGL(); GLU glu = new GLU(); System.err.println("INIT GL IS: " + gl.getClass().getName()); System.err.println("GL_VENDOR: " + gl.glGetString(GL.GL_VENDOR)); System.err.println("GL_RENDERER: " + gl.glGetString(GL.GL_RENDERER)); System.err.println("GL_VERSION: " + gl.glGetString(GL.GL_VERSION)); /* criar listas de display */ figura (gl); /* definir a cor em preto (0,0,0) como cor de "CLEAR" */ gl.glClearColor (0.0f, 0.0f, 0.0f, 0.0f); /* definir a fonte de luz */ gl.glLightfv(GL.GL_LIGHT0, GL.GL_AMBIENT, FloatBuffer.wrap(ambient)); gl.glLightfv(GL.GL_LIGHT0, GL.GL_DIFFUSE, FloatBuffer.wrap(diffuse)); gl.glLightfv(GL.GL_LIGHT0, GL.GL_SPECULAR, FloatBuffer.wrap(specular)); gl.glLightfv(GL.GL_LIGHT0, GL.GL_POSITION, FloatBuffer.wrap(position)); /* definir o material da superficie do boneco */ gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_SHININESS, FloatBuffer.wrap(mat_shininess)); gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_SPECULAR, FloatBuffer.wrap(mat_specular)); gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_DIFFUSE, FloatBuffer.wrap(mat_diffuse)); gl.glMaterialfv(GL.GL_FRONT_AND_BACK, GL.GL_AMBIENT, FloatBuffer.wrap(mat_ambient)); /* definir a luz do ambiente */ gl.glLightModelfv(GL.GL_LIGHT_MODEL_AMBIENT, FloatBuffer.wrap(lmodel_ambient)); /* definir o modo de iluminação dos dois lados */ gl.glLightModeli(GL.GL_LIGHT_MODEL_TWO_SIDE, GL.GL_FALSE); /* setar o tipo de tonalizacao. Ha duas alternativas GL_FLAT (constante) e GL_SMOOTH (interpolacao linear entre os vertices) */ gl.glShadeModel (GL.GL_SMOOTH); /* setar a convencao de orientacao. Ha duas alternativas: GL_CCW (anti-horario) e GL_CW (horario) */ gl.glFrontFace (GL.GL_CCW); /* definir as faces a serem discardadas. Ha tres alternativas: GL_FRONT, GL_BACK e GL_FRONT_AND_BACK */ gl.glCullFace (GL.GL_BACK); /* definir a função de z-teste */ gl.glDepthFunc(GL.GL_LESS); /* * definir o modo como os pixels são armazenados na memória do * processador */ gl.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1); /* gerar nomes para 2 texturas */ gl.glGenTextures (2, IntBuffer.wrap(texName)); /* definir a textura 1 */ gl.glBindTexture (GL.GL_TEXTURE_2D, texName[0]); /* função para geração automática das coordenadas de textura */ gl.glTexGeni(GL.GL_S, GL.GL_TEXTURE_GEN_MODE, GL.GL_SPHERE_MAP); gl.glTexGeni(GL.GL_T, GL.GL_TEXTURE_GEN_MODE, GL.GL_SPHERE_MAP); gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST); gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_REPEAT); gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL.GL_REPEAT); glu.gluBuild2DMipmaps(GL.GL_TEXTURE_2D, GL.GL_RGB, image1.getWidth(), image1.getHeight(), GL.GL_RGB, GL.GL_UNSIGNED_BYTE, image1.getData()); /* definir a textura 2 */ gl.glBindTexture (GL.GL_TEXTURE_2D, texName[1]); /* função para geração automática das coordenadas de textura */ gl.glTexGeni(GL.GL_S, GL.GL_TEXTURE_GEN_MODE, GL.GL_SPHERE_MAP); gl.glTexGeni(GL.GL_T, GL.GL_TEXTURE_GEN_MODE, GL.GL_SPHERE_MAP); gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MAG_FILTER, GL.GL_NEAREST); gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_MIN_FILTER, GL.GL_NEAREST); gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_S, GL.GL_REPEAT); gl.glTexParameterf(GL.GL_TEXTURE_2D, GL.GL_TEXTURE_WRAP_T, GL.GL_REPEAT); glu.gluBuild2DMipmaps(GL.GL_TEXTURE_2D, GL.GL_RGB, image2.getWidth(), image2.getHeight(), GL.GL_RGB, GL.GL_UNSIGNED_BYTE, image2.getData()); gl.glTexEnvf(GL.GL_TEXTURE_ENV, GL.GL_TEXTURE_ENV_MODE, GL.GL_MODULATE); /* habilitar as funcionalidades */ gl.glEnable(GL.GL_LIGHTING); gl.glEnable(GL.GL_LIGHT0); gl.glEnable(GL.GL_DEPTH_TEST); gl.glEnable(GL.GL_CULL_FACE); gl.glEnable(GL.GL_TEXTURE_GEN_S); gl.glEnable(GL.GL_TEXTURE_GEN_T); /* habilitar os tratadores de eventos oriundos do teclado */ drawable.addKeyListener(this); } /** Called to indicate the drawing surface has been moved and/or resized. */ public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height){ System.out.println("reshape()"); GL gl = drawable.getGL(); /* definir matriz de escala do volume canonico * para o tamanho da janela de exibicao, em pixels */ gl.glViewport(0, 0, width, height); /* chavear para a pilha de transformacao de projecao */ gl.glMatrixMode (GL.GL_PROJECTION); gl.glLoadIdentity (); /* definir matriz de normalizacao */ gl.glOrtho (-12.0f, 12.0f, -12.0f, 12.0f, 0.0f, 12.0f); /* chavear para a pilha de transformacao de modelos */ gl.glMatrixMode (GL.GL_MODELVIEW); } /* * OUR HELPER METHODS */ // Método para construir o cubo public static void cubo (GL gl) { for (int i=0; i<6; i++) { gl.glNormal3f(ndata[i][0],ndata[i][1],ndata[i][2]); gl.glBegin(GL.GL_POLYGON); gl.glVertex3f(vdata[vindices[i][0]][0],vdata[vindices[i][0]][1],vdata[vindices[i][0]][2]); gl.glVertex3f(vdata[vindices[i][1]][0],vdata[vindices[i][1]][1],vdata[vindices[i][1]][2]); gl.glVertex3f(vdata[vindices[i][2]][0],vdata[vindices[i][2]][1],vdata[vindices[i][2]][2]); gl.glVertex3f(vdata[vindices[i][3]][0],vdata[vindices[i][3]][1],vdata[vindices[i][3]][2]); gl.glEnd(); } } // Método para construir a figura public static void figura (GL gl) { /* criar o braco */ // gerar um indice da lista braco = gl.glGenLists(1); // inicializar o conteúdo da lista "braco". Há dois modos: // GL_COMPILE: somente armazena; GL_COMPILE_AND_EXECUTE: armazena e execute gl.glNewList(braco, GL.GL_COMPILE); // Inserção dos dados gl.glScalef(0.09f, 0.28f, 0.09f); cubo(gl); // finalizar a lista iniciada gl.glEndList(); /* criar o busto */ busto = gl.glGenLists(1); gl.glNewList(busto, GL.GL_COMPILE); gl.glScalef(0.35f, 0.525f, 0.2f); cubo(gl); gl.glEndList(); /* criar a cabeca */ cabeca = gl.glGenLists(1); gl.glNewList(cabeca, GL.GL_COMPILE); gl.glScalef(0.2f, 0.2f, 0.2f); cubo(gl); gl.glEndList(); /* criar a perna */ perna = gl.glGenLists(1); gl.glNewList(perna, GL.GL_COMPILE); gl.glScalef(0.09f, 0.57f, 0.09f); cubo(gl); gl.glEndList(); } // Methods required for the implementation of KeyListener public void keyPressed(KeyEvent e){ System.out.println("Evento do teclado"); switch(e.getKeyChar()) { case 'a': ant -= 10.f; if (ant < -160.f) ant = .0f; /* Forca o redesenho */ break; case 'b': bra -= 10.f; if (bra < -160.f) bra = .0f; /* Forca o redesenho */ break; case 'c': cab += 10.f; /* Forca o redesenho */ break; case 'x': spin_x += 10.f; /* Forca o redesenho */ break; case 'y': spin_y += 10.f; /* Forca o redesenho */ break; case 'z': spin_z += 10.f; /* Forca o redesenho */ break; case 'r': spin_x = spin_y = spin_z = .0f; /* Forca o redesenho */ break; case 't': if (indice == 1) indice=0; else indice = 1; /* Forca o redesenho */ break; case 27: System.exit(0); return; } ((GLCanvas)(this.getContentPane().getComponentAt(0,0))).display(); } public void keyReleased(KeyEvent e){} public void keyTyped(KeyEvent e){} /** main creates and shows a Cube-JFrame */ public static void main(String[] args){ Tex_boneco g = new Tex_boneco(); //Carrega a primeira imagem image1 = new LoadImage(); image1.generateTextureInfo("photo1.bmp", false); //Carrega a segunda imagem image2 = new LoadImage(); image2.generateTextureInfo("photo3.bmp", false); //Set frame location g.setLocation(100,100); GLCapabilities gl_c = new GLCapabilities(); // Disable double buffer gl_c.setDoubleBuffered(false); /* setar a quantidade de bits para z-buffer */ gl_c.setDepthBits(8); // get a GLCanvas GLCanvas canvas = new GLCanvas(gl_c); // add a GLEventListener, which will get called when the // canvas is resized or needs a repaint canvas.addGLEventListener(g); // now add the canvas to the JFrame. Note we use BorderLayout.CENTER // to make the canvas stretch to fill the container (ie, the frame) g.getContentPane().add(canvas, BorderLayout.CENTER); g.pack(); g.setVisible(true); } static class LoadImage extends JFrame implements Serializable { byte[] data; int width, height; LoadImage() { destroy(); } public int getWidth() { return width; } public int getHeight() { return height; } public ByteBuffer getData() { return ByteBuffer.wrap(data); } void generateTextureInfo(String textureName, boolean AlphaChannel) { Image textureFile = null; int pixels[]; //URL url = LoadImage.class.getClassLoader().getResource(textureName); if (!textureName.endsWith("bmp")) { try { // Modificado aragao // textureFile = java.awt.Toolkit.getDefaultToolkit().getImage( // textureName); /* textureFile = java.awt.Toolkit.getDefaultToolkit() .getImage(url); */ } catch (NullPointerException e) { System.out.println(e); } while (width <= 0 || height <= 0) { width = textureFile.getWidth(null); height = textureFile.getHeight(null); } pixels = new int[width * height]; try { new java.awt.image.PixelGrabber(textureFile, 0, 0, width, height, pixels, 0, width).grabPixels(); textureFile = null; } catch (InterruptedException e) { } } else // Modificado aragao pixels = loadBitmapPixels(textureName); if (!AlphaChannel) { data = new byte[pixels.length * 3]; for (int y = height - 1, pointer = 0; y >= 0; y--) for (int x = 0; x < width; x++, pointer += 3) { data[pointer + 0] = (byte) ((pixels[y * width + x] >> 16) & 0xFF); data[pointer + 1] = (byte) ((pixels[y * width + x] >> 8) & 0xFF); data[pointer + 2] = (byte) (pixels[y * width + x] & 0xFF); } } else { data = new byte[pixels.length * 4]; for (int y = height - 1, pointer = 0; y >= 0; y--) for (int x = 0; x < width; x++, pointer += 4) { data[pointer + 3] = (byte) ((pixels[y * width + x] >> 24) & 0xFF); data[pointer + 0] = (byte) ((pixels[y * width + x] >> 16) & 0xFF); data[pointer + 1] = (byte) ((pixels[y * width + x] >> 8) & 0xFF); data[pointer + 2] = (byte) (pixels[y * width + x] & 0xFF); } } pixels = null; } int[] loadBitmapPixels(String textureName/* String file */) { try { // Modificado Aragao // FileInputStream input = new FileInputStream(url/*file*/); InputStream input = LoadImage.class.getClassLoader() .getResourceAsStream(textureName); int bitmapFileHeaderLength = 14, bitmapInfoHeaderLength = 40; byte bitmapFileHeader[] = new byte[bitmapFileHeaderLength], bitmapInfoHeader[] = new byte[bitmapInfoHeaderLength]; input.read(bitmapFileHeader, 0, bitmapFileHeaderLength); input.read(bitmapInfoHeader, 0, bitmapInfoHeaderLength); int nSize = bytesToInt(bitmapFileHeader, 2), nWidth = bytesToInt( bitmapInfoHeader, 4), nHeight = bytesToInt( bitmapInfoHeader, 8), nBiSize = bytesToInt( bitmapInfoHeader, 0), nPlanes = bytesToShort( bitmapInfoHeader, 12), nBitCount = bytesToShort( bitmapInfoHeader, 14), nSizeImage = bytesToInt( bitmapInfoHeader, 20), nCompression = bytesToInt( bitmapInfoHeader, 16), nColoursUsed = bytesToInt( bitmapInfoHeader, 32), nXPixelsMeter = bytesToInt( bitmapInfoHeader, 24), nYPixelsMeter = bytesToInt( bitmapInfoHeader, 28), nImportantColours = bytesToInt( bitmapInfoHeader, 36); if (nBitCount == 24) { int npad = ((npad = (nSizeImage / nHeight) - nWidth * 3) == 4 || npad < 0) ? 0 : npad, nindex = 0, ndata[] = new int[nHeight * nWidth]; byte brgb[] = new byte[(nWidth + npad) * 3 * nHeight]; input.read(brgb, 0, (nWidth + npad) * 3 * nHeight); for (int j = 0; j < nHeight; j++) { for (int i = 0; i < nWidth; i++) { ndata[nWidth * (nHeight - j - 1) + i] = (255 & 0xff) << 24 | (brgb[nindex + 2] & 0xff) << 16 | (brgb[nindex + 1] & 0xff) << 8 | (brgb[nindex] & 0xff); nindex += 3; } nindex += npad; } brgb = null; input.close(); width = nWidth; height = nHeight; return ndata; } else if (nBitCount == 8) { int nNumColors = (nColoursUsed > 0) ? nColoursUsed : (1 & 0xff) << nBitCount; if (nSizeImage == 0) { nSizeImage = ((((nWidth * nBitCount) + 31) & ~31) >> 3); nSizeImage *= nHeight; } int npalette[] = new int[nNumColors]; byte bpalette[] = new byte[nNumColors * 4]; input.read(bpalette, 0, nNumColors * 4); int nindex8 = 0; for (int n = 0; n < nNumColors; n++) { npalette[n] = (255 & 0xff) << 24 | (bpalette[nindex8 + 2] & 0xff) << 16 | (bpalette[nindex8 + 1] & 0xff) << 8 | (bpalette[nindex8 + 0] & 0xff); nindex8 += 4; } int npad8 = (nSizeImage / nHeight) - nWidth, ndata8[] = new int[nWidth * nHeight]; byte bdata[] = new byte[(nWidth + npad8) * nHeight]; input.read(bdata, 0, (nWidth + npad8) * nHeight); nindex8 = 0; for (int j8 = 0; j8 < nHeight; j8++) { for (int i8 = 0; i8 < nWidth; i8++) { ndata8[nWidth * (nHeight - j8 - 1) + i8] = npalette[((int) bdata[nindex8] & 0xff)]; nindex8++; } nindex8 += npad8; } input.close(); width = nWidth; height = nHeight; return ndata8; } else System.out .println("Not a 24-bit or 8-bit Windows Bitmap, aborting..."); input.close(); } catch (Exception e) { System.out.println("Caught exception in loadbitmap!"); } return null; } int bytesToInt(byte[] bytes, int index) { return (bytes[index + 3] & 0xff) << 24 | (bytes[index + 2] & 0xff) << 16 | (bytes[index + 1] & 0xff) << 8 | bytes[index + 0] & 0xff; } short bytesToShort(byte[] bytes, int index) { return (short) ((bytes[index + 1] & 0xff) << 8 | (bytes[index + 0] & 0xff)); } void destroy() { data = null; width = -1; height = -1; } } /* * public class TextureMap { private ByteBuffer mData; * * private int mWidth; * * private int mHeight; * * public TextureMap(String filename) { URL url = * TextureMap.class.getClassLoader().getResource(filename); ImageIcon icon = new * ImageIcon(url); mWidth = icon.getIconWidth(); mHeight = icon.getIconHeight(); * * mData = ByteBuffer.allocate(mWidth * mHeight * 4); BufferedImage bImage = new * BufferedImage(mWidth, mHeight, BufferedImage.TYPE_INT_ARGB); Graphics g2 = * bImage.getGraphics(); g2.drawImage(icon.getImage(), 0, 0, null); * * int k = 0; int c; for (int y = 0; y < mHeight; y++) for (int x = 0; x < * mWidth; x++) { c = bImage.getRGB(x, y); mData.put(k + 2, (byte) (c & 0xFF)); * c = c >> 8; mData.put(k + 1, (byte) (c & 0xFF)); c = c >> 8; mData.put(k, * (byte) (c & 0xFF)); c = c >> 8; mData.put(k + 3, (byte) (0xFF)); k += 4; } } * * public int getWidth() { return mWidth; } * * public int getHeight() { return mHeight; } * * public ByteBuffer getData() { return mData; } } */ }