Applies the alpha-component of the alpha image to the given image.
The given image is modified in place.

@param pImage the image to apply alpha to
@param pAlpha the image containing the alpha
334042
private static void applyAlpha(BufferedImage pImage, BufferedImage pAlpha) {
        // Apply alpha as transparency, using threshold of 25%
        for (int y = 0; y < pAlpha.getHeight(); y++) {
            for (int x = 0; x < pAlpha.getWidth(); x++) {

                // Get alpha component of pixel, if less than 25% opaque
                // (0x40 = 64 => 25% of 256), the pixel will be transparent
                if (((pAlpha.getRGB(x, y) >> 24) & 0xFF) < 0x40) {
                    pImage.setRGB(x, y, 0x00FFFFFF); // 100% transparent
                }
            }
        }
    }
952983
public static void setImageBitmap(EfficientCacheView cacheView, int viewId, Bitmap bm) {
        View view = cacheView.findViewByIdEfficient(viewId);
        if (view instanceof ImageView) {
            ((ImageView) view).setImageBitmap(bm);
        }
    }
455134
public synchronized void setBufferedImage(BufferedImage image) {
		// assume the image was initially set before the GUI was invoked
		if( checkEventDispatch && this.img != null ) {
			if( !SwingUtilities.isEventDispatchThread() )
				throw new RuntimeException("Changed image when not in GUI thread?");
		}

		this.img = image;
		if( image != null )
			updateSize(image.getWidth(),image.getHeight());
	}
1301984
protected RenderedImage doFilter(BufferedImage pImage, ServletRequest pRequest, ImageServletResponse pResponse) {
        // Get crop coordinates
        int x = ServletUtil.getIntParameter(pRequest, PARAM_CROP_X, -1);
        int y = ServletUtil.getIntParameter(pRequest, PARAM_CROP_Y, -1);
        int width = ServletUtil.getIntParameter(pRequest, PARAM_CROP_WIDTH, -1);
        int height = ServletUtil.getIntParameter(pRequest, PARAM_CROP_HEIGHT, -1);

        boolean uniform =
                ServletUtil.getBooleanParameter(pRequest, PARAM_CROP_UNIFORM, false);

        int units = getUnits(ServletUtil.getParameter(pRequest, PARAM_CROP_UNITS, null));

        // Get crop bounds
        Rectangle bounds =
                getBounds(x, y, width, height, units, uniform, pImage);

        // Return cropped version
        return pImage.getSubimage((int) bounds.getX(), (int) bounds.getY(),
                                  (int) bounds.getWidth(),
                                  (int) bounds.getHeight());
        //return scaled.getSubimage(x, y, width, height);
    }
243676
public void addHiDpiImage(String factor, CmsJspImageBean image) {

        if (m_hiDpiImages == null) {
            m_hiDpiImages = CmsCollectionsGenericWrapper.createLazyMap(new CmsScaleHiDpiTransformer());
        }
        m_hiDpiImages.put(factor, image);
    }
1309984
public static BufferedImage applyMask(BufferedImage image, int rgba)
    {
        final BufferedImage mask = copyImage(image);
        final int height = mask.getHeight();
        final int width = mask.getWidth();

        for (int y = 0; y < height; y++)
        {
            for (int x = 0; x < width; x++)
            {
                final int col = mask.getRGB(x, y);
                final int flag = 0x00_FF_FF_FF;
                if (col == rgba)
                {
                    mask.setRGB(x, y, col & flag);
                }
            }
        }
        return mask;
    }
586651
public void setImage(GrayF32 image) {

		scaleSpace.initialize(image);

		usedScales.clear();
		do {
			for (int i = 0; i < scaleSpace.getNumScales(); i++) {
				GrayF32 scaleImage = scaleSpace.getImageScale(i);
				double sigma = scaleSpace.computeSigmaScale(i);
				double pixelCurrentToInput = scaleSpace.pixelScaleCurrentToInput();

				ImageScale scale = allScales.get(usedScales.size());
				scale.derivX.reshape(scaleImage.width,scaleImage.height);
				scale.derivY.reshape(scaleImage.width,scaleImage.height);

				gradient.process(scaleImage,scale.derivX,scale.derivY);
				scale.imageToInput = pixelCurrentToInput;
				scale.sigma = sigma;

				usedScales.add(scale);
			}
		} while( scaleSpace.computeNextOctave() );
	}
