/**
   * Drawing src bitmap to dest bitmap with rounded corners
   *
   * @param src source bitmap
   * @param dest destination bitmap
   * @param radius radius in destination bitmap scale
   * @param clearColor clear color
   */
  public static void drawRoundedCorners(Bitmap src, Bitmap dest, int radius, int clearColor) {
    clearBitmap(dest, clearColor);
    Canvas canvas = new Canvas(dest);

    Rect sourceRect = WorkCache.RECT1.get();
    Rect destRect = WorkCache.RECT2.get();
    sourceRect.set(0, 0, src.getWidth(), src.getHeight());
    destRect.set(0, 0, dest.getWidth(), dest.getHeight());

    RectF roundRect = WorkCache.RECTF1.get();
    roundRect.set(0, 0, dest.getWidth(), dest.getHeight());

    Paint paint = WorkCache.PAINT.get();
    paint.reset();
    paint.setStyle(Paint.Style.FILL);
    paint.setColor(Color.RED);
    paint.setAntiAlias(true);
    canvas.drawRoundRect(roundRect, radius, radius, paint);

    paint.reset();
    paint.setFilterBitmap(true);
    paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
    canvas.drawBitmap(src, sourceRect, destRect, paint);

    canvas.setBitmap(null);
  }
  /**
   * Drawing src bitmap to dest bitmap with round mask. Dest might be squared, src is recommended to
   * be square
   *
   * @param src source bitmap
   * @param dest destination bitmap
   * @param clearColor clear color
   */
  public static void drawInRound(Bitmap src, Bitmap dest, int clearColor) {
    if (dest.getWidth() != dest.getHeight()) {
      throw new RuntimeException("dest Bitmap must have square size");
    }
    clearBitmap(dest, clearColor);
    Canvas canvas = new Canvas(dest);

    int r = dest.getWidth() / 2;
    Rect sourceRect = WorkCache.RECT1.get();
    Rect destRect = WorkCache.RECT2.get();
    sourceRect.set(0, 0, src.getWidth(), src.getHeight());
    destRect.set(0, 0, dest.getWidth(), dest.getHeight());

    Paint paint = WorkCache.PAINT.get();
    paint.reset();
    paint.setStyle(Paint.Style.FILL);
    paint.setColor(Color.RED);
    paint.setAntiAlias(true);
    canvas.drawCircle(r, r, r, paint);

    paint.reset();
    paint.setFilterBitmap(true);
    paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
    canvas.drawBitmap(src, sourceRect, destRect, paint);

    canvas.setBitmap(null);
  }
  /**
   * Drawing src bitmap to dest bitmap with applied mask.
   *
   * @param src source bitmap
   * @param mask bitmap mask
   * @param dest destination bitmap
   * @param clearColor clear color
   */
  public static void drawMasked(Bitmap src, Drawable mask, Bitmap dest, int clearColor) {
    clearBitmap(dest, clearColor);
    Canvas canvas = new Canvas(dest);

    canvas.drawBitmap(
        src,
        new Rect(0, 0, src.getWidth(), src.getHeight()),
        new Rect(0, 0, dest.getWidth(), dest.getHeight()),
        new Paint(Paint.FILTER_BITMAP_FLAG));

    if (mask instanceof BitmapDrawable) {
      ((BitmapDrawable) mask)
          .getPaint()
          .setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
    } else if (mask instanceof NinePatchDrawable) {
      ((NinePatchDrawable) mask)
          .getPaint()
          .setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DST_IN));
    } else {
      throw new RuntimeException("Supported only BitmapDrawable or NinePatchDrawable");
    }
    mask.setBounds(0, 0, mask.getIntrinsicWidth(), mask.getIntrinsicHeight());
    mask.draw(canvas);
    canvas.setBitmap(null);
  }
