Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: TImage experimental

  1. #1
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    54
    Posts
    8,636
    Blog Entries
    2
    Rep Power
    10

    TImage experimental

    I'm testing a very simple module able to load BMP, ICO, JPG, TGA, PNG and TIFF images.
    Target of the module is very precise and limited: the ability to load different images format other than just BMP and return a handle to windows bitmap of the image so functionalities are very few but I think enough to be very very useful for many activities.

    Syntax of the new keywords inside the module are the following:
    [code=thinbasic]hBmp = TImage_Load(nIdx, ImageFileName)
    lResult = TImage_Save(nIdx, ImageFileName, nType)
    lResult = TImage_Unload(nIdx)
    Width = TImage_Width(nIdx)
    Height = TImage_Height(nIdx)
    hBmp = TImage_Handle(nIdx)[/code]
    Where:
    • nIdx is a user unique number used to identify the image and is assigned during TImage_Load. Just use a number like 1 or 2 or 3 or whatever number you like. nIdx is than used in all other functions to identify the image.
    • nType is one of the following equates: %TImage_BMP, %TImage_JPG, %TImage_PNG


    I would like to have some feedback and tests. It should work on Win9x systems withoutthe need of GDI+ library but it needs Microsoft Visual C runtime (that should be present mainly on all Win9x systems)
    If there will be no big problems I will deliver with official release.

    Attached: module dll, module sources, example.

    Thanks a lot
    Eros

    ps: TImage module takes advantages of PBIMAGE.DLL By Dean Hodgson I've found on another forum. PBIMAGE.DLL is loaded at module runtime from module resource directly into process memory.
    Attached Files Attached Files
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,090
    Blog Entries
    5
    Rep Power
    727

    Re: TImage experimental

    Hi Eros,

    that looks very interesting. Does the library allow to get RGB(A) or BGR(A) raw data as well?
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  3. #3
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    54
    Posts
    8,636
    Blog Entries
    2
    Rep Power
    10

    Re: TImage experimental

    No. It allows just to resize the image and nothing more.

    But ...

    (I'm not an expert on the field)
    it returns a handle to bmp. So maybe you can do something with that.

    I will attach here TImage source code (late afternoon) so you can check.

    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  4. #4
    Senior Member Lionheart008's Avatar
    Join Date
    Sep 2008
    Location
    Germany, Bad Sooden-Allendorf
    Age
    49
    Posts
    919
    Rep Power
    105

    Re: TImage experimental

    hi eros, I would like to test this module too. Looks interesting this thin image loader. perhaps it's also possible to set the images with x,y,width,height,style position or making some added controls, we will see. thanks for the nice little thing.

    I will attach here TImage source code (late afternoon) so you can check.
    I am curious, frank
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	loadImage1.png 
Views:	213 
Size:	55.7 KB 
ID:	6224  
    you can't always get what you want, but if you try sometimes you might find, you get what you need

  5. #5
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    54
    Posts
    8,636
    Blog Entries
    2
    Rep Power
    10

    Re: TImage experimental

    Attached to first post of this message full TImage source code.

    Consider you may have to change a bit include files in order to be able to compile it with Power Basic.
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  6. #6
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,090
    Blog Entries
    5
    Rep Power
    727

    Re: TImage experimental

    Thanks Eros,

    I will check it!
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  7. #7
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,090
    Blog Entries
    5
    Rep Power
    727

    Re: TImage experimental

    The code is in LibertyBASIC, it confused me as I could not recognize the syntax for a while
    The core of the functionality seems to be in image323.dll, which allows retrieving pixel colors by giving handle, x and y, but no pointer to data.

    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

  8. #8
    thinBasic MVPs
    Join Date
    May 2007
    Location
    UK
    Posts
    1,427
    Blog Entries
    1
    Rep Power
    157

    Re: TImage experimental

    I had a quick look around for more liberty stuff and found this jpeg.dll (24Kb ).

    'This DLL loads an image and returns a handle
    'to a 24-bit memory bitmap of the image.
    'Supported types: .jpg, .bmp, .ico, .emf, .wmf, .gif
    '= jpeg, bitmap, icon, enhanced metafile,
    'windows metafile, and GIF

    http://alycesrestaurant.com/dll.htm
    Attached Files Attached Files
    Home Desktop : Windows 7 - Intel Pentium (D) - 3.0 Ghz - 2GB - Geforce 6800GS
    Home Laptop : WinXP Pro SP3 - Intel Centrino Duo - 1.73 Ghz - 2 GB - Intel GMA 950
    Home Laptop : Windows 10 - Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz, 2401 Mhz, 2 Core(s), 4 Logical Processor(s) - 4 GB - Intel HD 4400
    Work Desktop : Windows 10 - Intel I7 - 4 Ghz - 8GB - Quadro Fx 370

  9. #9
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    54
    Posts
    8,636
    Blog Entries
    2
    Rep Power
    10

    Re: TImage experimental

    TImage module takes advantages of PBIMAGE.DLL By Dean Hodgson and not the other dlls.
    PBIMAGE.DLL has more image formats.
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  10. #10
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    54
    Posts
    8,636
    Blog Entries
    2
    Rep Power
    10

    Re: TImage experimental

    To get the BITMAP info from bitmap handle you can use the following code:
    [code=thinbasic]
    Declare Function GetObject Lib "GDI32.DLL" Alias "GetObjectA" (ByVal hObject As DWord, ByVal nCount As Long, ByVal lpObject As DWord) As Long
    .
    .
    .
    hImg = TImage_Load (%MyImage, sBITMAP)

    Dim BI As tBITMAP
    GetObject(hImg, SIZEOF(bi), VARPTR(bi))

    MsgBox 0, "Bitmap Info: " & $CRLF & _
    "bmType: " & $TAB & BI.bmType & $CRLF & _
    "bmWidth: " & $TAB & BI.bmWidth & $CRLF & _
    "bmHeight: " & $TAB & BI.bmHeight & $CRLF & _
    "bmWidthBytes: " & $TAB & BI.bmWidthBytes & $CRLF & _
    "bmPlanes: " & $TAB & BI.bmPlanes & $CRLF & _
    "bmBitsPixel: " & $TAB & BI.bmBitsPixel & $CRLF & _
    "bmBits: " & $TAB & BI.bmBits & $CRLF & _
    ""
    [/code]

    BI.bmBits element is the BYTE PTR to location of the bit values for the bitmap
    http://msdn.microsoft.com/en-us/library/dd183371(VS.85).aspx

    Can this be of any help?
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •