Home

Add

Edit

Without Linenumbers

Code in Textfield

Download

  1. #INCLIB "X11"
    
  2. #INCLIB "Xext"
    
  3. 
    
  4. Type XScreen
    
  5.     ext_data            As Any Ptr
    
  6.     display         As Any Ptr
    
  7.     root                As Integer
    
  8.     Width               As Integer
    
  9.     height          As Integer
    
  10.     mwidth          As Integer
    
  11.     mheight         As Integer
    
  12.     ndepths         As Integer
    
  13.     depths          As Any Ptr
    
  14.     root_depth      As Integer
    
  15.     root_visual     As Any Ptr
    
  16.     default_gc      As Integer
    
  17.     cmap                As Integer
    
  18.     white_pixel     As Uinteger
    
  19.     black_pixel     As Uinteger
    
  20.     max_maps            As Integer
    
  21.     min_maps            As Integer
    
  22.     backing_store       As Integer
    
  23.     save_unders     As Integer
    
  24.     root_input_mask As Integer
    
  25. End Type
    
  26. 
    
  27. Type Display
    
  28.     XExtData            As Any Ptr
    
  29.     private1            As Any Ptr
    
  30.     fd                  As Integer
    
  31.     private2            As Integer
    
  32.     proto_major_version As Integer
    
  33.     proto_minor_version As Integer
    
  34.     vendor              As Zstring Ptr
    
  35.     private3            As Integer
    
  36.     private4            As Integer
    
  37.     private5            As Integer
    
  38.     private6            As Integer
    
  39.     resource_alloc      As Any Ptr
    
  40.     byte_order          As Integer
    
  41.     bitmap_unit         As Integer
    
  42.     bitmap_pad          As Integer
    
  43.     bitmap_bit_order    As Integer
    
  44.     nformats            As Integer
    
  45.     pixmap_format       As Any Ptr
    
  46.     private8            As Integer
    
  47.     release             As Integer
    
  48.     private9            As Any Ptr
    
  49.     private10           As Any Ptr
    
  50.     qlen                As Integer
    
  51.     last_request_read   As Uinteger
    
  52.     request             As Uinteger
    
  53.     private11           As Byte Ptr
    
  54.     private12           As Byte Ptr
    
  55.     private13           As Byte Ptr
    
  56.     private14           As Byte Ptr
    
  57.     max_request_size    As Uinteger
    
  58.     db                  As Any Ptr
    
  59.     private15           As Any Ptr
    
  60.     display_name        As Zstring Ptr
    
  61.     default_screen      As Integer
    
  62.     nscreens            As Integer
    
  63.     screens             As XSCREEN Ptr
    
  64.     motion_buffer       As Uinteger
    
  65.     private16           As Uinteger
    
  66.     min_keycode         As Integer
    
  67.     max_keycode         As Integer
    
  68.     private17           As Byte Ptr
    
  69.     private18           As Byte Ptr
    
  70.     private19           As Byte Ptr
    
  71.     xdefaults           As Zstring Ptr
    
  72. End Type
    
  73. 
    
  74. Type ShmSeg As Uinteger
    
  75. Type XShmSegmentInfo
    
  76.     shmseg              As ShmSeg
    
  77.     shmid               As Integer
    
  78.     shmaddr             As Byte Ptr
    
  79.     readOnly            As Integer
    
  80. End Type
    
  81. 
    
  82. #DEFINE DefaultScreen(dpy)  (dpy->default_screen)
    
  83. #DEFINE DefaultDepth(dpy,s) (dpy->screens[s].root_depth)
    
  84. #DEFINE DefaultVisual(dpy,s)(dpy->screens[s].root_visual)
    
  85. 
    
  86. Declare Function XOpenDisplay Cdecl Alias "XOpenDisplay"(Byval As String = "") As Display Ptr
    
  87. Declare Function XQueryExtension Cdecl Alias "XQueryExtension"(Byval lpDisplay As Display Ptr, Byval ExtName As String, Byref major_opcode_return As Integer, Byref first_event_return As Integer, Byref first_error_return As Integer) As Integer
    
  88. Declare Function XShmQueryExtension Cdecl Alias "XShmQueryExtension"(Byval lpDisplay As Display Ptr) As Integer
    
  89. Declare Function XShmQueryVersion Cdecl Alias "XShmQueryVersion"(Byval lpDisplay As Display Ptr, Byval major As Integer Ptr, Byval minor As Integer Ptr, Byval pixmaps As Integer Ptr) As Integer
    
  90. Declare Function XShmCreateImage Cdecl Alias "XCreateImage"(Byval lpDisplay As Display Ptr, Byval visual As Any Ptr, Byval depth As Integer, Byval Format As Integer, Byval offset As Integer, Byval shminfo As XShmSegmentInfo Ptr, Byval w As Uinteger, Byval height As Uinteger) As Any Ptr
    
  91. 
    
  92. Enum IMAGEFORMATS
    
  93.     XYBitmap        = 0
    
  94.     XYPixmap        = 1
    
  95.     ZPixmap         = 2
    
  96. End Enum
    
  97. 
    
  98. Dim TDisplay As Display Ptr = XOpenDisplay()
    
  99. Dim V_ShmInfo As XShmSegmentInfo
    
  100. 
    
  101. Dim TI1 As Integer
    
  102. Dim TI2 As Integer
    
  103. Dim TI3 As Integer
    
  104. Print "QE_SHM:" & XQueryExtension(TDisplay, "MIT-SHM", TI1, TI2, TI3)
    
  105. Print "TI1:" & TI1
    
  106. Print "TI2:" & TI2
    
  107. Print "TI3:" & TI3
    
  108. Print "XQE:" & XShmQueryExtension(TDisplay)
    
  109. Dim V_XImg As Any Ptr = XShmCreateImage(TDisplay, DefaultVisual(TDisplay, DefaultScreen(TDisplay)), DefaultDepth(TDisplay, DefaultScreen(TDisplay)), ZPixmap, 0, @V_ShmInfo, 300, 300)
    
  110. 'Dim V_XImgas XImage Ptr = XCreateImage(TDisplay, DefaultVisual(TDisplay, DefaultScreen(TDisplay)), DefaultDepth(TDisplay, DefaultScreen(TDisplay)), ZPixmap, 0, @V_ShmInfo, V_Width, V_Height, 32, 0)
    
  111. If V_XImg <> 0 Then
    
  112.     Print "OK"
    
  113. Else: Print "FAIL!"
    
  114. End If
    
  115. End 0
    
  116.