Exemple #4
0
  public void render(Bitmap screen, float delta_time, Rasterizer triangle) {
    // FOV
    // float ztan = (float) Math.tan(Math.toRadians(80.0));
    float ztan = 1;
    screen.paint((byte) 0x00, (byte) 0x00, (byte) 0x00);
    float halfWidth = screen.getWidth() / 2.0f;
    float halfHeight = screen.getHeight() / 2.0f;

    for (int i = 0; i < 1; i++) {
      drop_z -= delta_time * cspeed;

      if (drop_z <= 0) spawn_drop(2);

      // Multiplying the position by (size/2) and then adding (size/2)
      // remaps the positions from range (-1, 1) to (0, size)
      int x = (int) ((drop_x / (drop_z * ztan)) * halfWidth + halfWidth);
      int y = (int) ((drop_y / (drop_z * ztan)) * halfHeight * halfHeight);

      if (x < 0 || x > screen.getWidth() || y < 0 || y > screen.getHeight()) {
        spawn_drop(i);
      } else {
        Vertex v1 = new Vertex(x, y);
        spawn_drop(i);
        x = (int) ((drop_x / (drop_z * ztan)) * halfWidth + halfWidth);
        y = (int) ((drop_y / (drop_z * ztan)) * halfHeight * halfHeight);
        Vertex v2 = new Vertex(x, y);
        spawn_drop(i);
        x = (int) ((drop_x / (drop_z * ztan)) * halfWidth + halfWidth);
        y = (int) ((drop_y / (drop_z * ztan)) * halfHeight * halfHeight);
        Vertex v3 = new Vertex(x, y);
        triangle.rasterize(v1, v2, v3);
      }
    }
  }
  /** @Method: packData @Description: ���Ҫ���͵���� */
  private void packData() {

    currentBitmap = BitmapList[firstView];
    ByteArrayOutputStream stream1 = new ByteArrayOutputStream(); // stream1
    currentBitmap.compress(
        Bitmap.CompressFormat.PNG, 1, stream1); // compress to which format you want
    byte[] byte_arr = stream1.toByteArray(); // stream1 to byte
    try {
      stream1.close();
      stream1 = null;
    } catch (IOException e1) {
      e1.printStackTrace();
    }
    String image_str = Base64.encodeBytes(byte_arr); // byte to string

    Bitmap smallcurrentBitmap;
    float wRatio = (float) (currentBitmap.getWidth() / 100.0);
    float hRatio = (float) (currentBitmap.getHeight() / 100.0);
    if (wRatio > 1 && hRatio > 1) // ����ָ����С������С��Ӧ�ı���
    {
      float scaleTemp;
      if (wRatio > hRatio) scaleTemp = hRatio;
      else scaleTemp = wRatio;
      wRatio = currentBitmap.getWidth() / scaleTemp;
      hRatio = currentBitmap.getHeight() / scaleTemp;
      int h = (int) wRatio;
      int w = (int) hRatio;
      smallcurrentBitmap = Bitmap.createScaledBitmap(currentBitmap, h, w, false);
    } else smallcurrentBitmap = currentBitmap;

    ByteArrayOutputStream stream2 = new ByteArrayOutputStream(); // stream2
    smallcurrentBitmap.compress(
        Bitmap.CompressFormat.PNG, 50, stream2); // compress to which format you want
    smallcurrentBitmap.recycle();
    byte_arr = stream2.toByteArray(); // stream2 to byte
    try {
      stream2.close();
      stream2 = null;

    } catch (IOException e) {
      e.printStackTrace();
    }
    String smallimage_str = Base64.encodeBytes(byte_arr); // byte to string

    nameValuePairs.add(new BasicNameValuePair("protocol", "upload")); // ��װ��ֵ��
    nameValuePairs.add(new BasicNameValuePair("id", LoginActivity.mineID));
    nameValuePairs.add(new BasicNameValuePair("albumName", choosedAlbum));
    nameValuePairs.add(
        new BasicNameValuePair(
            "imageName", PhotoAlbumActivity.AlbumsFloderName.get(AlbumName).get(currentNum)));
    Log.d("debug", PhotoAlbumActivity.AlbumsFloderName.get(AlbumName).get(currentNum));
    nameValuePairs.add(new BasicNameValuePair("image", image_str));
    nameValuePairs.add(new BasicNameValuePair("smallImage", smallimage_str));

    System.gc();
  }
  // Similar to TextFields layout()
  protected void layout(int width, int height) {
    if (width < 0 || height < 0) throw new IllegalArgumentException();

    // We'll take all we can get
    _totalWidth = width;

    // The largest of the two image heights
    _totalHeight = Math.max(_imageSlider.getHeight(), _imageThumb.getHeight());

    setExtent(_totalWidth, _totalHeight);
  }
  public BitmapButtonField(Bitmap normalState, Bitmap focusState, long style) {
    super(Field.FOCUSABLE | style);

    if ((normalState.getWidth() != focusState.getWidth())
        || (normalState.getHeight() != focusState.getHeight())) {

      throw new IllegalArgumentException("Image sizes don't match");
    }

    _bitmaps = new Bitmap[] {normalState, focusState};
  }
  private void drawBrightnessIndicator(Canvas canvas) {
    // get a representation of the height of the indicator within the bar
    float brightnessHeight = mNewColor[2] * mWheel.getHeight();
    // Log.d(TAG, String.format("Brightness height: %f", brightnessHeight));
    // convert the height to an absolute y position based on the bar's position
    float absoluteY = mWheelPosition.y + mWheel.getHeight() - brightnessHeight;
    // get the y value "above" the x axis for the x coordinate calculation
    // note: because of symmetry, the sign doesn't matter so we'll use the positive
    float heightAboveXAxis = Math.abs(brightnessHeight - (float) mRadius);
    // Log.d(TAG, String.format("Height above X: %f", heightAboveXAxis));
    float leftEdgeRadius = (float) (mRadius + SPACE_BETWEEN_WHEEL_AND_BAR);
    float rightEdgeRadius = leftEdgeRadius + ARC_WIDTH;
    // get the x coordinate relative to the center of the wheel
    float leftXInCircle =
        (float) Math.sqrt(leftEdgeRadius * leftEdgeRadius - heightAboveXAxis * heightAboveXAxis);
    float rightXInCircle =
        (float) Math.sqrt(rightEdgeRadius * rightEdgeRadius - heightAboveXAxis * heightAboveXAxis);
    // get the absolute x and y coordinates of the left edge of the bar at the bar height
    float leftX = mWheelCenter.x + leftXInCircle;
    float rightX = mWheelCenter.x + rightXInCircle;

    float indicatorHeight = BRIGHTNESS_INDICATOR_SIZE / 2.0f;
    float indicatorWidth = BRIGHTNESS_INDICATOR_SIZE;

    Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setStrokeWidth(1.0f);

    Path leftTrianglePath = new Path();
    leftTrianglePath.moveTo(leftX, absoluteY - indicatorHeight);
    leftTrianglePath.lineTo(leftX + indicatorWidth, absoluteY);
    leftTrianglePath.lineTo(leftX, absoluteY + indicatorHeight);
    leftTrianglePath.close();
    paint.setColor(Color.BLUE);
    paint.setStyle(Paint.Style.FILL);
    canvas.drawPath(leftTrianglePath, paint);
    paint.setColor(Color.WHITE);
    paint.setStyle(Paint.Style.STROKE);
    canvas.drawPath(leftTrianglePath, paint);

    Path rightTrianglePath = new Path();
    rightTrianglePath.moveTo(rightX, absoluteY - indicatorHeight);
    rightTrianglePath.lineTo(rightX - indicatorWidth, absoluteY);
    rightTrianglePath.lineTo(rightX, absoluteY + indicatorHeight);
    rightTrianglePath.close();
    paint.setColor(Color.BLUE);
    paint.setStyle(Paint.Style.FILL);
    canvas.drawPath(rightTrianglePath, paint);
    paint.setColor(Color.WHITE);
    paint.setStyle(Paint.Style.STROKE);
    canvas.drawPath(rightTrianglePath, paint);
  }
  private void setCurrentBrightness(float yPosition) {
    // get the height (in pixels) from the bottom of the bar (wheel too) to the touch
    float touchHeight = (float) mWheelPosition.y + (float) mWheel.getHeight() - yPosition;
    // normalize the height of the touch
    float brightness = touchHeight / (float) mWheel.getHeight();

    // replace the brightness with the new value if it is in [0, 1]
    if (0.0f <= brightness && brightness <= 1.0f) {
      // set the new brightness
      mNewColor[2] = brightness;
      updateListener();
      // Log.d(TAG, String.format("Set brightness to: %f", brightness));
      invalidate();
    }
  }
  @Override
  protected void onDraw(Canvas canvas) {
    // draw the background and color wheel
    canvas.drawBitmap(mBackground, mBackgroundPosition.x, mBackgroundPosition.y, null);
    canvas.drawBitmap(mWheel, mWheelPosition.x, mWheelPosition.y, null);

    // setup paint for the gradient filling
    Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setStyle(Paint.Style.FILL);
    paint.setStrokeWidth(2.0f);
    // create a shader that will show the range of brightness settings
    float[] gradientStartColor = new float[3];
    float[] gradientEndColor = new float[3];
    System.arraycopy(mNewColor, 0, gradientStartColor, 0, mNewColor.length);
    System.arraycopy(mNewColor, 0, gradientEndColor, 0, mNewColor.length);
    gradientStartColor[2] = 1.0f;
    gradientEndColor[2] = 0.0f;
    Shader gradientShader =
        new LinearGradient(
            (float) (mWheelPosition.x + mRadius),
            mWheelPosition.y,
            mOuterArcRect.right,
            mWheelPosition.y + mWheel.getHeight(),
            Color.HSVToColor(gradientStartColor),
            Color.HSVToColor(gradientEndColor),
            Shader.TileMode.MIRROR);
    paint.setShader(gradientShader);
    canvas.drawPath(mArcPath, paint);

    drawHSCrosshairs(canvas);
    drawBrightnessIndicator(canvas);
  }
  public SliderField(
      Bitmap thumb,
      Bitmap sliderBackground,
      Bitmap sliderBackgroundFocus,
      int numStates,
      int initialState,
      int xLeftBackMargin,
      int xRightBackMargin,
      long style) {
    super(style);

    if (initialState > numStates || numStates < 2) {}
    _imageThumb = thumb;
    _imageSlider = sliderBackground;
    _imageSliderFocus = sliderBackgroundFocus;
    _numStates = numStates;
    setState(initialState);

    _xLeftBackMargin = xLeftBackMargin;
    _xRightBackMargin = xRightBackMargin;

    _rop = _imageSlider.hasAlpha() ? Graphics.ROP_SRC_ALPHA : Graphics.ROP_SRC_COPY;

    _thumbWidth = thumb.getWidth();
    _thumbHeight = thumb.getHeight();

    initBitmaps();
  }
  private void drawFooter(Canvas canvas) {
    final ZLView view = ZLApplication.Instance().getCurrentView();
    final ZLView.FooterArea footer = view.getFooterArea();

    if (footer == null) {
      myFooterBitmap = null;
      return;
    }

    if (myFooterBitmap != null
        && (myFooterBitmap.getWidth() != getWidth()
            || myFooterBitmap.getHeight() != footer.getHeight())) {
      myFooterBitmap = null;
    }
    if (myFooterBitmap == null) {
      myFooterBitmap = Bitmap.createBitmap(getWidth(), footer.getHeight(), Bitmap.Config.RGB_565);
    }
    final ZLAndroidPaintContext context =
        new ZLAndroidPaintContext(
            new Canvas(myFooterBitmap),
            getWidth(),
            footer.getHeight(),
            view.isScrollbarShown() ? getVerticalScrollbarWidth() : 0);
    footer.paint(context);
    canvas.drawBitmap(myFooterBitmap, 0, getHeight() - footer.getHeight(), myPaint);
  }
