Bloom 效果的使用

 J avaFX中effect包的Bloom类的简单使用方法

请看图:

源代码如下:
  1. /*
  2.  * BloomEffect.fx
  3.  *
  4.  * Created on Dec 30, 2008, 10:50:56 PM
  5.  */
  6. package effects;
  7. import javafx.scene.effect.Blend;
  8. import javafx.scene.effect.BlendMode;
  9. import javafx.scene.effect.Bloom;
  10. import javafx.scene.effect.Flood;
  11. import javafx.scene.Group;
  12. import javafx.scene.paint.Color;
  13. import javafx.scene.Scene;
  14. import javafx.scene.text.Font;
  15. import javafx.scene.text.Text;
  16. import javafx.stage.Stage;
  17. /**
  18.  * 效果不是很好:):)
  19.  */
  20. Stage {
  21.     title: "Bloom Effect Usage"
  22.     width: 250
  23.     height: 200
  24.     scene: Scene {    
  25.         content:[
  26.             Group{ 
  27.                 translateY:-50.0;//在y轴上平移
  28.                 effect:Bloom{ // 效果对象
  29.                     input:Blend{ // 混合效果
  30.                         topInput:Flood{ // 顶端输入
  31.                             paint:Color.YELLOW;
  32.                             x:45;
  33.                             y:45;
  34.                             width:150;
  35.                             height:150;     
  36.                         }
  37.                         bottomInput:Flood{// 底端输入
  38.                             paint:Color.GREEN
  39.                             x:66 
  40.                             y:66
  41.                             width:123 
  42.                             height: 123
  43.                         }
  44.                         mode:BlendMode.SRC_OUT// 混合模式
  45.                     }
  46.            
  47.                 }
  48.                 // 内容
  49.                 content: Text {
  50.                     font: Font { // 字体样式
  51.                         size: 24
  52.                     }
  53.                     x: 10, 
  54.                     y: 30
  55.                     content: "Application content"
  56.                 }
  57.             }
  58.         ]
  59.     }
  60.  }
其主要属性有:input和threshold两个属性,其中input为effects类型,而threshold为Number类型。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值