CLIPBOARDIMAGE (function): Difference between revisions
Jump to navigation
Jump to search
Code by Fellippe Heitor
Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link
No edit summary |
No edit summary |
||
Line 10: | Line 10: | ||
* When the paste operation is successful, {{Parameter|newImageHandle&}} will be < -1. Handle values of -1 or 0 indicate that there wasn't an image in the clipboard or that the format wasn't accepted. | * When the paste operation is successful, {{Parameter|newImageHandle&}} will be < -1. Handle values of -1 or 0 indicate that there wasn't an image in the clipboard or that the format wasn't accepted. | ||
* Use [[_FREEIMAGE]] to free the memory used by {{Parameter|newImageHandle&}} when it's no longer needed by your program. | * Use [[_FREEIMAGE]] to free the memory used by {{Parameter|newImageHandle&}} when it's no longer needed by your program. | ||
* '''[[Keywords currently not supported by QB64# | * '''[[Keywords currently not supported by QB64#Keywords_not_supported_in_Linux_or_macOS_versions|Keyword not supported in Linux or macOS versions]]''' | ||
Revision as of 01:44, 24 January 2023
The _CLIPBOARDIMAGE function pastes an image from the clipboard into a new 32-bit image in memory.
Syntax
- newImageHandle& = _CLIPBOARDIMAGE
Description
- When the paste operation is successful, newImageHandle& will be < -1. Handle values of -1 or 0 indicate that there wasn't an image in the clipboard or that the format wasn't accepted.
- Use _FREEIMAGE to free the memory used by newImageHandle& when it's no longer needed by your program.
- Keyword not supported in Linux or macOS versions
Availability
- Build 20170906/64 onward.
Examples
Example: Monitoring the clipboard for new images copied from other programs:
SCREEN _NEWIMAGE(800, 600, 32) DO CLS COLOR _RGB32(177, 177, 177) PRINT "Monitoring clipboard..." IF img& < -1 THEN _FREEIMAGE img& img& = _CLIPBOARDIMAGE IF img& < -1 THEN PRINT "Image found:" COLOR _RGB32(255, 255, 255) PRINT "Width :"; _WIDTH(img&) PRINT "Height:"; _HEIGHT(img&) w = _WIDTH / 2 - _WIDTH(img&) / 2 IF w < 0 THEN w = 0 _PUTIMAGE (w, CSRLIN * _FONTHEIGHT), img& ELSE PRINT "No image found." END IF _DISPLAY _LIMIT 10 LOOP |
See also
- _CLIPBOARDIMAGE (statement - used to copy an image to the clipboard)
- _CLIPBOARD$, _CLIPBOARD$ (statement) (used to copy/paste text)