Exemple #13
0
 public BitmapDataSrc(Bitmap bitmap) {
   this.bitmap = bitmap;
   this.w = bitmap.getWidth();
   this.h = bitmap.getHeight();
   this.nc = 3;
   this.nomRangeBits = 8;
 }
Exemple #14
0
  private void drawPlaceHolder(Canvas canvas) {
    placeholderPaint.setColor(layout.placeHolderColor);

    placeholderTextPaint.setAlpha(255);
    placeholderPaint.setAlpha(255);
    avatarPaint.setAlpha(255);

    rect.set(
        layout.layoutAvatarLeft,
        layout.layoutAvatarTop,
        layout.layoutAvatarLeft + layout.layoutAvatarWidth,
        layout.layoutAvatarTop + layout.layoutAvatarWidth);

    canvas.drawRect(rect, placeholderPaint);
    if (layout.usePlaceholder) {
      canvas.drawText(
          layout.placeHolderName,
          layout.placeholderLeft,
          layout.placeholderTop,
          placeholderTextPaint);
    } else {
      rect2.set(0, 0, placeholder.getWidth(), placeholder.getHeight());
      canvas.drawBitmap(placeholder, rect2, rect, avatarPaint);
    }
  }
  private void paintSliderBackground(Graphics g, Bitmap left, Bitmap middle, Bitmap right) {
    int sliderHeight = _imageSlider.getHeight();
    int sliderBackYOffset = (_totalHeight - sliderHeight) >> 1;

    // Left
    g.drawBitmap(0, sliderBackYOffset, _xLeftBackMargin, sliderHeight, left, 0, 0); // lefttop
    // Middle
    g.tileRop(
        _rop,
        _xRightBackMargin,
        sliderBackYOffset,
        _totalWidth - _xLeftBackMargin - _xRightBackMargin,
        sliderHeight,
        middle,
        0,
        0); // top
    // Right
    g.drawBitmap(
        _totalWidth - _xRightBackMargin,
        sliderBackYOffset,
        _xRightBackMargin,
        sliderHeight,
        right,
        0,
        0); // lefttop
  }
 /** scale image */
 public static Bitmap scaleImage(Bitmap org, float scaleWidth, float scaleHeight) {
   if (org == null) {
     return null;
   }
   Matrix matrix = new Matrix();
   matrix.postScale(scaleWidth, scaleHeight);
   return Bitmap.createBitmap(org, 0, 0, org.getWidth(), org.getHeight(), matrix, true);
 }
 public TiledBitmapCanvas(Bitmap bitmap, int tileSize, int maxVersions) {
   mWidth = bitmap.getWidth();
   mHeight = bitmap.getHeight();
   mConfig = bitmap.getConfig();
   mTileSize = tileSize;
   mMaxVersions = maxVersions;
   load(bitmap);
 }
 public TrackingPatternView(Context context, AttributeSet attributeset) {
   super(context, attributeset);
   mTexture = BitmapFactory.decodeResource(getResources(), 0x108056f);
   mTextureWidth = mTexture.getWidth();
   mTextureHeight = mTexture.getHeight();
   mPaint = new Paint();
   mPaint.setDither(false);
 }
