Guidance
指路人
g.yi.org
software / rapidq / Examples / Graphics & Animation / overlay / overlay.bas

Register 
新用户注册
Search 搜索
首页 
Home Home
Software
Upload

  
' Very simple overlay/translucency effect for Rapid-Q by William Yu
' Just a demo, there's obviously some tricks you'll have to worry about.
' Yes, it's slow...

     $TYPECHECK ON
     $INCLUDE "RAPIDQ.INC"

     DECLARE SUB Button.Click
     DECLARE SUB Image.Paint

     CREATE Form AS QFORM
      CREATE Image AS QCANVAS
       Height = 200
       Width = 200
       OnPaint = Image.Paint
      END CREATE
      CREATE Label1 AS QLABEL
       Left = 210
       Top = 12
       CAPTION = "R:"
      END CREATE
      CREATE Edit1 AS QEDIT
       Left = 225
       Top = 10
       Width = 50
       Text = "20"
      END CREATE
      CREATE Label2 AS QLABEL
       Left = 210
       Top = 37
       CAPTION = "G:"
      END CREATE
      CREATE Edit2 AS QEDIT
       Left = 225
       Top = 35
       Width = 50
       Text = "20"
      END CREATE
      CREATE Label3 AS QLABEL
       Left = 210
       Top = 62
       CAPTION = "B:"
      END CREATE
      CREATE Edit3 AS QEDIT
       Left = 225
       Top = 60
       Width = 50
       Text = "20"
      END CREATE
      CREATE Button AS QBUTTON
       Left = 215
       Top = 120
       CAPTION = "&Start"
       OnClick = Button.Click
      END CREATE
      CAPTION = "Overlay demo"
      Center
     END CREATE

     Form.SHOWMODAL

     SUB Button.Click
      DIM I AS INTEGER, J AS INTEGER
      DIM Colour AS INTEGER

      Colour = RGB(VAL(Edit1.Text), VAL(Edit2.Text), VAL(Edit3.Text))

      FOR I = 0 TO Image.Width
       FOR J = 0 TO Image.Height
        DOEVENTS
        Image.Pixel(I,J) = Image.Pixel(I,J) - Colour
       NEXT
      NEXT
     END SUB


     SUB Image.Paint
      DIM I AS INTEGER
      DIM Font AS QFONT
      Font.Size = 15
      Font.AddStyles(fsBold)
      DIM Colors(0 TO 14) AS INTEGER

      Colors(0) = &H111111
      Colors(1) = &H222222
      Colors(2) = &H333333
      Colors(3) = &H444444
      Colors(4) = &H555555
      Colors(5) = &H666666
      Colors(6) = &H777777
      Colors(7) = &H888888
      Colors(8) = &H999999
      Colors(9) = &HAAAAAA
      Colors(10) = &HBBBBBB
      Colors(11) = &HCCCCCC
      Colors(12) = &HDDDDDD
      Colors(13) = &HEEEEEE
      Colors(14) = &HFFFFFF

      RANDOMIZE
      FOR I = 1 TO Image.Width
       Image.FillRect(RND(Image.Width), RND(Image.Height), RND(Image.Width), RND(Image.Height), Colors(RND(15)))
      NEXT I
      Image.Font = Font
      Image.TextOut(10,10,"Rapid-Q Rocks!",&HFF9999,-1)
     END SUB
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Fri 2019-4-26  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2000-05-17 22:41:00