@Override public boolean onOptionsItemSelected(MenuItem item) { super.onOptionsItemSelected(item); switch (item.getItemId()) { case MENU_BG1: { // set BG Image Bitmap bg = BitmapFactory.decodeResource(getResources(), R.drawable.gradient_color1); if (bg != null) mSCanvas.setBackgroundImage(bg); } break; case MENU_BG2: { // set BG Image Bitmap bg = BitmapFactory.decodeResource(getResources(), R.drawable.gradient_color2); if (bg != null) mSCanvas.setBackgroundImage(bg); } break; case MENU_BG3: { // set BG Image Bitmap bg = BitmapFactory.decodeResource(getResources(), R.drawable.gradient_color3); if (bg != null) mSCanvas.setBackgroundImage(bg); } break; case MENU_CLEARALL: { mSCanvas.clearScreen(); } break; } return true; }
private void setInitialBG() { // set BG Image Bitmap bg = BitmapFactory.decodeResource(getResources(), R.drawable.gradient_color1); if (bg == null) return; mSCanvas.setBackgroundImage(bg); // set FG as Black int[] nColors = new int[1]; nColors[0] = 0xff000000; // black Bitmap fg = Bitmap.createBitmap(nColors, 1, 1, Bitmap.Config.ARGB_8888); if (fg == null) return; mSCanvas.setClearImageBitmap( fg, SPenImageFilterConstants.FILTER_ORIGINAL, SPenImageFilterConstants.FILTER_LEVEL_MEDIUM); }