Exemple #19
0
  public static Bitmap rotateBmp(Bitmap bmp, int angle) {

    int width = bmp.getWidth();
    int height = bmp.getHeight();
    Matrix matrix = new Matrix();
    matrix.postRotate(angle);
    return Bitmap.createBitmap(bmp, 0, 0, width, height, matrix, true);
  }
 private static Bitmap convertToAlphaMask(Bitmap b) {
   Bitmap a = Bitmap.createBitmap(b.getWidth(), b.getHeight(), Bitmap.Config.ALPHA_8);
   Canvas c = new Canvas(a);
   Paint pt = new Paint();
   pt.setColorFilter(new ColorMatrixColorFilter(MASK));
   c.drawBitmap(b, 0.0f, 0.0f, pt);
   return a;
 }
Exemple #21
0
 public boolean getElementTouched(int x, int y) {
   if ((mX < x && x < mX + mBitmap.getWidth())
       && (mY < y && y < mY + mBitmap.getHeight())
       && this.head) {
     return true;
   } else {
     return false;
   }
 }
 private void copy(Bitmap src, int x, int y, int width, int height, Bitmap dest) {
   int[] argbData = new int[width * height];
   src.getARGB(argbData, 0, width, x, y, width, height);
   for (int tx = 0; tx < dest.getWidth(); tx += width) {
     for (int ty = 0; ty < dest.getHeight(); ty += height) {
       dest.setARGB(argbData, 0, width, tx, ty, width, height);
     }
   }
 }
  public final void makeUsing(final Bitmap aBitmap) {
    // #if DEBUG
    Assert.isFalse("not made", myHasTextureIdFlag);
    // #endif

    myWidth = aBitmap.getWidth();
    myHeight = aBitmap.getHeight();
    makeOpenglTexture(aBitmap);
  }
  private void makeOpenglTexture(final Bitmap aBitmapARGB32) {
    myWidth = aBitmapARGB32.getWidth();
    myHeight = aBitmapARGB32.getHeight();

    myOglTextureId = myUtilities.makeNewOpenglTexture();
    myHasTextureIdFlag = true;

    myUtilities.setTexturePixels(aBitmapARGB32);
  }
Exemple #25
0
  public static Bitmap roundedCornerBitmap(Bitmap bitmap, float radis) {
    Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Config.ARGB_8888);
    Canvas canvas = new Canvas(output);

    // final int color = 0xff424242;
    final Paint paint = new Paint();
    final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
    final RectF rectF = new RectF(rect);
    final float roundPx = radis;

    paint.setAntiAlias(true);
    canvas.drawARGB(0, 0, 0, 0);
    paint.setColor(Color.WHITE);
    canvas.drawRoundRect(rectF, roundPx, roundPx, paint);

    paint.setXfermode(new PorterDuffXfermode(Mode.SRC_IN));
    canvas.drawBitmap(bitmap, rect, rect, paint);
    return output;
  }
Exemple #26
0
 public static Bitmap zoomImage(Bitmap bmp, double newWidth, double newHeight) {
   float width = bmp.getWidth();
   float height = bmp.getHeight();
   Matrix matrix = new Matrix();
   float scaleWidth = ((float) newWidth) / width;
   float scaleHeight = ((float) newHeight) / height;
   matrix.postScale(scaleWidth, scaleHeight);
   Bitmap bitmap = Bitmap.createBitmap(bmp, 0, 0, (int) width, (int) height, matrix, true);
   return bitmap;
 }
  public static Bitmap toRoundCorner(Bitmap bitmap) {
    int height = bitmap.getHeight();
    int width = bitmap.getHeight();
    Bitmap output = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);

    Canvas canvas = new Canvas(output);

    final Paint paint = new Paint();
    final Rect rect = new Rect(0, 0, width, height);

    paint.setAntiAlias(true);
    canvas.drawARGB(0, 0, 0, 0);
    // paint.setColor(0xff424242);
    paint.setColor(Color.TRANSPARENT);
    canvas.drawCircle(width / 2, height / 2, width / 2, paint);
    paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
    canvas.drawBitmap(bitmap, rect, rect, paint);
    return output;
  }
  /**
   * Rotates image by the specified number of degrees clockwise. Cycles from 0 to 360 degrees.
   *
   * @param degrees Integer specifying the number of degrees to rotate.
   */
  public void rotateImage(int degrees) {

    Matrix matrix = new Matrix();
    matrix.postRotate(degrees);
    mBitmap =
        Bitmap.createBitmap(mBitmap, 0, 0, mBitmap.getWidth(), mBitmap.getHeight(), matrix, true);
    setImageBitmap(mBitmap);

    mDegreesRotated += degrees;
    mDegreesRotated = mDegreesRotated % 360;
  }
  public static Bitmap makeBitmapCircle(Bitmap bitmap) {
    Bitmap output =
        Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(output);

    final int color = 0xff000000;
    final Paint paint = new Paint();
    final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
    final RectF rectF = new RectF(rect);
    final float roundPx = bitmap.getWidth() / 2;

    paint.setAntiAlias(true);
    canvas.drawARGB(0, 0, 0, 0);
    paint.setColor(color);
    canvas.drawRoundRect(rectF, roundPx, roundPx, paint);

    paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
    canvas.drawBitmap(bitmap, rect, rect, paint);

    return output;
  }
  private Bitmap makeProperBitmap(final Bitmap aBitmap, final int aWidth, final int aHeight) {
    final Bitmap bitmap = Bitmap.createBitmap(aWidth, aHeight, Bitmap.Config.ARGB_8888);
    myTextureCloneCanvas.setBitmap(bitmap);
    myTextureCloneCanvas.drawBitmap(aBitmap, 0, 0, myTextureClonePaint);

    // #if DEBUG
    Log.debug("created proper texture bitmap");
    Log.debug("bitmap size: {}x{}", aBitmap.getWidth(), aBitmap.getHeight());
    Log.debug("proper size: {}x{}", aWidth, aHeight);
    // #endif

    return bitmap;
  }