// Path: src/com/painless/glclock/ColorUtils.java
// public class ColorUtils {
// 
// 	public static Paint getPaintFromColor(int color) {
// 		final float[] array = new float[20];
// 		array[18] = 1;
// 		array[1] = (float) Color.red(color) / 255;
// 		array[6] = (float) Color.green(color) / 255;
// 		array[11] = (float) Color.blue(color) / 255;
// 		final Paint paint = new Paint();
// 		paint.setColorFilter(new ColorMatrixColorFilter(array));
// 		return paint;
// 	}
// 
// 	public static Bitmap getPaintedBitmap(Bitmap bitmap, Paint paint, boolean deleteOld) {
// 		final Bitmap colorBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), bitmap.getConfig());
// 		final Canvas c = new Canvas(colorBitmap);
// 		c.drawBitmap(bitmap, 0, 0, paint);
// 		if (deleteOld) {
// 			bitmap.recycle();
// 		}
// 		return colorBitmap;
// 	}
// }
// 
// Path: src/com/painless/glclock/Constants.java
// public final class Constants {
// 
// 	public static final String SHARED_PREFS_NAME = "wallpaperSettings";
// 
// 	public static final String BACK1_URL = "back1.jpg";
// 	public static final String BACK2_URL = "back2.jpg";
// 	public static final String BACK_NONE = "none";
// 	public static final String BACK_IMG_CODE = "back";
// 	public static final String BACK_CCODE = "backcolor";
// 
// 	public static final String THEME_CODE = "theme";
// 	public static final int DEFAULT_THEME = 0xFF4CAF50;
// 
// 	public static final String TRAILS_COUNT = "trails";
// 	public static final String TRAILS_CCODE = "tcolor";
// 
// 	public static final String WEATHER_DEFAULT = "2,35,94,68";
// 	public static final String WEATHER_VALUE = "weather_val";
// 	public static final String LAST_WEATHER_CHECK = "last_weather_check";
//     public static final String WEATHER_NIGHT_MODE = "weather_night";
// 
// 	public static final String USE_FARENHIET = "weather_fahren";
// 	
// 	public static final WidgetCode CLOCK = new WidgetCode("clock", "-92,17");
// 	public static final WidgetCode COMPASS = new WidgetCode("compass", "96,-176");
// 	public static final WidgetCode BATTERY = new WidgetCode("battery", "155,-48");
// 	public static final WidgetCode CPU = new WidgetCode("cpu", "113,84");
// 	public static final WidgetCode RAM = new WidgetCode("ram", "-41,192");
// 	public static final WidgetCode CALENDAR = new WidgetCode("calendar", "-110,-174");
// 	public static final WidgetCode WEATHER = new WidgetCode("weather", "125,265");
// 
// 	public static final class WidgetCode {
// 		public final String code;
// 		public final String prefix;
// 
// 		public final String offset;
// 		public final String offsetDefault;
// 
// 		public final String color;
// 		public final String zoom;
// 
// 		private WidgetCode(String code, String defaultOffset) {
// 			this.code = code + "Enabled";
// 			this.offset = code + "Offset";
// 			this.color  = code + "color";
// 			this.zoom  = code + "zoom";
// 			this.prefix = code + "_";
// 
// 			this.offsetDefault = defaultOffset;
// 		}
// 
// 		public int[] getOffset(SharedPreferences pref) {
// 			final String[] values = pref.getString(offset, offsetDefault).split(",");
// 
// 			final int[] offsets = new int[2];
// 			try {
// 				offsets[0] = Integer.valueOf(values[0]);
// 				offsets[1] = Integer.valueOf(values[1]);
// 			} catch (final Exception e) {
// 				offsets[0] = 0;
// 				offsets[1] = 0;
// 			}
// 			return offsets;
// 		}
// 
// 		public float getZoom(SharedPreferences pref) {
// 			return pref.getFloat(zoom, 1);
// 		}
// 	}
// }