733908
public final void setA(double alpha, int x, int y){
        int[] pixels = ((DataBufferInt)img.getRaster().getDataBuffer()).getData();
        int idx = x + y * width;
        int tmpR = pixels[idx] >> 16 & 0x000000ff;
        int tmpG = pixels[idx] >> 8  & 0x000000ff;
        int tmpB = pixels[idx]       & 0x000000ff;
        pixels[idx] = (int)alpha << 24 |
                            tmpR << 16 |
                            tmpG << 8  |
                            tmpB;
    }
461050
public static void apply(View parent, int viewId, Face type){
        TextView text = (TextView) parent.findViewById(viewId);
        if(text != null)
            apply(text, type);
    }
542531
public void setImage(Image image) {
        column.setText(null);
        table = null;
        this.image = image;
    }
1171291
private static void applyForView(View view, TypefaceCollection typefaceCollection) {

		if (view instanceof TextView) {
			TextView textView = (TextView) view;
			Typeface oldTypeface = textView.getTypeface();
			final int style = oldTypeface == null ? Typeface.NORMAL : oldTypeface.getStyle();
			textView.setTypeface(typefaceCollection.getTypeface(style));
			textView.setPaintFlags(textView.getPaintFlags() | Paint.SUBPIXEL_TEXT_FLAG);
		}
	}
285601
public static void changeAlpha(String oldPath, String newPath, byte alpha) throws IOException {
        changeAlpha(new FileInputStream(oldPath), new FileOutputStream(newPath), alpha);
    }
531214
public void setImage(ImagePyramid<InputImage> image ) {
		this.image = image;
		this.derivX = null;
		this.derivY = null;
	}
676614
public static void applyDecidedIconOrSetGone(ImageHolder imageHolder, ImageView imageView, int iconColor, boolean tint) {
        if (imageHolder != null && imageView != null) {
            Drawable drawable = ImageHolder.decideIcon(imageHolder, imageView.getContext(), iconColor, tint);
            if (drawable != null) {
                imageView.setImageDrawable(drawable);
                imageView.setVisibility(View.VISIBLE);
            } else if (imageHolder.getBitmap() != null) {
                imageView.setImageBitmap(imageHolder.getBitmap());
                imageView.setVisibility(View.VISIBLE);
            } else {
                imageView.setVisibility(View.GONE);
            }
        } else if (imageView != null) {
            imageView.setVisibility(View.GONE);
        }
    }
968248
static BufferedImage convertImage (BufferedImage image) {
    switch (image.getType()) {
    case BufferedImage.TYPE_INT_ARGB_PRE:
      return image; // Already good to go
    case BufferedImage.TYPE_4BYTE_ABGR:
      image.coerceData(true); // Just premultiply the alpha and it's fine
      return image;
    }

    // Didn't know an easy thing to do, so create a whole new image in our preferred format
    BufferedImage convertedImage = new BufferedImage(image.getWidth(), image.getHeight(),
                                                     BufferedImage.TYPE_INT_ARGB_PRE);
    Graphics g = convertedImage.getGraphics();
    g.setColor(new Color(0f, 0f, 0f, 0f));
    g.fillRect(0, 0, image.getWidth(), image.getHeight());
    g.drawImage(image, 0, 0, null);

    return convertedImage;
  }
1328545
public void setProgressBarImage(Drawable drawable, ScalingUtils.ScaleType scaleType) {
    setChildDrawableAtIndex(PROGRESS_BAR_IMAGE_INDEX, drawable);
    getScaleTypeDrawableAtIndex(PROGRESS_BAR_IMAGE_INDEX).setScaleType(scaleType);
  }
1034038
public void process( BufferedImage image ) {
		T input = ConvertBufferedImage.convertFromSingle(image, null, imageType);
		pyramid.process(input);

		DiscretePyramidPanel gui = new DiscretePyramidPanel();
		gui.setPyramid(pyramid);
		gui.render();

		ShowImages.showWindow(gui,"Image Pyramid");

		// To get an image at any of the scales simply call this get function
		T imageAtScale = pyramid.getLayer(1);

		ShowImages.showWindow(ConvertBufferedImage.convertTo(imageAtScale,null,true),"Image at layer 1");
	}