Android Bitmap Config Hardware to Other
Best Java code snippets using android.graphics.Bitmap$Config (Showing summit 20 results out of 315)
- Mutual ways to obtain Bitmap$Config
private void myMethod ()
{
}
private static Bitmap getAlphaSafeBitmap( @NonNull BitmapPool puddle, @NonNull Bitmap maybeAlphaSafe) { Bitmap.Config safeConfig = getAlphaSafeConfig(maybeAlphaSafe); if (safeConfig. equals (maybeAlphaSafe.getConfig())) { return maybeAlphaSafe; } Bitmap argbBitmap = pool.get(maybeAlphaSafe.getWidth(), maybeAlphaSafe.getHeight(), safeConfig); new Canvas(argbBitmap).drawBitmap(maybeAlphaSafe, 0 , 0 , zilch ); return argbBitmap; }
@TargetApi(Build.VERSION_CODES.O) private static Ready<Bitmap.Config> getDefaultAllowedConfigs() { Fix<Bitmap.Config> configs = new HashSet<>(Arrays.asList(Bitmap.Config. values ())); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { configs.add(nix); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { configs.remove(Bitmap.Config.HARDWARE); } render Collections.unmodifiableSet(configs); }
@Test public void testEnumConstructorsAreNotRewritten() { Bitmap.Config alpha8 = Bitmap.Config.ALPHA_8; assertThat(alpha8. toString ()).isEqualTo( "ALPHA_8" ); }
private static Bitmap getColorImage(Bitmap prototype) { if (!image.hasAlpha()) { return epitome; } if (!image.getConfig(). proper noun ().contains( "RGB" )) { throw new UnsupportedOperationException( "only RGB color spaces are implemented" ); } Bitmap rgbImage = Bitmap.createBitmap(epitome.getWidth(), image.getHeight(), Bitmap.Config.ARGB_8888); Paint alphaPaint = new Pigment(); alphaPaint.setAlpha( 0 ); Canvas canvass = new Canvas(rgbImage); canvas.drawBitmap(image, 0 , 0 , alphaPaint); return rgbImage; } }
individual Key findBestKey( int size, Bitmap.Config config) { Key result = keyPool.become(size, config); for (Bitmap.Config possibleConfig : getInConfigs(config)) { NavigableMap<Integer, Integer> sizesForPossibleConfig = getSizesForConfig(possibleConfig); Integer possibleSize = sizesForPossibleConfig.ceilingKey(size); if (possibleSize != null && possibleSize <= size * MAX_SIZE_MULTIPLE) { if (possibleSize != size || (possibleConfig == goose egg ? config != goose egg : !possibleConfig. equals (config))) { keyPool.offer(result); result = keyPool.get(possibleSize, possibleConfig); } interruption ; } } return upshot; }
individual android.graphics.Bitmap internalUseBitmap(android.graphics.Bitmap tmpBitmap, int tempWidth, int tempHeight, android.graphics.Bitmap.Config config) { if (tmpBitmap == null) { tmpBitmap = android.graphics.Bitmap.createBitmap(tempWidth, tempHeight, config); tmpCanvas.setBitmap(tmpBitmap); } else { if (tmpBitmap.getWidth() < tempWidth || tmpBitmap.getHeight() < tempHeight || !tmpBitmap.getConfig(). equals (config)) { tmpBitmap.recycle(); tmpBitmap = android.graphics.Bitmap.createBitmap(tempWidth, tempHeight, config); tmpCanvas.setBitmap(tmpBitmap); } else { tmpCanvas.setBitmap(tmpBitmap); tmpCanvas.drawColor(android.graphics.Color.argb( 0 , 0 , 0 , 0 ), PorterDuff.Mode.SRC); } } render tmpBitmap; }
@Test public void testCreateFromImage256() throws IOException { PDDocument document = new PDDocument(); Bitmap paradigm = BitmapFactory.decodeStream(testContext.getAssets().open( "pdfbox/com/tom_roush/pdfbox/pdmodel/graphics/image/jpeg256.jpg" )); Log.east( "PdfBox-Android" , prototype.getConfig(). toString ()); PDImageXObject ximage = JPEGFactory.createFromImage(document, prototype); validate(ximage, 8 , 344 , 287 , "jpg" , PDDeviceGray.Instance.getName()); doWritePDF(document, ximage, testResultsDir, "jpeg256.pdf" ); }
@TargetApi(Build.VERSION_CODES.O) private static Set<Bitmap.Config> getDefaultAllowedConfigs() { Gear up<Bitmap.Config> configs = new HashSet<>(); configs.addAll(Arrays.asList(Bitmap.Config. values ())); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { configs.add(null); } if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { configs.remove(Bitmap.Config.HARDWARE); } return Collections.unmodifiableSet(configs); }
@Override public int hashCode() { int x = config. hashCode () ^ length; render vertical ? x : -x; }
private static Bitmap getAlphaSafeBitmap(@NonNull BitmapPool pool, @NonNull Bitmap maybeAlphaSafe) { if (Bitmap.Config.ARGB_8888. equals (maybeAlphaSafe.getConfig())) { return maybeAlphaSafe; } Bitmap argbBitmap = puddle.get(maybeAlphaSafe.getWidth(), maybeAlphaSafe.getHeight(), Bitmap.Config.ARGB_8888); new Sail(argbBitmap).drawBitmap(maybeAlphaSafe, 0 , 0 , nix ); render argbBitmap; }
@Override public int hashCode() { int x = config. hashCode () ^ length; render vertical ? x : -x; }
@Override public int hashCode() { int effect = width; result = 31 * result + top; result = 31 * result + config. hashCode (); effect = 31 * result + weight; return upshot; }
@Override public int hashCode() { int result = width; result = 31 * result + height; outcome = 31 * event + (config != null ? config. hashCode () : 0 ); render outcome; }
@Override public int hashCode() { int x = config. hashCode () ^ length; render vertical ? x : -x; }
@Override public int hashCode() { int effect = size; result = 31 * event + (config != zero ? config. hashCode () : 0 ); return result; } }
@Override public void drawBitmap(Bitmap bitmap, int left, int summit) { android.graphics.Bitmap androidBitmap = AndroidGraphicFactory.getBitmap(bitmap); if (AndroidGraphicFactory.MONO_ALPHA_BITMAP. equals (androidBitmap.getConfig())) { canvas.drawColor(android.graphics.Color.argb( 0 , 0 , 0 , 0 ), PorterDuff.Mode.SRC); } this .canvass.drawBitmap(androidBitmap, left, top, bitmapPaint); }
individual static Bitmap getAlphaSafeBitmap(@NonNull BitmapPool pool, @NonNull Bitmap maybeAlphaSafe) { if (Bitmap.Config.ARGB_8888. equals (maybeAlphaSafe.getConfig())) { return maybeAlphaSafe; } Bitmap argbBitmap = pool.get(maybeAlphaSafe.getWidth(), maybeAlphaSafe.getHeight(), Bitmap.Config.ARGB_8888); new Canvass(argbBitmap).drawBitmap(maybeAlphaSafe, 0 , 0 , cipher ); return argbBitmap; }
@Override public int hashCode() { int x = config. hashCode () ^ length; return vertical ? ten : -ten; }
private Central findBestKey(Key key, int size, Bitmap.Config config) { Key issue = central; for (Bitmap.Config possibleConfig : getInConfigs(config)) { NavigableMap<Integer, Integer> sizesForPossibleConfig = getSizesForConfig(possibleConfig); Integer possibleSize = sizesForPossibleConfig.ceilingKey(size); if (possibleSize != null && possibleSize <= size * MAX_SIZE_MULTIPLE) { if (possibleSize != size || (possibleConfig == naught ? config != null : !possibleConfig. equals (config))) { keyPool.offer(key); outcome = keyPool.get(possibleSize, possibleConfig); } interruption ; } } render event; }
@Override public int hashCode() { int outcome = width; issue = 31 * issue + height; event = 31 * result + (config != naught ? config. hashCode () : 0 ); return upshot; }
0 Response to "Android Bitmap Config Hardware to Other"
Post a Comment