Apply filter to an image.

@param source FastBitmap
353692
@Override
    public ImageSource apply(ImageSource source) {
        if (radius != 0) {
            if (source.isGrayscale()) {
                return applyGrayscale(source, radius);
            } else {
                return applyRGB(source, radius);
            }
        } else {
            if (source.isGrayscale()) {
                return applyGrayscale(source, kernel);
            } else {
                return applyRGB(source, kernel);
            }
        }
    }
303492
public void addFilter(Filter filter)
   {
      if (filter.isTaskFilter())
      {
         m_taskFilters.add(filter);
      }

      if (filter.isResourceFilter())
      {
         m_resourceFilters.add(filter);
      }

      m_filtersByName.put(filter.getName(), filter);
      m_filtersByID.put(filter.getID(), filter);
   }
1349981
public void process(T input, T output) {

		this.output = FactoryGImageGray.wrap(output,this.output);
		interp.setImage(input);

		int indexMap = 0;
		for( int i = 0; i < output.height; i++ ) {
			int indexOut = output.startIndex + i*output.stride;
			for( int j = 0; j < output.width; j++ , indexOut++,indexMap++ ) {
				Point2D_F32 p = mapPixels[indexMap];
				if( p != null ) {
					this.output.set(indexOut,interp.get( p.x, p.y));
				}
			}
		}
	}
1369422
public void setFilter(Filter filter)
    {
        if (this.filter == null)
        {
            this.filter = new FilterList();
        }
        if (filter != null)
        {
            this.filter.addFilter(filter);
        }
    }
759428
private void processSwatch(Bitmap image) {
        final Map<Integer, Integer> colorHistogram = processLuminanceData(image);
        extractFgBgData(colorHistogram);

        // Two-decimal digits of precision for the contrast ratio
        mContrastRatio = Math.round(
                ContrastUtils.calculateContrastRatio(mBackgroundLuminance, mForegroundLuminance)
                * 100.0d) / 100.0d;
    }
311624
void initResolution(Resolution source)
    {
        Check.notNull(source);

        setSystemCursorVisible(cursorVisibility.booleanValue());
        this.source = source;
        screen.onSourceChanged(source);
        final int width = source.getWidth();
        final int height = source.getHeight();

        // Standard rendering
        final Resolution output = config.getOutput();
        if (FilterNone.INSTANCE.equals(filter) && width == output.getWidth() && height == output.getHeight())
        {
            buf = null;
            transform = null;
        }
        // Scaled rendering
        else
        {
            buf = Graphics.createImageBuffer(width, height);
            transform = getTransform();
            final Graphic gbuf = buf.createGraphic();
            graphic.setGraphic(gbuf.getGraphic());
        }
    }
962290
protected RenderedImage doFilter(BufferedImage pImage, ServletRequest pRequest, ImageServletResponse pResponse) {
        // Get angle
        double ang = getAngle(pRequest);

        // Get bounds
        Rectangle2D rect = getBounds(pRequest, pImage, ang);
        int width = (int) rect.getWidth();
        int height = (int) rect.getHeight();

        // Create result image
        BufferedImage res = ImageUtil.createTransparent(width, height, BufferedImage.TYPE_INT_ARGB);
        Graphics2D g = res.createGraphics();

        // Get background color and clear
        String str = pRequest.getParameter(PARAM_BGCOLOR);
        if (!StringUtil.isEmpty(str)) {
            Color bgcolor = StringUtil.toColor(str);
            g.setBackground(bgcolor);
            g.clearRect(0, 0, width, height);
        }

        // Set mHints (why do I always get jagged edgdes?)
        RenderingHints hints = new RenderingHints(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
        hints.add(new RenderingHints(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY));
        hints.add(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON));
        hints.add(new RenderingHints(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC));

        g.setRenderingHints(hints);

        // Rotate around center
        AffineTransform at = AffineTransform
                .getRotateInstance(ang, width / 2.0, height / 2.0);

        // Move to center
        at.translate(width / 2.0 - pImage.getWidth() / 2.0,
                     height / 2.0 - pImage.getHeight() / 2.0);

        // Draw it, centered
        g.drawImage(pImage, at, null);

        return res;
    }
566941
public void apply(final String filter, final TileFunction<VectorTile> callback) {
		switch (getStatus()) {
			case EMPTY:
				fetch(filter, callback);
				break;
			case LOADING:
				if (needsReload(filter)) {
					deferred.cancel();
					fetch(filter, callback);
				} else {
					final VectorTile self = this;
					deferred.addCallback(new AbstractCommandCallback<GetVectorTileResponse>() {

						public void execute(GetVectorTileResponse response) {
							callback.execute(self);
						}
					});
				}
				break;
			case LOADED:
				if (needsReload(filter)) {
					// Check if the labels need to be fetched as well:
					fetch(filter, callback);
				} else {
					callback.execute(this);
				}
				break;
			default:
				throw new IllegalStateException("Unknown status " + getStatus());
		}
	}
964418
public void setWaterMarks(String source, long lwmScn, long hwmScn) {
        WaterMarkEntry e = sourceWaterMarkMap.get(source);
        if (e == null) {
            e = new WaterMarkEntry(source);
            sourceWaterMarkMap.put(source, e);
        }
        e.setLWMScn(lwmScn);
        e.setHWMScn(hwmScn);
    }
867308
private static List<ImageConfiguration> filterImages(String nameFilter, List<ImageConfiguration> imagesToFilter) {
        List<ImageConfiguration> ret = new ArrayList<>();
        for (ImageConfiguration imageConfig : imagesToFilter) {
            if (matchesConfiguredImages(nameFilter, imageConfig)) {
                ret.add(imageConfig);
            }
        }
        return ret;
    }
