当前位置: 首页>>代码示例>>Java>>正文


Java AlphaComposite.SRC_IN属性代码示例

本文整理汇总了Java中java.awt.AlphaComposite.SRC_IN属性的典型用法代码示例。如果您正苦于以下问题:Java AlphaComposite.SRC_IN属性的具体用法?Java AlphaComposite.SRC_IN怎么用?Java AlphaComposite.SRC_IN使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在java.awt.AlphaComposite的用法示例。


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

示例1: forAlphaComposite

/**
 * Return a CompositeType object for the specified AlphaComposite
 * rule.
 */
public static CompositeType forAlphaComposite(AlphaComposite ac) {
    switch (ac.getRule()) {
    case AlphaComposite.CLEAR:
        return Clear;
    case AlphaComposite.SRC:
        if (ac.getAlpha() >= 1.0f) {
            return SrcNoEa;
        } else {
            return Src;
        }
    case AlphaComposite.DST:
        return Dst;
    case AlphaComposite.SRC_OVER:
        if (ac.getAlpha() >= 1.0f) {
            return SrcOverNoEa;
        } else {
            return SrcOver;
        }
    case AlphaComposite.DST_OVER:
        return DstOver;
    case AlphaComposite.SRC_IN:
        return SrcIn;
    case AlphaComposite.DST_IN:
        return DstIn;
    case AlphaComposite.SRC_OUT:
        return SrcOut;
    case AlphaComposite.DST_OUT:
        return DstOut;
    case AlphaComposite.SRC_ATOP:
        return SrcAtop;
    case AlphaComposite.DST_ATOP:
        return DstAtop;
    case AlphaComposite.XOR:
        return AlphaXor;
    default:
        throw new InternalError("Unrecognized alpha rule");
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:42,代码来源:CompositeType.java

示例2: SunCompositeContext

/**
 * Creates a new AlphaCompositeContext.
 *
 * @param aComp the AlphaComposite object 
 * @param srcCM the source color model
 * @param dstCM the destination color model
 */
public SunCompositeContext(AlphaComposite aComp, ColorModel srcCM,
                             ColorModel dstCM)
{
  composite = aComp;
  srcColorModel = srcCM;
  dstColorModel = dstCM;

  
  // Determine the blending factors according to the rule in the
  // AlphaComposite. For some rules the factors must be determined
  // dynamically because they depend on the actual pixel value.
  switch (composite.getRule())
  {
    case AlphaComposite.CLEAR:
      fs = 0.F;
      fd= 0.F;
      break;
    case AlphaComposite.DST:
      fs = 0.F;
      fd= 1.F;
      break;
    case AlphaComposite.DST_ATOP:
      fs = 1.F; // Determined later as 1 - alpha_dst;
      fd = 1.F; // Determined later as alpha_src;
      break;
    case AlphaComposite.DST_IN:
      fs = 0.F;
      fd = 0.F; // Determined later as alpha_src;
      break;
    case AlphaComposite.DST_OUT:
      fs = 0.F;
      fd = 0.F; // Determined later as 1 - alpha_src;
      break;
    case AlphaComposite.DST_OVER:
      fs = 1.F; // Determined later as 1 - alpha_dst.
      fd= 1.F;
      break;
    case AlphaComposite.SRC:
      fs = 1.F;
      fd= 0.F;
      break;
    case AlphaComposite.SRC_ATOP:
      fs = 1.F; // Determined later as alpha_dst;
      fd = 1.F; // Determined later as 1 - alpha_src;
      break;
    case AlphaComposite.SRC_IN:
      fs = 0.F; // Determined later as alpha_dst;
      fd = 0.F;
      break;
    case AlphaComposite.SRC_OUT:
      fs = 0.F; // Determined later as 1 - alpha_dst;
      fd = 0.F;
      break;
    case AlphaComposite.SRC_OVER:
      fs = 1.F;
      fd= 1.F; // Determined later as 1 - alpha_src.
      break;
    case AlphaComposite.XOR:
      fs = 1.F; // Determined later as 1 - alpha_dst.
      fd= 1.F; // Determined later as 1 - alpha_src.
      break;
    default:
      throw new AWTError("Illegal AlphaComposite rule");
  }

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:73,代码来源:SunCompositeContext.java


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