• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java BandCombineOp类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中java.awt.image.BandCombineOp的典型用法代码示例。如果您正苦于以下问题:Java BandCombineOp类的具体用法?Java BandCombineOp怎么用?Java BandCombineOp使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BandCombineOp类属于java.awt.image包,在下文中一共展示了BandCombineOp类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: recolor

import java.awt.image.BandCombineOp; //导入依赖的package包/类
public static BufferedImage recolor(BufferedImage src, Color sc)
{
	float[][] colorMatrix =
	{
			{
					((float)sc.getRed()) / 255f, 0, 0, 0
			},
			{
					((float)sc.getGreen()) / 255f, 0, 0, 0
			},
			{
					((float)sc.getBlue()) / 255f, 0, 0, 0
			},
			{
					0f, 0f, 0f, 1f
			}
	};
	BandCombineOp changeColors = new BandCombineOp(colorMatrix, null);
	Raster sourceRaster = src.getRaster();
	WritableRaster displayRaster = sourceRaster.createCompatibleWritableRaster();
	changeColors.filter(sourceRaster, displayRaster);
	return new BufferedImage(src.getColorModel(), displayRaster, true, null);
}
 
开发者ID:jglrxavpok,项目名称:jglrEngine,代码行数:24,代码来源:ImageUtils.java


示例2: filter

import java.awt.image.BandCombineOp; //导入依赖的package包/类
@Override
   public BufferedImage filter(BufferedImage src, BufferedImage dst) {
       int width = src.getWidth();
       int height = src.getHeight();

       float xOffset = distance * (float) Math.cos(angle);
       float yOffset = -distance * (float) Math.sin(angle);

       if (dst == null) {
           if (addMargins) {
               ColorModel cm = src.getColorModel();
               dst = new BufferedImage(cm, cm.createCompatibleWritableRaster(src.getWidth() + (int) (Math.abs(xOffset) + radius), src.getHeight() + (int) (Math.abs(yOffset) + radius)), cm.isAlphaPremultiplied(), null);
           } else {
               dst = createCompatibleDestImage(src, null);
           }
       }

       float shadowR = ((shadowColor >> 16) & 0xff) / 255f;
       float shadowG = ((shadowColor >> 8) & 0xff) / 255f;
       float shadowB = (shadowColor & 0xff) / 255f;

       // Make a black mask from the image's alpha channel
       float[][] extractAlpha = {
               {0, 0, 0, shadowR},
               {0, 0, 0, shadowG},
               {0, 0, 0, shadowB},
               {0, 0, 0, opacity}
       };
       BufferedImage shadow = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
       new BandCombineOp(extractAlpha, null).filter(src.getRaster(), shadow.getRaster());
       shadow = new GaussianFilter(radius).filter(shadow, null);

       Graphics2D g = dst.createGraphics();
       g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, opacity));
       if (addMargins) {
           float radius2 = radius / 2;
           float topShadow = Math.max(0, radius - yOffset);
           float leftShadow = Math.max(0, radius - xOffset);
           g.translate(leftShadow, topShadow);
       }
       g.drawRenderedImage(shadow, AffineTransform.getTranslateInstance(xOffset, yOffset ) );
	if ( !shadowOnly ) {
		g.setComposite( AlphaComposite.SrcOver );
		g.drawRenderedImage( src, null );
	}
	g.dispose();

       return dst;
}
 
开发者ID:teddyted,项目名称:iSeleda,代码行数:50,代码来源:ShadowFilter.java


示例3: filter

import java.awt.image.BandCombineOp; //导入依赖的package包/类
public BufferedImage filter( BufferedImage src, BufferedImage dst ) {
       int width = src.getWidth();
       int height = src.getHeight();

       if ( dst == null ) {
           if ( addMargins ) {
			ColorModel cm = src.getColorModel();
			dst = new BufferedImage(cm, cm.createCompatibleWritableRaster(src.getWidth(), src.getHeight()), cm.isAlphaPremultiplied(), null);
		} else
			dst = createCompatibleDestImage( src, null );
	}

       float shadowR = ((shadowColor >> 16) & 0xff) / 255f;
       float shadowG = ((shadowColor >> 8) & 0xff) / 255f;
       float shadowB = (shadowColor & 0xff) / 255f;

	// Make a black mask from the image's alpha channel 
       float[][] extractAlpha = {
           { 0, 0, 0, shadowR },
           { 0, 0, 0, shadowG },
           { 0, 0, 0, shadowB },
           { 0, 0, 0, opacity }
       };
       BufferedImage shadow = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
       new BandCombineOp( extractAlpha, null ).filter( src.getRaster(), shadow.getRaster() );
       shadow = new GaussianFilter( radius ).filter( shadow, (BufferedImage)null );

	float xOffset = distance*(float)Math.cos(angle);
	float yOffset = -distance*(float)Math.sin(angle);

	Graphics2D g = dst.createGraphics();
	g.setComposite( AlphaComposite.getInstance( AlphaComposite.SRC_OVER, opacity ) );
	if ( addMargins ) {
		//float radius2 = radius/2;
		float topShadow = Math.max( 0, radius-yOffset );
		float leftShadow = Math.max( 0, radius-xOffset );
		g.translate( topShadow, leftShadow );
	}
	g.drawRenderedImage( shadow, AffineTransform.getTranslateInstance( xOffset, yOffset ) );
	if ( !shadowOnly ) {
		g.setComposite( AlphaComposite.SrcOver );
		g.drawRenderedImage( src, null );
	}
	g.dispose();

       return dst;
}
 
