Mysoft

Untitled

May 4th, 2021
727
5 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "crt.bi"
  2.  
  3. type u16 as ushort
  4. type u32 as ulong
  5.  
  6. type BmpFile field=1
  7.   as u16  bfType        '= &h4D42 'BM
  8.   as u32  bfSize
  9.   as u16  bfReserved1
  10.   as u16  bfReserved2
  11.   as u32  bfOffBits     '= 1078 'sizeof(BmpFile)
  12.  
  13.   as u32  biSize        '= 40 'offsetof(BmpFile,Pal)-offsetof(BmpFile,biSize)
  14.   as u32  biWidth
  15.   as u32  biHeight
  16.   as u16  biPlanes
  17.   as u16  biBitCount
  18.   as u32  biCompression '= 0  'BI_RGB
  19.   as u32  Useless(4)
  20.   as u32  Pal(256-1)  
  21. end type
  22.  
  23. print sizeof(BmpFile), sizeof(BmpFile)-(1024+14)
  24.  
  25. dim as BmpFile tFile
  26. tFile.bfType        = &h4D42
  27. tFile.bfOffBits     = sizeof(BmpFile)
  28. tFile.bfSize        = tFile.bfOffBits+260*256
  29. tFile.biSize        = sizeof(BmpFile)-(1024+14)
  30. tFile.biWidth       = 260
  31. tFile.biHeight      = 256
  32. tFile.biPlanes      = 1
  33. tFile.biBitCount    = 8
  34. tFile.biCompression = 0
  35. dim as integer I = 0
  36. for Red as integer = 0 to 7
  37.   for Green as integer = 0 to 7
  38.     for Blue as integer = 0 to 3
  39.       tFile.Pal(I) = ((blue*255)\4) or (((green*255)\8) shl 8) or (((red*255)\8) shl 16)
  40.       I += 1
  41.     next Blue
  42.   next Green
  43. Next Red
  44.  
  45. #define RGB8(_B,_G,_R) ((_B)\64 + ((_G)\32)*4 + ((_R)\32)*32)
  46.  
  47. dim as ubyte ptr pData = malloc(260*256), pPix = pData
  48. for Y as integer = 255 to 0 step -1
  49.   for X as integer = 0 to 259
  50.     *pPix = iif(X=0 or Y=0 or X=259 or Y=255 or Y=64,RGB8(255,128,64),RGB8(0,0,0))
  51.     pPix += 1
  52.   next X
  53. next Y
  54.  
  55. dim as FILE ptr fBmp
  56. fBmp = fopen("file.bmp","wb+")
  57. fwrite(@tFile,sizeof(tFile),1,fBmp)
  58. fwrite(pData,260*256,1,fBmp)
  59. fclose(fBmp)
  60.  
  61. sleep
  62.  
  63.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×