Using java Syntax Highlighting
- Bitmap bitmap = Bitmap.createBitmap( _width, _height, Bitmap.Config.ARGB_8888 );
- Canvas canvas = new Canvas( bitmap );
- Paint paint = new Paint();
- paint.setARGB( 255, 255, 0, 255 );
- paint.setShader( new RadialGradient( _width/2.0f, _height/2.0f, ( _width > _height ? _width : _height ) / 2.0f, 0xFFFF0000, 0xFF880000, Shader.TileMode.CLAMP ) );
- canvas.drawRect( 0, 0, _width, _height, paint );
- Bitmap use = Bitmap.createBitmap( bitmap, 0, 0, _width, _height );
Parsed in 0.032 seconds, using GeSHi 1.0.8.4
That draws a simple radial gradient onto a bitmap.
Using java Syntax Highlighting
- InputStream is = context.getResources().openRawResource(R.drawable.glass);
- Bitmap bitmap = null;
- try {
- //BitmapFactory is an Android graphics utility for images
- bitmap = BitmapFactory.decodeStream(is);
- } finally {
- //Always clear and close
- try {
- is.close();
- is = null;
- } catch (IOException e) {
- }
- }
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
That's from the INsanityDesign NeHe ports. My problem is that the second one, when applied to an OpenGL texture, actually works, but the canvas-drawn bitmap does not, and there's no error or explanation why.
Using java Syntax Highlighting
- gl.glBindTexture( GL10.GL_TEXTURE_2D, texture );
- gl.glTexParameterf( GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_NEAREST );
- gl.glTexParameterf( GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST );
- GLUtils.texImage2D( GL10.GL_TEXTURE_2D, 0, use, 0 );
Parsed in 0.034 seconds, using GeSHi 1.0.8.4
That's the code I'm using to bind it and draw it. Any help would be appreciated.