1332033
public void setImage(T image ) {
		match.setInputImage(image);
		this.imageWidth = image.width;
		this.imageHeight = image.height;
	}
1072335
private void initValuesFrom(CmsImageScaler source) {

        m_color = source.m_color;
        m_cropHeight = source.m_cropHeight;
        m_cropWidth = source.m_cropWidth;
        m_cropX = source.m_cropX;
        m_cropY = source.m_cropY;
        m_filters = new ArrayList<String>(source.m_filters);
        m_focalPoint = source.m_focalPoint;
        m_height = source.m_height;
        m_isOriginalScaler = source.m_isOriginalScaler;
        m_maxBlurSize = source.m_maxBlurSize;
        m_position = source.m_position;
        m_quality = source.m_quality;
        m_renderMode = source.m_renderMode;
        m_type = source.m_type;
        m_width = source.m_width;

    }
602609
protected function applyFilters()
  {
    if ($this->emptyRessource) {
      $source = $this->emptyRessource;
    } else if ($this->extension == self::IMAGE_TYPE_JPG) {
      $source = imagecreatefromjpeg($this->path);
    } else if ($this->extension == self::IMAGE_TYPE_PNG) {
      $source = imagecreatefrompng($this->path);
      imagealphablending($source, false);
      imagesavealpha($source, true);
    }
    foreach($this->filters as $filtre) {
      $source = $filtre->apply($source);
    }
    $this->buildedRessource = $source;
    return $source;
  }
144380
private void applyFilters(List<TreeModelFilter<SQLPPTriplesMap>> filters) {
		FilteredModel model = (FilteredModel) mappingList.getModel();
		model.removeAllFilters();
		model.addFilters(filters);
	}
1199059
public static void independent( BufferedImage input ) {
		// convert the BufferedImage into a Planar
		Planar<GrayU8> image = ConvertBufferedImage.convertFromPlanar(input,null,true,GrayU8.class);

		// declare the output blurred image
		Planar<GrayU8> blurred = image.createSameShape();
		
		// Apply Gaussian blur to each band in the image
		for( int i = 0; i < image.getNumBands(); i++ ) {
			// note that the generalized version of BlurImageOps is not being used, but the type
			// specific version.
			BlurImageOps.gaussian(image.getBand(i),blurred.getBand(i),-1,5,null);
		}
		
		// Declare the BufferedImage manually to ensure that the color bands have the same ordering on input
		// and output
		BufferedImage output = new BufferedImage(image.width,image.height,input.getType());
		ConvertBufferedImage.convertTo(blurred, output,true);

		gui.addImage(input,"Input");
		gui.addImage(output,"Gaussian Blur");
	}
30845
public void setFilter(int f) {
		this.filter = f == FILTER_LINEAR ? SGL.GL_LINEAR : SGL.GL_NEAREST;

		texture.bind();
		GL.glTexParameteri(SGL.GL_TEXTURE_2D, SGL.GL_TEXTURE_MIN_FILTER, filter); 
        GL.glTexParameteri(SGL.GL_TEXTURE_2D, SGL.GL_TEXTURE_MAG_FILTER, filter); 
	}
711109
public Texture getTexture(ImageData dataSource, int filter) throws IOException
    { 
    	int target = SGL.GL_TEXTURE_2D;

        ByteBuffer textureBuffer;
    	textureBuffer = dataSource.getImageBufferData();
    	
        // create the texture ID for this texture 
        int textureID = createTextureID(); 
        TextureImpl texture = new TextureImpl("generated:"+dataSource, target ,textureID); 
        
        int minFilter = filter;
        int magFilter = filter;
        boolean flipped = false;
        
        // bind this texture 
        GL.glBindTexture(target, textureID); 
    	
        int width;
        int height;
        int texWidth;
        int texHeight;
        
        boolean hasAlpha;
    	
    	width = dataSource.getWidth();
    	height = dataSource.getHeight();
    	hasAlpha = dataSource.getDepth() == 32;
    	
    	texture.setTextureWidth(dataSource.getTexWidth());
    	texture.setTextureHeight(dataSource.getTexHeight());

        texWidth = texture.getTextureWidth();
        texHeight = texture.getTextureHeight();
        
        int srcPixelFormat = hasAlpha ? SGL.GL_RGBA : SGL.GL_RGB;
        int componentCount = hasAlpha ? 4 : 3;
        
        texture.setWidth(width);
        texture.setHeight(height);
        texture.setAlpha(hasAlpha);
        
        IntBuffer temp = BufferUtils.createIntBuffer(16);
        GL.glGetInteger(SGL.GL_MAX_TEXTURE_SIZE, temp);
        int max = temp.get(0);
        if ((texWidth > max) || (texHeight > max)) {
        	throw new IOException("Attempt to allocate a texture to big for the current hardware");
        }

        if (holdTextureData) {
        	texture.setTextureData(srcPixelFormat, componentCount, minFilter, magFilter, textureBuffer);
        }
        
        GL.glTexParameteri(target, SGL.GL_TEXTURE_MIN_FILTER, minFilter); 
        GL.glTexParameteri(target, SGL.GL_TEXTURE_MAG_FILTER, magFilter); 
        
        // produce a texture from the byte buffer
        GL.glTexImage2D(target, 
                      0, 
                      dstPixelFormat, 
                      get2Fold(width), 
                      get2Fold(height), 
                      0, 
                      srcPixelFormat, 
                      SGL.GL_UNSIGNED_BYTE, 
                      textureBuffer); 
        
        return texture; 
    }