Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: Usage of clipboard-data as Texture

Share/Bookmark
  1. #1
    thinBasic MVPs ReneMiner's Avatar
    Join Date
    Oct 2012
    Location
    Germany
    Age
    47
    Posts
    1,213
    Blog Entries
    1
    Rep Power
    132

    Usage of clipboard-data as Texture

    it's just an idea, maybe can be done somehow but I dunno how because I have no idea what format is used to store graphics on clipboard.

    thinCore allows only to capture a text from clipboard - but thinCore is not a graphics-module.

    My idea is to have a TBGL-function that creates a texture from some image-data currently to find on clipboard, very simple, perhaps alike this

    Function TBGL_TextureFromClipboard( 
                        Byval texID as Long, 
                        Byval TBGL_TEX_Quality as Long, 
               Optional Byval lWidth as Long, 
                        Byval lHeight as Long
           ) As Long
    
    ' return ID of texture on success
    ' return 0 if no data found on clipboard/ if function failed
    ' ---
    
    ' maybe:
    
    %Size_POT = -1   ' size automatic to the nearest power-of-two 
    %Size_None = 0   ' leave size as is 
    
    TBGL_TextureFromClipboard( texID, %TBGL_TEX_CRISPANISO, %Size_POT, %Size_POT )
    
    
    ' --
    ' perhaps also have a reverse operation:
    
    Function TBGL_TextureToClipboard( texID ) As Long
    ' return True if success
    ' return False if slot texID was empty
    
    so basically one passes just the texture-slot, desired width & height and desired quality to create a texture from image-data on clipboard.
    If Width and Height are passed and are above 0 then this would be the desired texure-size,
    else the function should use either the next matching POT for Width, Height or both if below 0 and fill the leftover pixels with black on %TBGL_Data_RGB (24bit) or transparent on %TBGL_Data... that contains an alpha (32bit) or just leave the size unchanged if 0/None passed.
    Last edited by ReneMiner; 19-06-2014 at 08:46.
    Windows 10 on
    Desktop: Intel Core i5-3330 @3.0 GHz, 8 GB Ram, nVidia GeForce GT630 2 GB
    Laptop: Intel Core i3-4005U @1.7GHz, 8 GB Ram, nVidia GeForce 940M 2 GB


    The limit is Imagination

  2. #2
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,759
    Blog Entries
    3
    Rep Power
    688
    Rene,

    you are the man with excellent ideas, do you know it?

    I think I would try to develop Clipboard_GetBitmap for core first - the output could be used along with already working TBGL_MakeTexture.

    I took a note and will look into it on Sunday, will be fun!


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

  3. #3
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,759
    Blog Entries
    3
    Rep Power
    688
    Hi Rene,

    I did a bit of research, I think it would be fine to have something like:
    Clipboard_IsImage
    
    RGBAString = Clipboard_GetImage(width, height)
    
    ...where width, height is passed by reference to retrieve the dimensions.

    What do you think about such a design? Should be TBGL_MakeTexture friendly...


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

  4. #4
    thinBasic MVPs ReneMiner's Avatar
    Join Date
    Oct 2012
    Location
    Germany
    Age
    47
    Posts
    1,213
    Blog Entries
    1
    Rep Power
    132
    you mean like
    If Clipboard_IsImage Then
    
      
      Long w, h
      String s = ClipBoard_GetImage(w,h)
      
    Endif
    
    would be fine already.

    Should not be such a big problem to place the string in parts onto some other, final image-data in the desired size then to have some POT-side-length.
    An advantage of this would be, to have the data to work with instantly as raw data instead of having to retrieve it using TBGL_GetTextureData.

    Just for the Clipboard_IsImage: Is it needed at all?
    Couldn't Clipboard_GetImage just return empty string if none there? Or would Clipboard_IsImage return the image-format in the first place/ 0 if none?
    Addendum:

    Clipboard_SetImage(s,w,h) ' place a string as 24/32-Bit-Map onto clipboard?
    
    Last edited by ReneMiner; 23-06-2014 at 22:10.
    Windows 10 on
    Desktop: Intel Core i5-3330 @3.0 GHz, 8 GB Ram, nVidia GeForce GT630 2 GB
    Laptop: Intel Core i3-4005U @1.7GHz, 8 GB Ram, nVidia GeForce 940M 2 GB


    The limit is Imagination

  5. #5
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,759
    Blog Entries
    3
    Rep Power
    688
    Hi Rene,

    good ideas, as usually. With today's hardware and drivers, there is no advantage in using RGB - I think it should simply return BGRA, as it is the fastest working format.

    Could you please explain more on this please?:
    Should not be such a big problem to place the string in parts onto some other, final image-data in the desired size then to have some POT-side-length.
    An advantage of this would be, to have the data to work with instantly as raw data instead of having to retrieve it using TBGL_GetTextureData.

    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

  6. #6
    thinBasic MVPs ReneMiner's Avatar
    Join Date
    Oct 2012
    Location
    Germany
    Age
    47
    Posts
    1,213
    Blog Entries
    1
    Rep Power
    132
    intentionally I planned to retrieve (see topic) the BGRA-Data as string using TBGL_GetTextureData for further editing

    (I intend to create some Texture-Editor currently, since my Gui-project is shelved and has to wait until I can call Type-Functions on a pointer- else I would have a few hundred functions depending on a global crutch, and I'm not in the mood to do it this way because calling type-functions on a pointer has to be implemented anyway some day, else the oop/private-scope-developement would get stuck.)

    even better if I don't need to occupy some texture-slot just to get that Data from OS-clipboard into my TBGL-script, so I can let the user edit it before, i.e. I would have to re-new the data all the time anyway. And for finalizing textures I want to resize them to have some POT-side-length - but this is very app-specific, most important would be to retrieve the bitmap from clipboard in TB as first- (and of course also its size).
    Last edited by ReneMiner; 24-06-2014 at 23:11.
    Windows 10 on
    Desktop: Intel Core i5-3330 @3.0 GHz, 8 GB Ram, nVidia GeForce GT630 2 GB
    Laptop: Intel Core i3-4005U @1.7GHz, 8 GB Ram, nVidia GeForce 940M 2 GB


    The limit is Imagination

  7. #7
    Maybe you could send your app an e-mail or possibly use DDE for those illusive textures. I thought I have seen it all but this one definitely takes the prize.
    ScriptBasic Project Manager
    Project Site
    support@scriptbasic.org

  8. #8
    And for finalizing textures I want to resize them to have some POT-side-length
    Why would you want to do it manually? All contemporary implementations of OpenGL do it transparently themselves on a call to OpenGL texture load functions of the glTexImageXX family.
    Mike
    (3.2GHz i5 Core Quad w/ 8GB RAM, 2 x GTX 550Ti SLI-bridged w/ 2GB VRAM, x64 Windows 7 Ultimate Sp1)

  9. #9
    thinBasic MVPs ReneMiner's Avatar
    Join Date
    Oct 2012
    Location
    Germany
    Age
    47
    Posts
    1,213
    Blog Entries
    1
    Rep Power
    132
    any other user-defined size would be fine too, not just POT,
    and while I let the user edit the string containing the texture, it needs some function to resize it anyway, that should not be an issue. As you can see I posted this in TBGL-section because I thought chances are bigger to get a new TBGL-version in near future and I was hoping Petr would find a way to instantly place data from clipboard into some texture-slot - and that's why i suggested user-defineable sizes for the function...
    Windows 10 on
    Desktop: Intel Core i5-3330 @3.0 GHz, 8 GB Ram, nVidia GeForce GT630 2 GB
    Laptop: Intel Core i3-4005U @1.7GHz, 8 GB Ram, nVidia GeForce 940M 2 GB


    The limit is Imagination

  10. #10
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    6,759
    Blog Entries
    3
    Rep Power
    688
    All contemporary implementations of OpenGL do it transparently themselves on a call to OpenGL texture load functions of the glTexImageXX family
    Sadly, this is not 100% true, even as of 2014. In theory, they should, but even my beloved Nvidia sometimes surprises me badly with NPOT textures incorrectly aligned.

    Rene, I will look into this during weekend again, stay tuned


    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 7 64bit - Intel Core 2 Duo T6600 @ 2.2GHz - 4 GB RAM - NVIDIA GeForce G210M 512MB
    Windows 8 64bit - Intel Core i5-3350P @ 3.1GHz - 8 GB RAM - NVIDIA GeForce GT640 3GB

Page 1 of 3 123 LastLast

Similar Threads

  1. getting info from the clipboard
    By stapper in forum UI (User Interface)
    Replies: 4
    Last Post: 08-08-2011, 20:23
  2. Data trigger and data events
    By ErosOlmi in forum TBEM module - thinBasic Event Manager module
    Replies: 9
    Last Post: 10-10-2008, 22:54
  3. How to put Down Arrow into clipboard
    By jbellies in forum OS
    Replies: 11
    Last Post: 23-10-2007, 19:54
  4. NEW ThinAIR utility (TBCode to Clipboard)
    By RobertoBianchi in forum thinAir General
    Replies: 2
    Last Post: 31-05-2006, 14:19

Posting Permissions

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