open "pictures.res" for input as #datafile Loadbmp "smiley", 320, 240, #datafile, 3 #screen.box, "drawbmp smiley 0 0"
Loadbmp "face", 640, 480, #differentfile, 100
|
nomainwin WindowWidth = 320 WindowHeight = 240 open "Load raw RGB data" for graphics_nsb as #screen #screen "trapclose [quit]" call loadrgb "smiley", 320, 240, "C:\smiley.rgb", 0 #screen "drawbmp smiley 0 0" wait [quit] close #screen end sub loadrgb bmp$, width, height, file$, slot struct bmi, size as ulong, width as long, height as long, _ planes as short, bitcount as short, compression as ulong, _ sizeimage as ulong, xpermeter as long, ypermeter as long, _ clrused as ulong, clrimportant as ulong struct dib, bits as long bmi.size.struct = len(bmi.struct) bmi.width.struct = width bmi.height.struct = height bmi.planes.struct = 1 bmi.bitcount.struct = 24 calldll #gdi32, "CreateDIBSection", 0 as long, bmi as struct, _ 0 as long, dib as struct, 0 as long, 0 as long, hdib as long open file$ for binary as #rgbfile seek #rgbfile, slot * width * height * 3 hfile = hwnd(#rgbfile) buffer = dib.bits.struct size = width * height * 3 calldll #kernel32, "ReadFile", hfile as long, buffer as long, _ size as long, dib as struct, 0 as long, ret as long close #rgbfile loadbmp bmp$, hdib calldll #gdi32, "DeleteObject", hdib as long, ret as long end sub