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

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

  
' written by Mark  Kica alias xprometeus@seznam.cz
' This is Pcx Viewer of images stored only in 256 color and in version ,, 5"
' PC Paintbrush and includes 24-bit .PCX files
' Just transform if you want ....


     $APPTYPE GUI

     $TYPECHECK ON

     DECLARE FUNCTION load(name AS STRING)AS INTEGER
     DECLARE SUB formPaint (sender AS QFORM)




     DIM field AS QBITMAP
     DIM form AS QFORM


     TYPE TH
      MAN AS STRING * 1
      VER AS STRING * 1
      ENC AS STRING * 1
      BIT AS STRING * 1
      Xmin AS INTEGER
      Ymin AS INTEGER
      XMax AS INTEGER
      YMax AS INTEGER
      HRE AS INTEGER
      VRE AS INTEGER
      COL AS STRING * 48
      RES AS STRING * 1
      nplanes AS STRING * 1
      bytesperline AS INTEGER
      PAL AS INTEGER
      FIL AS STRING * 58
     END TYPE






     form.CAPTION="PCX Viewer by Mark Kica xprometeus "
     form.height=444
     form.width=603
     form.borderstyle=5
     form.center
     form.onPaint = formPaint




     load ("p.pcx")

     form.SHOWMODAL




     SUB formPaint (sender AS QFORM)
      sender.draw(0, 0, field.bmp)
     END SUB




     FUNCTION load(name AS STRING)AS INTEGER

      DIM H AS TH
      DIM xsize
      DIM Ysize
      DIM totalbytes
      DIM I
      DIM colors(255)
      DIM r%
      DIM g%
      DIM b%
      DIM r AS STRING
      DIM g AS STRING
      DIM b AS STRING
      DIM X
      DIM y
      DIM pomoc1 AS STRING
      DIM pomoc1% AS INTEGER
      DIM ZNAK AS STRING
      DIM ZNAK% AS INTEGER
      DIM dolne AS INTEGER
      DIM FILE AS QFILESTREAM
      DIM FILE1 AS QFILESTREAM


      IF FILEEXISTS(name=0) THEN
       load=-1
       EXIT FUNCTION
      END IF


      file1.OPEN(name,0)
      file1.position=file1.size-768

      FOR i=0 TO 255
       r%=file1.readnum(1)
       g%=file1.readnum(1)
       b%=file1.readnum(1)
       r%=r%
       g%=g%
       b%=b%

       ColorS(i)=RGB(r%,g%,b%)
      NEXT i
      FILE1.CLOSE



      file.OPEN(name,0)

      h.man=file.readbinstr(1)
      h.ver=file.readbinstr(1)
      h.enc=file.readbinstr(1)
      h.bit=file.readbinstr(1)
      h.xmin=file.readnum(2)
      h.ymin=file.readnum(2)
      h.xmax=file.readnum(2)
      h.ymax=file.readnum(2)
      h.hre=file.readnum(2)
      h.vre=file.readnum(2)
      h.col=file.readbinstr(48)
      h.res=file.readbinstr(1)
      h.nplanes=file.readbinstr(1)
      h.bytesperline =file.readnum(2)
      h.pal=file.readnum(2)
      h.fil=file.readbinstr(58)





      xsize=h.xmax-h.xmin+1
      ysize=h.ymax-h.ymin+1
      totalbytes=ASC(h.nplanes)*h.bytesperline
      field.height=ysize
      field.width=xsize
      form.height=ysize+5
      form.width=xsize+5


      x=0
      y=0
      DO
       ZNAK%=file.readnum(1)

       IF znak%<192 THEN
        IF x<xsize THEN x=x+1
        IF x=xsize THEN
         x=0
         y=y+1
        END IF

        field.pset(x,y,colors(znak%))


       END IF

       IF znak%>192 AND znak%<=255 THEN
        dolne=znak%-192
        pomoc1%= file.readnum(1)
        DO
         dolne=dolne-1
         IF x<xsize THEN x=x+1
         IF x=xsize THEN
          x=0
          y=y+1
         END IF
         field.pset(x,y,colors(pomoc1%))
         IF dolne=0 THEN EXIT DO
        LOOP

       END IF

       IF y=ysize THEN  EXIT DO
      LOOP



      load=1
     END FUNCTION







掌柜推荐
 
 
¥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:2003-01-17 17:42:48