grahhics/skin

sprite.graphics 现在内存中画图,知道endFill()才渲染到桌面

 

BitmapData.draw(...)可以取出内存中的图片

 

private function dataGridStyleFunction(

data:Object, column:AdvancedDataGridColumn):Object {

return { color: "blue" };

       }

 

private function columnStyleFunction(

data:Object, column:AdvancedDataGridColumn):Object {

return { color: "red" };

 

 

● ProgrammaticSkin: Implementation of IFlexDisplayObject,ILayoutManagerClient,IInvalidating,ISimpleStyleClient interface. It is the easiest and common superclass.

● Border: the sub-class of ProgrammaticSkin, has been added the property of borderMetrics. If the skin has the border property could use this class.

● RectangularBorder: the sub-class of Border, supports the backgroundImage style.

● UIComponent: Implementation of IStateCleint interface. Easily to produce multi-state skin component

 

 

    DashBorder {

      dashlen: 20;

      gaplen: 20;

    }  

    .tightDashBorder {

      dashlen: 2;

      gaplen: 2;

    }

    .tightDashWideGapBorder {

      dashlen: 2;

      gaplen: 20;

    }

    .wideDashTightGapBorder {

      dashlen: 20;

      gaplen: 2;

    }

 

 

 

import mx.core.UIComponent;

 

  public class DashBorder extends UIComponent{

    private var dashlen:Number = 5;

    private var gaplen:Number = 5;

 

    public function DashBorder(){

      super();

    }

 

    override protected function updateDisplayList

      (unscaledWidth:Number, unscaledHeight:Number):void{

 

      super.updateDisplayList(unscaledWidth, unscaledHeight);

 

      var borderThickness:int = getStyle("borderThickness");

      var borderColor:int = getStyle("borderColor");

 

      graphics.clear();

      graphics.lineStyle(borderThickness, borderColor, 1)

 

      if (getStyle("dashlen")) {

           this.dashlen = getStyle("dashlen");

      }

      if (getStyle("gaplen")) {

           this.gaplen = getStyle("gaplen");

      }

 

      drawBorder(this.x, this.y, unscaledWidth, unscaledHeight,

        this.dashlen, this.gaplen);

    }

 

    public function drawLine(x1:Number, y1:Number, x2:Number, y2:Number,

      dashlen:Number, gaplen:Number): void {   

      if((x1 != x2) || (y1 != y2)){

        var incrlen:Number = dashlen + gaplen;

 

        var len:Number = Math.sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));

        var angle:Number = Math.atan((y2 - y1) / (x2 - x1));

        var steps:uint = len / (dashlen + gaplen);

 

        var dashstepx:Number = dashlen * Math.cos(angle);

        if (x2 < x1) dashstepx *= -1;

 

        var dashstepy:Number = dashlen * Math.sin(angle);

 

        var gapstepx:Number = gaplen * Math.cos(angle);

        if (x2 < x1) gapstepx *= -1;

 

        var gapstepy:Number = gaplen * Math.sin(angle);

        var stepcount:uint = 0;

 

        while ((stepcount++) < steps) {      

 

          var dashstartx:Number;

          var dashstarty:Number;

          var dashendx:Number;

          var dashendy:Number;

 

          if(x1 == x2 && y1 != y2){

            dashstartx = dashendx = x1;

            if(y2 > y1){

              dashstarty = y1 + ((stepcount-1) * (dashlen + gaplen));            

              dashendy = dashstarty + dashlen;

            }else{

              dashstarty = y1 - ((stepcount-1) * (dashlen + gaplen));            

              dashendy = dashstarty - dashlen;

            }

          }else if(y1 == y2 && x1 != x2){

            dashstarty = dashendy = y1;

            if(x2 > x1){

              dashstartx = x1 + ((stepcount-1) * (dashlen + gaplen));

              dashendx = dashstartx + dashlen;

            }else{

              dashstartx = x1 - ((stepcount-1) * (dashlen + gaplen));

              dashendx = dashstartx - dashlen;

            }

          }

          graphics.moveTo(dashstartx, dashstarty);

          graphics.lineTo(dashendx, dashendy);

        }

      }

    }

 

    private function drawBorder(x1:Number, y1:Number, width:Number, height:Number,

      dashlen:Number, gaplen:Number) : void {

      drawLine(x1, y1, x1 + width, y1, dashlen, gaplen);

      drawLine(x1 + width, y1, x1 + width, y1 + height, dashlen, gaplen);

      drawLine(x1 + width, y1 + height, x1, y1 + height, dashlen, gaplen);

      drawLine(x1, y1 + height, x1, y1, dashlen, gaplen);

    }  

  }

 

 

 

 

 

 

ui->cBox_Speaker->setStyleSheet("QComboBox{combobox-popup: 0;border-image: url(:/Resources/Skin/Images/cBox/dropdownCollapse_sel.png);padding-left: 30px; color: rgb(255, 255, 255);icon: url(:/image/Headphones/AllEdit/add.png);}" "QComboBox::drop-down{border-image: url(:/Resources/Skin/Images/cBox/droptriangle_no.png);margin-top:13px;margin-right:10px;height:10px;width:7px;}" "QComboBox::drop-down:checked{border-image: url(:/Resources/Skin/Images/cBox/droptriangle_se.png);margin-top:13px;margin-right:10px;height:8px;width:8px;}" "QListView{padding-left: 30px;position: absolute;bottom: 0;image: url(:/Resources/Skin/Images/cBox/dropdownBtn_bk.png);color: rgb(206, 207, 211);}" "QListView::item {height: 40px;}" "QListView::item:selected{image: url(:/Resources/Skin/Images/cBox/dropDownBtn_sel.png);color: rgb(206, 207, 211);}" "QListView::item:hover{color: rgb(206, 207, 211);}" ); ui->cBox_Mic->setStyleSheet("QComboBox{combobox-popup: 0;border-image: url(:/Resources/Skin/Images/cBox/dropdownCollapse_sel.png);padding-left: 30px; color: rgb(255, 255, 255);icon: url(:/image/Headphones/AllEdit/add.png);}" "QComboBox::drop-down{border-image: url(:/Resources/Skin/Images/cBox/droptriangle_no.png);margin-top:13px;margin-right:10px;height:10px;width:7px;}" "QComboBox::drop-down:checked{border-image: url(:/Resources/Skin/Images/cBox/droptriangle_se.png);margin-top:13px;margin-right:10px;height:8px;width:8px;}" "QListView{padding-left: 30px;position: absolute;bottom: 0;image: url(:/Resources/Skin/Images/cBox/dropdownBtn_bk.png);color: rgb(206, 207, 211);}" "QListView::item {height: 40px;}" "QListView::item:selected{image: url(:/Resources/Skin/Images/cBox/dropDownBtn_sel.png);color: rgb(206, 207, 211);}" "QListView::item:hover{color: rgb(206, 207, 211);}" );
最新发布
11-26
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值