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

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
' Using IrfanView from RapidQ
' Paul Ludgate 12th March 2005
' Bitmaps are passed to and from IrfanView
' via the clipboard using QBitmapEx
' IrfanView can be obtained free from:-
' http://www.irfanview.com/

     $INCLUDE "RapidQ2.inc"
     $INCLUDE "QIni.inc"

' Alter the next line as needed
     DEFSTR IViewDir = "E:\Program Files\IrfanView"

     DEFSTR IViewIni = IViewDir + "\i_view32.ini"
     DEFSTR IViewPaste = IViewDir + "\i_view32.exe /clippaste "
     DEFSTR IViewCopy  = " /clipcopy /killmesoftly"

     DECLARE SUB CallIView(Cmd AS STRING)
     DECLARE SUB BPP8
     DECLARE SUB BPP8d
     DECLARE SUB BPP4
     DECLARE SUB BPP4d
     DECLARE SUB Gray
     DECLARE SUB Sharpen1
     DECLARE SUB Sharpen2
     DECLARE SUB Sharpen3
     DECLARE SUB Contrast1
     DECLARE SUB Contrast2
     DECLARE SUB Contrast3
     DECLARE SUB Contrast4
     DECLARE SUB Zoom1
     DECLARE SUB Zoom2
     DECLARE SUB Zoom3
     DECLARE SUB Zoom4

     DIM Ini AS QIni
     Ini.FileName = IViewIni
     Ini.Section = "Others"

     DIM BMSrc AS QBITMAPEX
     BMSrc.BMP = "img136.bmp"
     DIM BMRes AS QBITMAPEX
     BMRes.BMP = "img136.bmp"

     CREATE Form AS QFORM
      Top    = 0
      Left   = 200
      Width  = 710
      Height = 500
      CAPTION = "Using IrfanView from RapidQ"
      CREATE Image1 AS QIMAGE
       Top  = 20
       Left = 20
       AutoSize = True
       BMP = BMSrc.BMP
      END CREATE
      CREATE Image2 AS QIMAGE
       Top  = 20
       Left = 360
       AutoSize = True
       BMP = BMRes.BMP
      END CREATE
      CREATE Label1 AS QLABEL
       Top  = 280
       Left = 20
       CAPTION = "Original 24 bit Bitmap"
      END CREATE
      CREATE Label2 AS QLABEL
       Top  = 280
       Left = 360
       CAPTION = "Modified Bitmap"
      END CREATE
      CREATE BPP8Btn AS QBUTTON
       Top   = 330
       Left  = 40
       Width = 140
       CAPTION = "Convert to 8 bit (no Dither)"
       OnClick = BPP8
      END CREATE
      CREATE BPP8dBtn AS QBUTTON
       Top   = 360
       Left  = 40
       Width = 140
       CAPTION = "Convert to 8 bit with Dither"
       OnClick = BPP8d
      END CREATE
      CREATE BPP4Btn AS QBUTTON
       Top   = 390
       Left  = 40
       Width = 140
       CAPTION = "Convert to 4 bit (no Dither)"
       OnClick = BPP4
      END CREATE
      CREATE BPP4dBtn AS QBUTTON
       Top   = 420
       Left  = 40
       Width = 140
       CAPTION = "Convert to 4 bit with Dither"
       OnClick = BPP4d
      END CREATE
      CREATE GrayBtn AS QBUTTON
       Top   = 330
       Left  = 200
       Width = 140
       CAPTION = "Convert to Grayscale"
       OnClick = Gray
      END CREATE
      CREATE Sharpen1Btn AS QBUTTON
       Top   = 360
       Left  = 200
       Width = 140
       CAPTION = "Sharpen = 127 (max)"
       OnClick = Sharpen1
      END CREATE
      CREATE Sharpen2Btn AS QBUTTON
       Top   = 390
       Left  = 200
       Width = 140
       CAPTION = "Sharpen = 63"
       OnClick = Sharpen2
      END CREATE
      CREATE Sharpen3Btn AS QBUTTON
       Top   = 420
       Left  = 200
       Width = 140
       CAPTION = "Sharpen = 31"
       OnClick = Sharpen3
      END CREATE
      CREATE Contrast1Btn AS QBUTTON
       Top   = 330
       Left  = 360
       Width = 140
       CAPTION = "Contrast = 127 (max)"
       OnClick = Contrast1
      END CREATE
      CREATE Contrast2Btn AS QBUTTON
       Top   = 360
       Left  = 360
       Width = 140
       CAPTION = "Contrast = + 63"
       OnClick = Contrast2
      END CREATE
      CREATE Contrast3Btn AS QBUTTON
       Top   = 390
       Left  = 360
       Width = 140
       CAPTION = "Contrast = + 31"
       OnClick = Contrast3
      END CREATE
      CREATE Contrast4Btn AS QBUTTON
       Top   = 420
       Left  = 360
       Width = 140
       CAPTION = "Contrast = - 63"
       OnClick = Contrast4
      END CREATE
      CREATE Zoom1Btn AS QBUTTON
       Top   = 330
       Left  = 520
       Width = 140
       CAPTION = "Zoom (ResampleFilter=0)"
       OnClick = Zoom1
      END CREATE
      CREATE Zoom2Btn AS QBUTTON
       Top   = 360
       Left  = 520
       Width = 140
       CAPTION = "Zoom (ResampleFilter=2)"
       OnClick = Zoom2
      END CREATE
      CREATE Zoom3Btn AS QBUTTON
       Top   = 390
       Left  = 520
       Width = 140
       CAPTION = "Zoom (ResampleFilter=3)"
       OnClick = Zoom3
      END CREATE
      CREATE Zoom4Btn AS QBUTTON
       Top   = 420
       Left  = 520
       Width = 140
       CAPTION = "Zoom (ResampleFilter=5)"
       OnClick = Zoom4
      END CREATE
      SHOWMODAL
     END CREATE

     SUB CallIView(Cmd AS STRING)
      BMSrc.CopyToClipboard
      SHELL IViewPaste + Cmd + IViewCopy
      BMRes.PasteFromClipboard(0,0)
      Image2.BMP = BMRes.BMP
     END SUB

     SUB BPP8
      Ini.Write("UseFSDither", "0")
      CallIView("/bpp=8")
     END SUB
     SUB BPP8d
      Ini.Write("UseFSDither", "1")
      CallIView("/bpp=8")
     END SUB
     SUB BPP4
      Ini.Write("UseFSDither", "0")
      CallIView("/bpp=4")
     END SUB
     SUB BPP4d
      Ini.Write("UseFSDither", "1")
      CallIView("/bpp=4")
     END SUB

     SUB Gray
      CallIView("/gray")
     END SUB

     SUB Sharpen1
      CallIView("/sharpen=127")
     END SUB
     SUB Sharpen2
      CallIView("/sharpen=63")
     END SUB
     SUB Sharpen3
      CallIView("/sharpen=31")
     END SUB

     SUB Contrast1
      CallIView("/contrast=127")
     END SUB
     SUB Contrast2
      CallIView("/contrast=63")
     END SUB
     SUB Contrast3
      CallIView("/contrast=31")
     END SUB
     SUB Contrast4
      CallIView("/contrast=-63")
     END SUB

     SUB Zoom1
      Ini.Write("ResampleFilter","0")
      CallIView("/crop=(130,40,80,65) /resample=(400p,400p)")
     END SUB
     SUB Zoom2
      Ini.Write("ResampleFilter","2")
      CallIView("/crop=(130,40,80,65) /resample=(400p,400p)")
     END SUB
     SUB Zoom3
      Ini.Write("ResampleFilter","3")
      CallIView("/crop=(130,40,80,65) /resample=(400p,400p)")
     END SUB
     SUB Zoom4
      Ini.Write("ResampleFilter","5")
      CallIView("/crop=(130,40,80,65) /resample=(400p,400p)")
     END SUB

掌柜推荐
 
 
¥860.00 ·
 
 
¥900.00 ·
 
 
¥810.00 ·
 
 
¥317.00 ·
 
 
¥1,370.00 ·
 
 
¥660.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-06-19 07:47:42