C#GDI+圖元組態和IronPython指令碼應用之LED影像系統

來源:互聯網
上載者:User

        這段時間一直進行LED影像系統緊張的開發工作,目前成績還是非常“斐然”的,終於有了一點透氣的機會:)

        該系統從技術角度來說包括三點:一是圖元組態(這點和普通的組態軟體沒有什麼區別,由於面對的使用者技術層次相對較低,所以把原來嵌入式組態修改屬性的屬性列表,修改為屬性面板,以直觀的方式修改組件屬性);二是圖片特效製作,圖片特效主要是淡入淡出、旋轉、晶格、移動、放縮等等;三是IronPython指令碼,該指令碼為C#語言開發,是作者為了證明C#效率不行而開發的代碼,沒有想到事與願違,效率反而出奇的好,被微軟收編後,推出了開源的IronPython指令碼,該指令碼最大的特點就是和C#無縫整合,可以引用C#所有的庫,就如C#本身引用一樣,此外還能直接引用C#自己開發的庫(其實和系統庫的引用沒有本質區別),本系統就採用了該指令碼進行特效處理,這樣系統的特效完全實現了定製,並且介面豐富,應對能力極強。

       

 這是指令碼特效編輯器()

這是特效具體的一個指令碼代碼:

 

def process():   
  if this.RunState == 0:
    Init()
    this.RunState = 1
    this.Image = this.Data.BmpImage

  this.Total = 80 / (this.Rate + 1)  
  this.Current = this.Current + 1
  dw=BitmapProcess.GetDiagonalWidth(this.Image.Width,this.Image.Height)
  ds = (float)(dw) / this.Total
  width = ds * (this.Current + this.Total / 2)

  bmp = BitmapProcess.OpenBevel(this.Image, Orientation_Bevel.TopLeft, width, Color.Black)
  bmp = BitmapProcess.OpenBevel(bmp , Orientation_Bevel.BottomRight, width, Color.Black)
  bmp = BitmapProcess.OpenBevel(bmp , Orientation_Bevel.TopRight, width, Color.Black)
  bmp = BitmapProcess.OpenBevel(bmp , Orientation_Bevel.BottomLeft, width, Color.Black)
  this.Data.BmpImage = bmp

  if width >= dw:
    this.Current = this.Total + 1

def Init():
  import clr
  clr.AddReferenceByPartialName("System.Windows.Forms")
  clr.AddReferenceByPartialName("System.Drawing")
  clr.AddReferenceToFile("BitmapProcess.dll")

  from System.Windows.Forms import *
  from System.Drawing import *
  from LBxSoft.Drawing import *

try:
  process()
except:
  print "Error"

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.