Recent Changes

Saturday, July 30

  1. page Notepad edited ... #1 "getbmp pic 10 0 88 64" close #1 ' nomainwin nomainwin WindowWidth = 420…
    ...
    #1 "getbmp pic 10 0 88 64"
    close #1
    ' nomainwinnomainwin
    WindowWidth = 420
    WindowHeight = 420
    ...
    hWG5 = hWnd(#w.g5) 'Destination Handle (#w.g5)
    hWG6 = hWnd(#w.g6) 'Destination Handle (#w.g6)
    ...
    'Source Device ControlContext
    hDC4 = GetDC(hWG4) 'Destination Device Context (#w.g4)
    hDC5 = GetDC(hWG5) 'Destination Device Context (#w.g5)
    ...
    If your bitmap is 48 pixels wide by 60 pixels long, then change the above line to
    null = TransparentBlt(hDC2, 0, 0, 57, 57, hDCM, 0, 0, 48, 60, 16777215)
    TransparentBlt is best used for transferring images using a transparent background. Although TransparentBlt is documented to resize images, at least one user with Windows 7 has found the resizing function to fail when transferring from one graphicbox to another. The function did succeed when the image was transferred from a memory dc to a graphicbox. It is best to transfer the image from a memory device context as dexcribed in the next demo.
    Demo 2: BitBlt, TransparentBlt and Drawing in Memory
    If you haven't done so already, please read Drawing IN MEMORY (Newsletter 101) by Alyce Watson . There you'll find all the theory you need to understand that you can transfer an image drawn in memory but you can't transfer an image drawn in a hidden graphic box. This second demo demonstrates how to load a bitmap and then transferring that image to a graphicbox using both BitBlt and TransparentBlt.
    (view changes)
    7:35 am

Wednesday, July 27

  1. page Notepad edited ... If your bitmap is 48 pixels wide by 60 pixels long, then change the above line to null = Tran…
    ...
    If your bitmap is 48 pixels wide by 60 pixels long, then change the above line to
    null = TransparentBlt(hDC2, 0, 0, 57, 57, hDCM, 0, 0, 48, 60, 16777215)
    Demo 2: BitBlt, TransparentBlt and Drawing in Memory
    If you haven't done so already, please read Drawing IN MEMORY (Newsletter 101) by Alyce Watson . There you'll find all the theory you need to understand that you can transfer an image drawn in memory but you can't transfer an image drawn in a hidden graphic box. This second demo demonstrates how to load a bitmap and then transferring that image to a graphicbox using both BitBlt and TransparentBlt.
    'Demo Transferring an Image from a Bitmap Loaded in Memory
    'Using gdi32.dll: BitBlt and msimg32.dll: TransparentBlt
    'Copyright Janet Terra December 2004, 2011
    'This information is free for anyone to use in your program
    'but this demo itself may not be copied 'as is' and reposted
    'Users of PRE WINDOWS 98, please note:
    'The msimg32.dll may not be available for Windows 95
    'If running this program gives you - Runtime Error: The
    'specified module could not be found. (OS error 16r7E)
    'then msimg32.dll is not present on your computer.
    nomainwin
    'Load a bitmap. This demo gets a bitmap 88 x 64 so no external
    'files are needed
    WindowWidth = 280
    WindowHeight = 400
    open "Quick Pic" for graphics as #1
    #1 "down; color red; backcolor yellow"
    #1 "place 50 30; circlefilled 25"
    #1 "getbmp pic 10 0 88 64"
    close #1
    'Define 2 Graphicboxes: 1 = BitBlt, 2 = TransparentBlt
    graphicbox #w.g1, 10, 10, 100, 100
    statictext #w.st1a, "Image transferred from memory using", 8, 120, 110, 32
    statictext #w.st1b, "gdi32.dll", 8, 152, 110, 16
    statictext #w.st1c, "BitBlt", 8, 168, 110, 16
    graphicbox #w.g2, 140, 10, 100, 100
    statictext #w.st2a, "Image transferred from memory using", 138, 120, 110, 32
    statictext #w.st2b, "msimg32.dll", 138, 152, 110, 16
    statictext #w.st2c, "TransparentBlt", 138, 168, 110, 16
    'Open the Window
    open "Demo" for window as #w
    #w "trapclose [endProgram]"
    'Obtain the handles of the primary window, the source window or graphicbox,
    'and the destination windows or graphicboxes. In this demo, #w.g1 receives the
    'image using BitBlt and #w.g2 receives the image using TransparentBlt
    hW = hWnd(#w) 'Window handle
    hWG1 = hWnd(#w.g1) 'Source Handle (#w.g1)
    hWG2 = hWnd(#w.g2) 'Destination Handle (#w.g2)
    hDC = GetDC(hW)
    hDC1 = GetDC(hWG1) 'Source Device Context (#w.g1)
    hDC2 = GetDC(hWG2) 'Destination Device Context (#w.g2)
    'Open the msimg32.dll
    open "msimg32.dll" for dll as #m
    'Create Device Context in Memory
    hDCM = CreateCompatibleDC(0)
    'Obtain Handle of the Loaded BMP ("pic")
    hPic = hBmp("pic")
    'Display Solid Backgrounds
    call hueBackground "Darkblue", "#w.g1"
    call hueBackground "Darkblue", "#w.g2"
    'Select the Object in Memory
    memPic = SelectObject(hDCM, hPic)
    'Draw the Object in Memory to GraphicBox #w.g1 using BitBlt
    null =BitBlt(hDC1, 0, 0, 88, 64, hDCM, 0, 0, _SRCCOPY)
    'Draw the Object in Memory to GraphicBox #w.g2 using TransparentBlt
    null = TransparentBlt(hDC2, 0, 0, 88, 64, hDCM, 0, 0, 88, 64, 16777215)
    wait
    [endProgram]
    'Release memory from any device contexts created during program
    null = ReleaseDC(hWG1, hDC1)
    null = ReleaseDC(hWG2, hDC2)
    calldll #gdi32, "DeleteDC", _
    hDCM as ulong, _
    null as long
    calldll #gdi32, "DeleteObject", _
    memPic as ulong, _
    null as long
    'Close msimg32.dll
    close #m
    'Unload bitmap
    unloadbmp "pic"
    'Close window
    close #w
    'End program
    end
    sub hueBackground hue$, handle$
    #handle$ "down; fill ";hue$
    #handle$ "flush; discard"
    end sub
    '====================================================================
    'The following functions are derived from information obtained from
    'API's for Liberty BASIC (c) Alyce Watson and are used with permission
    'of Alyce Watson
    '====================================================================
    function CreateCompatibleDC(hDC)
    calldll #gdi32, "CreateCompatibleDC", _
    hDC as ulong, _ 'current screen
    CreateCompatibleDC as ulong 'handle of memory DC
    end function
    function GetDC(handle)
    calldll #user32, "GetDC", _
    handle as ulong, _
    GetDC as ulong
    end function
    function ReleaseDC(handle, hdc)
    calldll #user32, "ReleaseDC", _
    handle as ulong, _
    hdc as ulong, _
    ReleaseDC as ulong
    end function
    function SelectObject(hDC,hImage)
    calldll #gdi32, "SelectObject", _
    hDC as ulong, _ 'Memory Device Context
    hImage as ulong, _ 'Handle of Loaded Bitmap
    SelectObject as ulong 'Returns handle of previous object
    end function
    function BitBlt(hdcDest, xDest, yDest, wDest, hDest, hdcSource, xSource, ySource, ROP)
    CallDLL #gdi32, "BitBlt", _
    hdcDest as ulong, _ 'handle to destination DC
    xDest as long, _ 'x-coord of destination upper-left corner
    yDest as long, _ 'y-coord of destination upper-left corner
    wDest as long, _ 'width of destination rectangle
    hDest as long,_ 'height of destination rectangle
    hdcSource as ulong, _ 'handle to source DC
    xSource as long, _ 'x-coord of source upper-left corner
    ySource as long, _ 'y-coord of source upper-left corner
    ROP as ulong,_ 'Raster Operation
    result as long
    end function
    function TransparentBlt(hdcDest, xDest, yDest, wDest, hDest, hdcSource, xSource, ySource, wSource, hSource, clrTransp)
    calldll #m, "TransparentBlt", _
    hdcDest as ulong, _ 'handle to destination DC
    xDest as long, _ 'x-coord of destination upper-left corner
    yDest as long, _ 'y-coord of destination upper-left corner
    wDest as long, _ 'width of destination rectangle
    hDest as long, _ 'height of destination rectangle
    hdcSource as ulong, _ 'handle to source DC
    xSource as long, _ 'x-coord of source upper-left corner
    ySource as long, _ 'y-coord of source upper-left corner
    wSource as long, _ 'width of source rectangle
    hSource as long, _ 'height of source rectangle
    clrTransp as ulong, _ 'color to make transparent
    TransparentBlt as long
    end function
    '====================================================================

    (view changes)
    7:37 pm
  2. page Notepad edited ... null = TransparentBlt(hDC6, 0, 0, 104, 80, hDC1, 0, 0, 88, 64, 16777215) Wait [endProgram] …
    ...
    null = TransparentBlt(hDC6, 0, 0, 104, 80, hDC1, 0, 0, 88, 64, 16777215)
    Wait
    [endProgram]
    'Release memory from any device contexts created during program
    null = ReleaseDC(hWG1, hDC1)
    null = ReleaseDC(hWG4, hDC4)
    null = ReleaseDC(hWG5, hDC5)
    null = ReleaseDC(hWG6, hDC6)
    'Close msimg32.dll
    close #m
    'Unload bitmap
    unloadbmp "pic"
    'Close window
    close #w
    'End program
    end

    sub hueBackground hue$, handle$
    #handle$ "down; fill ";hue$
    ...
    #handle$ "flush; discard"
    end sub
    [endProgram]
    'Release memory from any device contexts created during program
    null = ReleaseDC(hWG1, hDC1)
    null = ReleaseDC(hWG4, hDC4)
    null = ReleaseDC(hWG5, hDC5)
    null = ReleaseDC(hWG6, hDC6)
    'Close msimg32.dll
    close #m
    'Unload bitmap
    unloadbmp "pic"
    'Close window
    close #w
    'End program
    end

    '====================================================================
    'These 3 Functions obtained from information found in API's for
    (view changes)
    7:25 pm
  3. page Notepad edited ... Close #m BitBlt, StretchBlt, TransparentBlt: A Quick Comparison Capabilities BitBlt Trans…
    ...
    Close #m
    BitBlt, StretchBlt, TransparentBlt: A Quick Comparison
    Capabilities
    BitBlt
    TransparentBlt
    StretchBlt
    Simple bitcopy
    Yes
    Yes
    Yes
    Bitcopy from memory device
    Yes
    Yes
    Yes
    Resize
    No
    Yes
    Yes
    Raster Operations
    Yes
    No
    Yes
    Flip
    No
    No
    Yes
    Mirror
    No
    No
    Yes
    Rotate 180 degrees
    No
    No
    Yes
    Assign Color Transparent
    No
    Yes
    No
    The Demo Bitmaps
    These two demos generate a simple image. You may choose to load an image from file with the loadbmp command. The demos are based upon the white background of the drawn image. If you choose to substitute with an image having a different background color, change the long number value of white (16777215) to the long number value of the desired color.

    Demo 1: Drawbmp vs TransparentBlt
    This first demo illustrates the difference between drawing an image with the drawbmp command and drawing the same image with the TransparentBlt API function.
    'Demo Drawing Bitmaps with Transparent Backgrounds
    'Using msimg32.dll and TransparentBlt
    (view changes)
    7:24 pm
  4. page Notepad edited A Transparent Background for Static Graphics Do you find yourself creating sprites, not for ani…

    A Transparent Background for Static Graphics
    Do you find yourself creating sprites, not for animation, but to draw static images with a transparent background? If you do, then consider using the API TransparentBlt function in MSIMG32.DLL. The MSIMG32.DLL is included with all versions of Window 98 and later. Sorry, Windows 95 Users, this doesn't include you, although you may be able to download the DLL. The TransparentBlt coding is very similar to the BitBlt and StretchBlt functions of GDI32.DLL. If you are unfamiliar with transferring bits using BitBlt, please read Bitmaps the Fast Way (Newsletter 122) by Callum Lowcay. This is an excellent article demonstrating how BitBlt works.
    Finding, Opening and Closing the DLL
    There is no need to include a separate MSIMG32.DLL file with programs calling this DLL if your operating system is Windows 98 or later. You will need to OPEN the DLL. Common Windows operating system DLL's do not need to be OPENed before calling. These common DLL's include USER32.DLL, KERNEL32.DLL, GDI32.DLL, WINMM.DLL, SHELL32.DLL, COMDLG32.DLL, COMCTL32.DLL. MSIMG32.DLL DOES REQUIRE OPENing before CALLing.
    Open msimg32.dll for DLL as #m
    As with all OPENed DLL's, the DLL must be closed before exiting the program.
    Close #m
    BitBlt, StretchBlt, TransparentBlt: A Quick Comparison

    Demo 1: Drawbmp vs TransparentBlt
    'Demo Drawing Bitmaps with Transparent Backgrounds
    (view changes)
    7:13 pm
  5. page Notepad edited ... 'Visit http://support.microsoft.com for more info 'Load a bitmap. This demo uses Star.bmp …
    ...
    'Visit http://support.microsoft.com for more info
    'Load a bitmap. This demo uses Star.bmp
    loadbmp "star", "C:\Users\Janet\Pictures\starBLT.bmp"open "Quick Pic" for graphics as #1
    #1 "down; color red; backcolor yellow"
    #1 "place 50 30; circlefilled 25"
    #1 "getbmp pic 10 0 88 64"
    close #1

    ' nomainwin
    WindowWidth = 420
    ...
    'Define 6 Graphicboxes: 1,2,3 = Drawbmp, 4,5,6 = TransparentBlt
    graphicbox #w.g1, 10, 10, 100, 100
    ...
    #w.stxt1a, "Drawbmp starpic 0, 0",
    statictext #w.stxt1b, "white background", 8, 136, 110, 16
    graphicbox #w.g2, 140, 10, 100, 100
    ...
    #w.stxt2a, "Drawbmp starpic 0, 0",
    statictext #w.stxt2b, "blue background", 138, 136, 110, 16
    graphicbox #w.g3, 270, 10, 100, 100
    ...
    #w.stxt3a, "Drawbmp starpic 0, 0",
    statictext #w.stxt3b, "patterned background", 268, 136, 110, 16
    graphicbox #w.g4, 10, 190, 100, 100
    ...
    statictext #w.stxt5c, "larger width and height (stretch)", 268, 332, 110, 32
    'Open the Window
    open "Demo""Demo #1" for window
    #w "trapclose [endProgram]"
    'Obtain the handles of the primary window, the source window or graphicbox,
    ...
    'Draw the bitmap in the first graphicbox. Remember this also serves as the
    'source bitmap.
    #w.g1 "drawbmp starpic 0, 0"
    'Draw the bitmap in the second graphicbox. The white rectangular background
    'of the starpic remains present
    #w.g2 "drawbmp starpic 0, 0"
    'Draw the bitmap in the third graphicbox. Again, the white rectangular
    'background of the bitmap obscures the patterned background
    #w.g3 "drawbmp starpic 0, 0"
    'Assign ONE color to be the transparent color. Remember you must use the
    'long number. In this case, the RGB of White is "255 255 255", so the
    ...
    'SourceUpperLeftY, SourceWidth, SourceHeight, TransparentColor)
    'Using the SAME Width and Height as the Source
    ...
    0, 0, 57, 57,88, 64, hDC1, 0, 0, 57, 57,88, 64, 16777215)
    'Using a SMALLER Width and Height as the Source
    ...
    0, 0, 57, 57,44, 32, hDC1, 0, 0, 25, 25,88, 64, 16777215)
    'Using a LARGER Width and Height as the Source (Destination x and y are also changed)
    ...
    0, 0, 57, 57,104, 80, hDC1, 0, 0, 100, 100,88, 64, 16777215)
    Wait
    sub hueBackground hue$, handle$
    ...
    close #m
    'Unload bitmap
    unloadbmp "star""pic"
    'Close window
    close #w
    ...
    end Function
    '====================================================================
    Demo 2: BitBlt, TransparentBlt and Drawing in Memory
    If you haven't done so already, please read [Drawing IN MEMORY (Newsletter 101)] by Alyce Watson . There you'll find all the theory you need to understand that you can transfer an image drawn in memory but you can't transfer an image drawn in a hidden graphic box. This second demo demonstrates loading the star.bmp image in memory and then transferring that image to a graphicbox using both BitBlt and TransparentBlt.
    'Demo Transferring an Image from a Bitmap Loaded in Memory
    'Using gdi32.dll: BitBlt and msimg32.dll: TransparentBlt
    'Copyright Janet Terra December 2004
    'This information is free for anyone to use in your program
    'but this demo itself may not be copied 'as is' and reposted
    'Users of PRE WINDOWS 98, please note:
    'The msimg32.dll may not be available for Windows 95
    'If running this program gives you - Runtime Error: The
    'specified module could not be found. (OS error 16r7E)
    'then msimg32.dll is not present on your computer.
    ' nomainwin
    'Load a bitmap. This demo was written for cherry.bmp found in the Liberty BASIC
    'folder. Any bitmap will do, but a white background is needed for the
    'transparency to work.
    filedialog "Load Bitmap", "*.bmp", image$
    loadbmp "star", image$
    WindowWidth = 280
    WindowHeight = 400
    'Define 2 Graphicboxes: 1 = BitBlt, 2 = TransparentBlt
    graphicbox #w.g1, 10, 10, 100, 100
    statictext #w.st1a, "Image transferred from memory using", 8, 120, 110, 32
    statictext #w.st1b, "gdi32.dll", 8, 152, 110, 16
    statictext #w.st1c, "BitBlt", 8, 168, 110, 16
    graphicbox #w.g2, 140, 10, 100, 100
    statictext #w.st2a, "Image transferred from memory using", 138, 120, 110, 32
    statictext #w.st2b, "msimg32.dll", 138, 152, 110, 16
    statictext #w.st2c, "TransparentBlt", 138, 168, 110, 16
    'Open the Window
    open "Demo" for window as #w
    #w "trapclose [endProgram]"
    'Obtain the handles of the primary window, the source window or graphicbox,
    'and the destination windows or graphicboxes. In this demo, #w.g1 receives the
    'image using BitBlt and #w.g2 receives the image using TransparentBlt
    hW = hWnd(#w) 'Window handle
    hWG1 = hWnd(#w.g1) 'Source Handle (#w.g1)
    hWG2 = hWnd(#w.g2) 'Destination Handle (#w.g2)
    hDC = GetDC(hW)
    hDC1 = GetDC(hWG1) 'Source Device Context (#w.g1)
    hDC2 = GetDC(hWG2) 'Destination Device Context (#w.g2)
    'Open the msimg32.dll
    open "msimg32.dll" for dll as #m
    'Create Device Context in Memory
    hDCM = CreateCompatibleDC(0)
    'Obtain Handle of the Loaded BMP ("star")
    hPic = hBmp("star")
    'Display Solid Backgrounds
    call hueBackground "Darkblue", "#w.g1"
    call hueBackground "Darkblue", "#w.g2"
    'Select the Object in Memory
    memPic = SelectObject(hDCM, hPic)
    'Draw the Object in Memory to GraphicBox #w.g1 using BitBlt
    null =BitBlt(hDC1, 0, 0, 60, 60, hDCM, 0, 0, _SRCCOPY)
    'Draw the Object in Memory to GraphicBox #w.g2 using TransparentBlt
    null = TransparentBlt(hDC2, 0, 0, 57, 57, hDCM, 0, 0, 57, 57, 16777215)
    wait
    [endProgram]
    'Release memory from any device contexts created during program
    null = ReleaseDC(hWG1, hDC1)
    null = ReleaseDC(hWG2, hDC2)
    calldll #gdi32, "DeleteDC", _
    hDCM as ulong, _
    null as long
    'Close msimg32.dll
    close #m
    'Unload bitmap
    unloadbmp "star"
    'Close window
    close #w
    'End program
    end
    sub hueBackground hue$, handle$
    #handle$ "down; fill ";hue$
    #handle$ "flush; discard"
    end sub
    '====================================================================
    'These next 3 Functions are derived from information obtained from
    'API's for Liberty BASIC (c) Alyce Watson and are used with permission
    'of Alyce Watson
    '====================================================================
    function CreateCompatibleDC(hDC)
    calldll #gdi32, "CreateCompatibleDC", _
    hDC as ulong, _ 'current screen
    CreateCompatibleDC as ulong 'handle of memory DC
    end function
    function SelectObject(hDC,hImage)
    calldll #gdi32, "SelectObject", _
    hDC as ulong, _ 'Memory Device Context
    hImage as ulong, _ 'Handle of Loaded Bitmap
    SelectObject as ulong 'Returns handle of previous object
    end function
    function BitBlt(hdcDest, xDest, yDest, wDest, hDest, hdcSource, xSource, ySource, ROP)
    CallDLL #gdi32, "BitBlt", _
    hdcDest as ulong, _ 'handle to destination DC
    xDest as long, _ 'x-coord of destination upper-left corner
    yDest as long, _ 'y-coord of destination upper-left corner
    wDest as long, _ 'width of destination rectangle
    hDest as long,_ 'height of destination rectangle
    hdcSource as ulong, _ 'handle to source DC
    xSource as long, _ 'x-coord of source upper-left corner
    ySource as long, _ 'y-coord of source upper-left corner
    ROP as ulong,_ 'Raster Operation
    result as long
    end function
    '====================================================================
    You
    You may choose to select anotherany image. If
    In this line
    null = TransparentBlt(hDC2, 0, 0, 57, 57, hDCM, 0, 0, 57, 57, 16777215)
    (view changes)
    6:54 pm

Sunday, July 24

  1. page Notepad edited ... 'repeated TransparentBlt calls and Windows 95/98 'Visit http://support.microsoft.com for more…
    ...
    'repeated TransparentBlt calls and Windows 95/98
    'Visit http://support.microsoft.com for more info
    ...
    demo uses StarBLT.bmpStar.bmp
    loadbmp "star", "starBLT.bmp"
    nomainwin
    "C:\Users\Janet\Pictures\starBLT.bmp"
    ' nomainwin

    WindowWidth = 420
    WindowHeight = 420
    ...
    null = TransparentBlt(hDC4, 0, 0, 57, 57, hDC1, 0, 0, 57, 57, 16777215)
    'Using a SMALLER Width and Height as the Source
    ...
    0, 0, 25, 25,57, 57, hDC1, 0, 0, 57, 57,25, 25, 16777215)
    'Using a LARGER Width and Height as the Source (Destination x and y are also changed)
    ...
    0, 0, 100, 100,57, 57, hDC1, 0, 0, 57, 57,100, 100, 16777215)
    Wait
    sub hueBackground hue$, handle$
    (view changes)
    11:49 am
  2. page Notepad edited ... 'repeated TransparentBlt calls and Windows 95/98 'Visit http://support.microsoft.com for more…
    ...
    'repeated TransparentBlt calls and Windows 95/98
    'Visit http://support.microsoft.com for more info
    ...
    demo uses Star.bmpStarBLT.bmp
    loadbmp "star", "star.bmp""starBLT.bmp"
    nomainwin
    WindowWidth = 420
    (view changes)
    11:39 am
  3. page Notepad edited ... 'Visit http://support.microsoft.com for more info 'Load a bitmap. This demo uses Star.bmp l…
    ...
    'Visit http://support.microsoft.com for more info
    'Load a bitmap. This demo uses Star.bmp
    loadbmp "star", "C:\Users\Janet\Pictures\Star.bmp"
    ' nomainwin
    "star.bmp"
    nomainwin

    WindowWidth = 420
    WindowHeight = 420
    (view changes)
    11:34 am
  4. page Notepad edited Demo 1: Drawbmp vs TransparentBlt 'Demo Drawing Bitmaps with Transparent Backgrounds ... 're…

    Demo 1: Drawbmp vs TransparentBlt
    'Demo Drawing Bitmaps with Transparent Backgrounds
    ...
    'repeated TransparentBlt calls and Windows 95/98
    'Visit http://support.microsoft.com for more info
    nomainwin'Load a bitmap. This demo uses Star.bmp
    loadbmp "star", "C:\Users\Janet\Pictures\Star.bmp"
    ' nomainwin

    WindowWidth = 388420
    WindowHeight = 400420
    'Define 6 Graphicboxes: 1,2,3 = Drawbmp, 4,5,6 = TransparentBlt
    graphicbox #w.g1, 10, 10, 100, 100
    ...
    #w.stxt1a, "Drawbmp cherry 5, 10",star 0, 0", 8, 120,
    statictext #w.stxt1b, "white background", 8, 136, 110, 16
    graphicbox #w.g2, 140, 10, 100, 100
    ...
    #w.stxt2a, "Drawbmp cherry 5, 10",star 0, 0", 138, 120,
    statictext #w.stxt2b, "blue background", 138, 136, 110, 16
    graphicbox #w.g3, 270, 10, 100, 100
    ...
    #w.stxt3a, "Drawbmp cherry 5, 10",star 0, 0", 268, 120,
    statictext #w.stxt3b, "patterned background", 268, 136, 110, 16
    graphicbox #w.g4, 10, 190, 100, 100
    ...
    statictext #w.stxt6b, "patterned background", 268, 316, 110, 16
    statictext #w.stxt5c, "larger width and height (stretch)", 268, 332, 110, 32
    'Load a bitmap. This demo uses cherry.bmp found in the bmp folder of the
    'Liberty BASIC folder. This demo must be run from the main Liberty BASIC
    'program folder in order to find cherry.bmp properly.
    loadbmp "cherry", StartupDir$;"\bmp\cherry.bmp"

    'Open the Window
    open "Demo" for window as #w
    ...
    'Draw the bitmap in the first graphicbox. Remember this also serves as the
    'source bitmap.
    #w.g1 "drawbmp cherry 5, 10"star 0, 0"
    'Draw the bitmap in the second graphicbox. The white rectangular background
    'of the cherrystar remains present
    #w.g2 "drawbmp cherry 5, 10"star 0, 0"
    'Draw the bitmap in the third graphicbox. Again, the white rectangular
    'background of the bitmap obscures the patterned background
    #w.g3 "drawbmp cherry 5, 10"star 0, 0"
    'Assign ONE color to be the transparent color. Remember you must use the
    'long number. In this case, the RGB of White is "255 255 255", so the
    ...
    'SourceUpperLeftY, SourceWidth, SourceHeight, TransparentColor)
    'Using the SAME Width and Height as the Source
    ...
    = TransparentBlt(hDC4, 5, 10, 88, 65,0, 0, 57, 57, hDC1, 5, 10, 88, 65,0, 0, 57, 57, 16777215)
    'Using
    ...
    the Source (Destination x and y are also changed)
    null = TransparentBlt(hDC5, 20, 20, 66, 48,0, 0, 25, 25, hDC1, 5, 10, 88, 65,0, 0, 57, 57, 16777215)
    'Using a LARGER Width and Height as the Source (Destination x and y are also changed)
    ...
    = TransparentBlt(hDC6, -10, 0, 132, 98,0, 100, 100, hDC1, 5, 10, 88, 65,0, 0, 57, 57, 16777215)
    Wait
    sub hueBackground hue$, handle$
    ...
    close #m
    'Unload bitmap
    unloadbmp "cherry""star"
    'Close window
    close #w
    ...
    end
    '====================================================================
    ...
    obtained from Libertyinformation found in API's for
    'Liberty
    BASIC Workshop (c) Alyce
    ...
    Alyce Watson
    '====================================================================

    function TransparentBlt(hdcDest, xDest, yDest, wDest, hDest, hdcSource, xSource, ySource, wSource, hSource, clrTransp)
    calldll #m, "TransparentBlt", _
    ...
    end sub
    '====================================================================
    ...
    obtained from
    'API's for
    Liberty BASIC
    'Workshop
    (c) Alyce
    ...
    with permission of
    'of
    Alyce Watson
    '====================================================================
    function CreateCompatibleDC(hDC)
    (view changes)
    11:33 am

More