public static SmartTexture get( Object src ) { if (all.containsKey( src )) { return all.get( src ); } else if (src instanceof SmartTexture) { return (SmartTexture)src; } else { SmartTexture tx = new SmartTexture( getBitmap( src ) ); all.put( src, tx ); return tx; } }
public synchronized static SmartTexture get( Object src ) { if (all.containsKey( src )) { return all.get( src ); } else if (src instanceof SmartTexture) { return (SmartTexture)src; } else { SmartTexture tx = new SmartTexture( getBitmap( src ) ); all.put( src, tx ); return tx; } }
public synchronized static SmartTexture createSolid( int color ) { final String key = "1x1:" + color; if (all.containsKey( key )) { return all.get( key ); } else { Bitmap bmp = Bitmap.createBitmap( 1, 1, Bitmap.Config.ARGB_8888 ); bmp.eraseColor( color ); SmartTexture tx = new SmartTexture( bmp ); all.put( key, tx ); return tx; } }
public synchronized static SmartTexture get( Object src ) { if (all.containsKey( src )) { return all.get( src ); } else if (src instanceof SmartTexture) { return (SmartTexture)src; } else { SmartTexture tx = new SmartTexture( getBitmap( src ) ); all.put( src, tx ); return tx; } }
public static SmartTexture createSolid( int color ) { String key = "1x1:" + color; if (all.containsKey( key )) { return all.get( key ); } else { Bitmap bmp = Bitmap.createBitmap( 1, 1, Bitmap.Config.ARGB_8888 ); bmp.eraseColor( color ); SmartTexture tx = new SmartTexture( bmp ); all.put( key, tx ); return tx; } }
public static SmartTexture createGradient( int width, int height, int... colors ) { String key = "" + width + "x" + height + ":" + colors; if (all.containsKey( key )) { return all.get( key ); } else { Bitmap bmp = Bitmap.createBitmap( width, height, Bitmap.Config.ARGB_8888 ); Canvas canvas = new Canvas( bmp ); Paint paint = new Paint(); paint.setShader( new LinearGradient( 0, 0, 0, height, colors, null, TileMode.CLAMP ) ); canvas.drawPaint( paint ); SmartTexture tx = new SmartTexture( bmp ); all.put( key, tx ); return tx; } }
public Halo() { super(); if (!TextureCache.contains( CACHE_KEY )) { Bitmap bmp = Bitmap.createBitmap( RADIUS * 2, RADIUS * 2, Bitmap.Config.ARGB_8888 ); Canvas canvas = new Canvas( bmp ); Paint paint = new Paint(); paint.setColor( 0x0AFFFFFF ); for (int i = 0; i < 50; i++) { canvas.drawCircle(RADIUS, RADIUS, RADIUS * (i+1)/50f, paint); } TextureCache.add( CACHE_KEY, new SmartTexture( bmp ) ); } texture( CACHE_KEY ); }
public Halo() { super(); if (!TextureCache.contains( CACHE_KEY )) { Bitmap bmp = Bitmap.createBitmap( RADIUS * 2, RADIUS * 2, Bitmap.Config.ARGB_8888 ); Canvas canvas = new Canvas( bmp ); Paint paint = new Paint(); paint.setColor( 0xFFFFFFFF ); canvas.drawCircle( RADIUS, RADIUS, RADIUS * 0.75f, paint ); paint.setColor( 0x88FFFFFF ); canvas.drawCircle( RADIUS, RADIUS, RADIUS, paint ); TextureCache.add( CACHE_KEY, new SmartTexture( bmp ) ); } texture( CACHE_KEY ); origin.set( RADIUS ); }
public synchronized static SmartTexture createGradient( int... colors ) { final String key = "" + colors; if (all.containsKey( key )) { return all.get( key ); } else { Bitmap bmp = Bitmap.createBitmap( colors.length, 1, Bitmap.Config.ARGB_8888 ); for (int i=0; i < colors.length; i++) { bmp.setPixel( i, 0, colors[i] ); } SmartTexture tx = new SmartTexture( bmp ); tx.filter( Texture.LINEAR, Texture.LINEAR ); tx.wrap( Texture.CLAMP, Texture.CLAMP ); all.put( key, tx ); return tx; } }
public void reload() { id = new SmartTexture( bitmap ).id; filter( fModeMin, fModeMax ); wrap( wModeH, wModeV ); }
public synchronized static SmartTexture createSolid( int color ) { final String key = "1x1:" + color; if (all.containsKey( key )) { return all.get( key ); } else { final Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888); // In the rest of the code ARGB is used pixmap.setColor( (color << 8) | (color >>> 24) ); pixmap.fill(); SmartTexture tx = new SmartTexture( pixmap ); all.put(key, tx); return tx; } }
public synchronized static SmartTexture createGradient( int... colors ) { final String key = "" + colors; if (all.containsKey( key )) { return all.get( key ); } else { Pixmap pixmap = new Pixmap( colors.length, 1, Pixmap.Format.RGBA8888); for (int i=0; i < colors.length; i++) { // In the rest of the code ARGB is used pixmap.drawPixel( i, 0, (colors[i] << 8) | (colors[i] >>> 24) ); } SmartTexture tx = new SmartTexture( pixmap ); tx.filter( Texture.LINEAR, Texture.LINEAR ); tx.wrap( Texture.CLAMP, Texture.CLAMP ); all.put( key, tx ); return tx; } }
r.texture = new SmartTexture(bitmap, Texture.NEAREST, Texture.CLAMP, true);
public Halo() { super(); if (!TextureCache.contains( CACHE_KEY )) { Pixmap pixmap = new Pixmap(RADIUS * 2, RADIUS * 2, Pixmap.Format.RGBA8888); pixmap.setColor( 0xFFFFFF0A ); for (int i = 0; i < 50; i++) { pixmap.fillCircle(RADIUS, RADIUS, (int)(RADIUS * (i+1)/50f)); } TextureCache.add( CACHE_KEY, new SmartTexture( pixmap ) ); } texture( CACHE_KEY ); }