开发者ID:lucee,项目名称:Lucee4,代码行数:48,代码来源:ShadowFilter.java


示例4: filter

import java.awt.image.BandCombineOp; //导入依赖的package包/类
@Override
   public BufferedImage filter( BufferedImage src, BufferedImage dst ) {
       int width = src.getWidth();
       int height = src.getHeight();

       if ( dst == null ) {
           if ( addMargins ) {
			ColorModel cm = src.getColorModel();
			dst = new BufferedImage(cm, cm.createCompatibleWritableRaster(src.getWidth(), src.getHeight()), cm.isAlphaPremultiplied(), null);
		} else {
               dst = createCompatibleDestImage( src, null );
           }
	}

       float shadowR = ((shadowColor >> 16) & 0xff) / 255f;
       float shadowG = ((shadowColor >> 8) & 0xff) / 255f;
       float shadowB = (shadowColor & 0xff) / 255f;

	// Make a black mask from the image's alpha channel 
       float[][] extractAlpha = {
           { 0, 0, 0, shadowR },
           { 0, 0, 0, shadowG },
           { 0, 0, 0, shadowB },
           { 0, 0, 0, opacity }
       };
       BufferedImage shadow = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
       new BandCombineOp( extractAlpha, null ).filter( src.getRaster(), shadow.getRaster() );
       shadow = new GaussianFilter( radius ).filter( shadow, null );

	float xOffset = distance*(float)Math.cos(angle);
	float yOffset = -distance*(float)Math.sin(angle);

	Graphics2D g = dst.createGraphics();
               g.setRenderingHint(RenderingHints.KEY_RENDERING,
                                  RenderingHints.VALUE_RENDER_SPEED);
               g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                  RenderingHints.VALUE_ANTIALIAS_OFF);
               g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
                                  RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
               g.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS,
                                  RenderingHints.VALUE_FRACTIONALMETRICS_OFF);
               g.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING,
                                  RenderingHints.VALUE_COLOR_RENDER_SPEED);
               g.setRenderingHint(RenderingHints.KEY_DITHERING,
                                  RenderingHints.VALUE_DITHER_DISABLE);
	g.setComposite( AlphaComposite.getInstance( AlphaComposite.SRC_OVER, opacity ) );
	if ( addMargins ) {
		float radius2 = radius/2;
		float topShadow = Math.max( 0, radius-yOffset );
		float leftShadow = Math.max( 0, radius-xOffset );
		g.translate( topShadow, leftShadow );
	}
	g.drawRenderedImage( shadow, AffineTransform.getTranslateInstance( xOffset, yOffset ) );
	if ( !shadowOnly ) {
		g.setComposite( AlphaComposite.SrcOver );
		g.drawRenderedImage( src, null );
	}
	g.dispose();

       return dst;
}
 
开发者ID:WebcamStudio,项目名称:webcamstudio,代码行数:62,代码来源:ShadowFilter.java


示例5: filter

import java.awt.image.BandCombineOp; //导入依赖的package包/类
@Override
public BufferedImage filter( BufferedImage src, BufferedImage dst ) {
       int width = src.getWidth();
       int height = src.getHeight();

       if ( dst == null ) {
           if ( addMargins ) {
			ColorModel cm = src.getColorModel();
			dst = new BufferedImage(cm, cm.createCompatibleWritableRaster(src.getWidth(), src.getHeight()), cm.isAlphaPremultiplied(), null);
		} else
			dst = createCompatibleDestImage( src, null );
	}

       float shadowR = ((shadowColor >> 16) & 0xff) / 255f;
       float shadowG = ((shadowColor >> 8) & 0xff) / 255f;
       float shadowB = (shadowColor & 0xff) / 255f;

	// Make a black mask from the image's alpha channel 
       float[][] extractAlpha = {
           { 0, 0, 0, shadowR },
           { 0, 0, 0, shadowG },
           { 0, 0, 0, shadowB },
           { 0, 0, 0, opacity }
       };
       BufferedImage shadow = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
       new BandCombineOp( extractAlpha, null ).filter( src.getRaster(), shadow.getRaster() );
       shadow = new GaussianFilter( radius ).filter( shadow, (BufferedImage)null );

	float xOffset = distance*(float)Math.cos(angle);
	float yOffset = -distance*(float)Math.sin(angle);

	Graphics2D g = dst.createGraphics();
	g.setComposite( AlphaComposite.getInstance( AlphaComposite.SRC_OVER, opacity ) );
	if ( addMargins ) {
		//float radius2 = radius/2;
		float topShadow = Math.max( 0, radius-yOffset );
		float leftShadow = Math.max( 0, radius-xOffset );
		g.translate( topShadow, leftShadow );
	}
	g.drawRenderedImage( shadow, AffineTransform.getTranslateInstance( xOffset, yOffset ) );
	if ( !shadowOnly ) {
		g.setComposite( AlphaComposite.SrcOver );
		g.drawRenderedImage( src, null );
	}
	g.dispose();

       return dst;
}
 