import java.io.InputStream;
import javax.microedition.khronos.opengles.GL10;
import javax.microedition.khronos.opengles.GL11Ext;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Paint;
import com.painless.glclock.ColorUtils;
import com.painless.glclock.Constants;
import com.painless.glclock.R;
	@Override
	public int[] getResources() {
		return new int[] { R.drawable.sample_back };
	}

	@Override
	public void draw(GL10 gl) {
		gl.glBindTexture(GL10.GL_TEXTURE_2D, textureNames[0]);
		((GL11Ext) gl).glDrawTexfOES(0, 0, 0, width, height);
	}

	public void setColor(int color, String type) {
		if ((this.color == color) && this.type.equals(type)) {
			return;
		}
		this.color = color;
		this.type = type;
		shutdown();
	}

	@Override
	protected void bindBitmap(GL10 gl, Bitmap bitmap, int textureName, boolean onlyAlpha) {
		super.bindBitmap(gl, getActualBitmap(bitmap), textureName, false);
	}

	/**
	 * Returns the actual appliable bitmap.
	 * @param bitmap sample back
	 */
	public Bitmap getActualBitmap(Bitmap bitmap) {
// Path: src/com/painless/glclock/ColorUtils.java
// public class ColorUtils {
// 
// 	public static Paint getPaintFromColor(int color) {
// 		final float[] array = new float[20];
// 		array[18] = 1;
// 		array[1] = (float) Color.red(color) / 255;
// 		array[6] = (float) Color.green(color) / 255;
// 		array[11] = (float) Color.blue(color) / 255;
// 		final Paint paint = new Paint();
// 		paint.setColorFilter(new ColorMatrixColorFilter(array));
// 		return paint;
// 	}
// 
// 	public static Bitmap getPaintedBitmap(Bitmap bitmap, Paint paint, boolean deleteOld) {
// 		final Bitmap colorBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), bitmap.getConfig());
// 		final Canvas c = new Canvas(colorBitmap);
// 		c.drawBitmap(bitmap, 0, 0, paint);
// 		if (deleteOld) {
// 			bitmap.recycle();
// 		}
// 		return colorBitmap;
// 	}
// }
// 
// Path: src/com/painless/glclock/Constants.java
// public final class Constants {
// 
// 	public static final String SHARED_PREFS_NAME = "wallpaperSettings";
// 
// 	public static final String BACK1_URL = "back1.jpg";
// 	public static final String BACK2_URL = "back2.jpg";
// 	public static final String BACK_NONE = "none";
// 	public static final String BACK_IMG_CODE = "back";
// 	public static final String BACK_CCODE = "backcolor";
// 
// 	public static final String THEME_CODE = "theme";
// 	public static final int DEFAULT_THEME = 0xFF4CAF50;
// 
// 	public static final String TRAILS_COUNT = "trails";
// 	public static final String TRAILS_CCODE = "tcolor";
// 
// 	public static final String WEATHER_DEFAULT = "2,35,94,68";
// 	public static final String WEATHER_VALUE = "weather_val";
// 	public static final String LAST_WEATHER_CHECK = "last_weather_check";
//     public static final String WEATHER_NIGHT_MODE = "weather_night";
// 
// 	public static final String USE_FARENHIET = "weather_fahren";
// 	
// 	public static final WidgetCode CLOCK = new WidgetCode("clock", "-92,17");
// 	public static final WidgetCode COMPASS = new WidgetCode("compass", "96,-176");
// 	public static final WidgetCode BATTERY = new WidgetCode("battery", "155,-48");
// 	public static final WidgetCode CPU = new WidgetCode("cpu", "113,84");
// 	public static final WidgetCode RAM = new WidgetCode("ram", "-41,192");
// 	public static final WidgetCode CALENDAR = new WidgetCode("calendar", "-110,-174");
// 	public static final WidgetCode WEATHER = new WidgetCode("weather", "125,265");
// 
// 	public static final class WidgetCode {
// 		public final String code;
// 		public final String prefix;
// 
// 		public final String offset;
// 		public final String offsetDefault;
// 
// 		public final String color;
// 		public final String zoom;
// 
// 		private WidgetCode(String code, String defaultOffset) {
// 			this.code = code + "Enabled";
// 			this.offset = code + "Offset";
// 			this.color  = code + "color";
// 			this.zoom  = code + "zoom";
// 			this.prefix = code + "_";
// 
// 			this.offsetDefault = defaultOffset;
// 		}
// 
// 		public int[] getOffset(SharedPreferences pref) {
// 			final String[] values = pref.getString(offset, offsetDefault).split(",");
// 
// 			final int[] offsets = new int[2];
// 			try {
// 				offsets[0] = Integer.valueOf(values[0]);
// 				offsets[1] = Integer.valueOf(values[1]);
// 			} catch (final Exception e) {
// 				offsets[0] = 0;
// 				offsets[1] = 0;
// 			}
// 			return offsets;
// 		}
// 
// 		public float getZoom(SharedPreferences pref) {
// 			return pref.getFloat(zoom, 1);
// 		}
// 	}
// }


// Path: src/com/painless/glclock/spirit/BackSpirit.java
import java.io.InputStream;
import javax.microedition.khronos.opengles.GL10;
import javax.microedition.khronos.opengles.GL11Ext;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Paint;
import com.painless.glclock.ColorUtils;
import com.painless.glclock.Constants;
import com.painless.glclock.R;

	@Override
	public int[] getResources() {
		return new int[] { R.drawable.sample_back };
	}

	@Override
	public void draw(GL10 gl) {
		gl.glBindTexture(GL10.GL_TEXTURE_2D, textureNames[0]);
		((GL11Ext) gl).glDrawTexfOES(0, 0, 0, width, height);
	}

	public void setColor(int color, String type) {
		if ((this.color == color) && this.type.equals(type)) {
			return;
		}
		this.color = color;
		this.type = type;
		shutdown();
	}

	@Override
	protected void bindBitmap(GL10 gl, Bitmap bitmap, int textureName, boolean onlyAlpha) {
		super.bindBitmap(gl, getActualBitmap(bitmap), textureName, false);
	}

	/**
	 * Returns the actual appliable bitmap.
	 * @param bitmap sample back
	 */
	public Bitmap getActualBitmap(Bitmap bitmap) {
		final Paint paint = ColorUtils.getPaintFromColor(color);