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

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

  
'From:   "danilo_yoingco"  Tue May 6, 2003  8:20 am
' (works on my win98se).

     TYPE BITMAP
      bmType AS LONG
      bmWidth AS LONG
      bmHeight AS LONG
      bmWidthBytes AS LONG
      bmPlanes AS WORD
      bmBitsPixel AS WORD
      bmBits AS LONG
     END TYPE

     DECLARE FUNCTION CreateCompatibleBitmap LIB "gdi32" _
      ALIAS "CreateCompatibleBitmap" (dc AS LONG, w AS LONG, h AS LONG) AS LONG
     DECLARE FUNCTION GetObject LIB "gdi32" ALIAS "GetObjectA" (bmHandle _
      AS LONG, buf AS LONG, bufsize AS LONG) AS LONG
     DECLARE FUNCTION SelectObject LIB "gdi32" ALIAS "SelectObject" (hdc _
      AS LONG, obj AS LONG) AS LONG

     DIM Mem AS QMEMORYSTREAM
     DIM QBM AS QBITMAP, rtn AS LONG, bm AS BITMAP
     DIM hBM AS LONG

     bmType=0
     bmWidth=0
     bmHeight=0
     bmWidthBytes=0
     bmPlanes=0
     bmBitsPixel=0
     bm.bmBits=0


     Mem.WriteUDT(bm)
     Mem.Position = 0

     QBM.BMP = "c:\RapidQ\Yahoo.bmp"

     CREATE Form AS QFORM
      CREATE Image1 AS QIMAGE
       Left = 0
       top=0
       Draw 5, 5, QBM.BMP
      END CREATE
      Center
     END CREATE

     hBM=CreateCompatibleBitmap(QBM.Handle,QBM.Width,QBM.Height)
     rtn=SelectObject(QBM.Handle,hBM)
     rtn=GetObject(hBM,SIZEOF(bm),Mem.Pointer)
     Mem.Position = 0
     Mem.ReadUDT(bm)

     SHOWMESSAGE(STR$(bm.bmType)) ' Always 0
     SHOWMESSAGE(STR$(bm.bmWidth)+" "+STR$(bm.bmHeight))
     SHOWMESSAGE(STR$(bm.bmWidthBytes)) ' Words width
     SHOWMESSAGE(STR$(bm.bmPlanes)) ' Colours
     SHOWMESSAGE(STR$(bm.bmBitsPixel)) ' Proper Planes/Colours!
     SHOWMESSAGE(HEX$(bm.bmBits)) ' Array address

     Form.SHOWMODAL
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Sat 2024-10-12  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2003-05-06 15:24:23