开发者ID:lucee,项目名称:Lucee,代码行数:49,代码来源:ShadowFilter.java


示例6: filter

import java.awt.image.BandCombineOp; //导入依赖的package包/类
@Override
public BufferedImage filter ( BufferedImage src, BufferedImage dst )
{
    int width = src.getWidth ();
    int height = src.getHeight ();

    if ( dst == null )
    {
        if ( addMargins )
        {
            ColorModel cm = src.getColorModel ();
            dst = new BufferedImage ( cm, cm.createCompatibleWritableRaster ( src.getWidth (), src.getHeight () ),
                    cm.isAlphaPremultiplied (), null );
        }
        else
        {
            dst = createCompatibleDestImage ( src, null );
        }
    }

    // Make a black mask from the image's alpha channel
    float[][] extractAlpha = { { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { 0, 0, 0, opacity } };
    BufferedImage shadow = new BufferedImage ( width, height, BufferedImage.TYPE_INT_ARGB );
    new BandCombineOp ( extractAlpha, null ).filter ( src.getRaster (), shadow.getRaster () );
    shadow = new GaussianFilter ( radius ).filter ( shadow, null );

    Graphics2D g = dst.createGraphics ();
    g.setComposite ( AlphaComposite.getInstance ( AlphaComposite.SRC_OVER, opacity ) );
    if ( addMargins )
    {
        int topShadow = Math.max ( 0, radius - yOffset );
        int leftShadow = Math.max ( 0, radius - xOffset );
        g.translate ( topShadow, leftShadow );
    }
    g.drawRenderedImage ( shadow, AffineTransform.getTranslateInstance ( xOffset, yOffset ) );
    if ( !shadowOnly )
    {
        g.setComposite ( AlphaComposite.SrcOver );
        g.drawRenderedImage ( src, null );
    }
    g.dispose ();

    return dst;
}
 
开发者ID:pyros2097,项目名称:WebLookAndFeelLite,代码行数:45,代码来源:ShadowFilter.java


示例7: filter

import java.awt.image.BandCombineOp; //导入依赖的package包/类
public BufferedImage filter( BufferedImage src, BufferedImage dst ) {
       int width = src.getWidth();
       int height = src.getHeight();

	float xOffset = distance*(float)Math.cos(angle);
	float yOffset = -distance*(float)Math.sin(angle);

       if ( dst == null ) {
           if ( addMargins ) {
			ColorModel cm = src.getColorModel();
			dst = new BufferedImage(cm, cm.createCompatibleWritableRaster(src.getWidth() + (int) (Math.abs(xOffset) + radius), src.getHeight() + (int) (Math.abs(yOffset) + radius)), cm.isAlphaPremultiplied(), null);
		} else
			dst = createCompatibleDestImage( src, null );
	}

       float shadowR = ((shadowColor >> 16) & 0xff) / 255f;
       float shadowG = ((shadowColor >> 8) & 0xff) / 255f;
       float shadowB = (shadowColor & 0xff) / 255f;

	// Make a black mask from the image's alpha channel 
       float[][] extractAlpha = {
           { 0, 0, 0, shadowR },
           { 0, 0, 0, shadowG },
           { 0, 0, 0, shadowB },
           { 0, 0, 0, opacity }
       };
       BufferedImage shadow = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
       new BandCombineOp( extractAlpha, null ).filter( src.getRaster(), shadow.getRaster() );
       shadow = new GaussianFilter( radius ).filter( shadow, null );

	Graphics2D g = dst.createGraphics();
	g.setComposite( AlphaComposite.getInstance( AlphaComposite.SRC_OVER, opacity ) );
	if ( addMargins ) {
		float radius2 = radius/2;
		float topShadow = Math.max( 0, radius-yOffset );
		float leftShadow = Math.max( 0, radius-xOffset );
		g.translate( leftShadow, topShadow );
	}
	g.drawRenderedImage( shadow, AffineTransform.getTranslateInstance( xOffset, yOffset ) );
	if ( !shadowOnly ) {
		g.setComposite( AlphaComposite.SrcOver );
		g.drawRenderedImage( src, null );
	}
	g.dispose();

       return dst;
}
 
开发者ID:yingzhuo,项目名称:captcha4j,代码行数:48,代码来源:ShadowFilter.java



注:本文中的java.awt.image.BandCombineOp类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PfxOptions类代码示例发布时间:2022-05-22
下一篇:
Java FileItem类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap