Announcement

Collapse
No announcement yet.

Using ListView to load JPG/GIF - Updates?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • José Roca
    replied
    Deleted.
    Last edited by José Roca; 18 Jul 2009, 03:25 PM.

    Leave a comment:


  • José Roca
    replied
    I use my own include files, available in my forum. Please read the posts above.

    Leave a comment:


  • Gary Beene
    replied
    Thanks Jose,

    I'm having trouble finding the link to the gdiplus.inc.

    I see a Part1/2 in the Source Code forum, circa 2002.

    Is there a more recent version?

    I'll give your code a try! I've been wanting to step into the GDI+ arena and play, this will be a good time.

    Leave a comment:


  • Paul Squires
    replied
    No problem Mike - happy that I could help. It boggles my mind the amount of work and effort that Jose has put into these new include files. It is an amazing work and all of Jose's new code is based on using these includes. The new includes have opened up a wide range of new technologies for PB'ers.

    Leave a comment:


  • Mike Doty
    replied
    916 files and it worked immediately.
    Thank you!
    Last edited by Mike Doty; 18 Jul 2009, 12:16 PM.

    Leave a comment:


  • Paul Squires
    replied
    Mike,

    You should Jose's new WinAPI headers that he provides for free. Check out the latest version (1.14) available at http://www.jose.it-berater.org/smffo...hp?board=344.0

    Basically, you would install his includes into a separate folder and then point the compiler to that folder rather than the one that ships with the compiler (ie. the \WinAPI folder). Jose's includes are much more complete than the ones that ship with the compiler.

    Leave a comment:


  • Mike Doty
    replied
    Jose,
    Which win32api.inc do you use? Get duplicate equate messages.
    http://www.powerbasic.com/support/downloads/windows.htm (not current.)

    win32api.inc with the current compilers is dated Last Update: 26 January 2009
    The one in the powerbasic support forum is dated 2005. http://www.powerbasic.com/support/downloads/windows.htm (old)
    It might be nice for PowerBASIC to work with Jose on this.
    Last edited by Mike Doty; 18 Jul 2009, 08:45 AM.

    Leave a comment:


  • José Roca
    replied
    To use a ListView to load an image and later move it to a graphic control? A bit cumbersome, don't think you? Much easier to use GDI+.

    See this example in my forum:


    The zipped file contains three examples, one using SDK code, another using DDT and another using a DDT graphic control:

    Code:
    ' ========================================================================================
    ' GdipDrawImage
    ' ========================================================================================
    
    ' SED_PBWIN
    #COMPILE EXE
    #DIM ALL
    #INCLUDE "GDIPLUS.INC"
    
    %IDC_GRAPHIC  = 101
    
    ' ========================================================================================
    ' The following example draws an image with its upper-left corner at (10, 10).
    ' ========================================================================================
    SUB GDIP_DrawImage (BYVAL hdc AS DWORD)
    
       LOCAL hStatus AS LONG
       LOCAL pGraphics AS DWORD
       LOCAL pImage AS DWORD
       LOCAL strFileName AS STRING
    
       hStatus = GdipCreateFromHDC(hdc, pGraphics)
    
       ' // Create the Image object
       strFileName = UCODE$("climber.jpg")
       hStatus = GdipLoadImageFromFile(STRPTR(strFileName), pImage)
    
       ' // Draw the image
       hStatus = GdipDrawImage(pGraphics, pImage, 10, 10)
    
       ' // Cleanup
       IF pImage THEN GdipDisposeImage(pImage)
       IF pGraphics THEN GdipDeleteGraphics(pGraphics)
    
    END SUB
    ' ========================================================================================
    
    ' ========================================================================================
    ' Main
    ' ========================================================================================
    FUNCTION WINMAIN (BYVAL hInstance AS DWORD, BYVAL hPrevInstance AS DWORD, BYVAL lpszCmdLine AS ASCIIZ PTR, BYVAL nCmdShow AS LONG) AS LONG
    
       LOCAL hr AS LONG
       LOCAL hDlg AS DWORD
       LOCAL hdc AS DWORD
       LOCAL token AS DWORD
       LOCAL StartupInput AS GdiplusStartupInput
    
       ' Initialize GDI+
       StartupInput.GdiplusVersion = 1
       hr = GdiplusStartup(token, StartupInput, BYVAL %NULL)
       IF hr THEN
          MSGBOX "Error initializing GDI+"
          EXIT FUNCTION
       END IF
    
       ' Create a new dialog
       DIALOG NEW PIXELS, 0, "GdipDrawImage", , , 420, 250, %WS_SYSMENU TO hDlg
    
       ' Add a graphic control
       CONTROL ADD GRAPHIC, hDlg, %IDC_GRAPHIC,"", 0, 0, 420, 250
       ' Select the drawing target
       GRAPHIC ATTACH hDlg, %IDC_GRAPHIC
       ' Set the foreground and background color
       GRAPHIC COLOR %BLACK, %WHITE
       ' Clear the entire selected graphic window
       GRAPHIC CLEAR
       ' Retrieve the handle of the device context
       GRAPHIC GET DC TO hdc
       ' Draw the graphics
       GDIP_DrawImage hdc
    
       DIALOG SHOW MODAL hDlg, CALL DlgProc
    
       ' Shutdown GDI+
       GdiplusShutdown token
    
    END FUNCTION
    ' ========================================================================================
    
    ' ========================================================================================
    ' Main Dialog procedure
    ' ========================================================================================
    CALLBACK FUNCTION DlgProc() AS LONG
    
       SELECT CASE CBMSG
    
          CASE %WM_COMMAND
             SELECT CASE CBCTL
                CASE %IDCANCEL
                   IF CBCTLMSG = %BN_CLICKED THEN DIALOG END CBHNDL, 0
             END SELECT
    
       END SELECT
    
    END FUNCTION
    ' ========================================================================================

    Leave a comment:


  • Gary Beene
    started a topic Using ListView to load JPG/GIF - Updates?

    Using ListView to load JPG/GIF - Updates?

    I ran into this code ... tested it and it seemed to work fine.



    Has anyone updated it to load the image into one of the graphic targets (Graphic Control, Memory Bitmap, or Graphic Window)?

    I was surprised to find so little mention of it. Seems like a very useful niche code - especially if the image can be moved to one of the graphic targets to make it available for other PowerBASIC actions.

    ... added later - here's another online link discussing the approach.
    Last edited by Gary Beene; 17 Jul 2009, 11:47 PM.
Working...
X
😀
🥰
🤢
😎
😡
👍
👎