mirror of
https://github.com/QB64Official/qb64.git
synced 2024-08-22 05:35:08 +00:00
51 lines
1.9 KiB
Text
51 lines
1.9 KiB
Text
{{DISPLAYTITLE:_CLIPBOARDIMAGE (function)}}
|
|
The [[_CLIPBOARDIMAGE (function)|_CLIPBOARDIMAGE]] function pastes an image from the clipboard into a new 32-bit image in memory.
|
|
|
|
|
|
{{PageSyntax}}
|
|
: {{Parameter|newImageHandle&}} = [[_CLIPBOARDIMAGE (function)|_CLIPBOARDIMAGE]]
|
|
|
|
|
|
{{PageDescription}}
|
|
* 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.
|
|
* [[Keywords_currently_not_supported_by_QB64#Keywords_Not_Supported_in_Linux_or_MAC_OSX_versions|Not available in Linux or macOS]].
|
|
|
|
|
|
{{PageAvailability}}
|
|
* Build 20170906/64 and up.
|
|
|
|
|
|
{{PageExamples}}
|
|
''Example:'' Monitoring the clipboard for new images copied from other programs:
|
|
{{CodeStart}}{{Cl|SCREEN}} {{Cl|_NEWIMAGE}}(800, 600, 32)
|
|
{{Cl|DO}}
|
|
{{Cl|CLS}}
|
|
{{Cl|COLOR}} {{Cl|_RGB32}}(177, 177, 177)
|
|
{{Cl|PRINT}} "Monitoring clipboard..."
|
|
{{Cl|IF}} img& < -1 {{Cl|THEN}} _FREEIMAGE img&
|
|
img& = {{Cl|_CLIPBOARDIMAGE}}
|
|
IF img& < -1 THEN
|
|
{{Cl|PRINT}} "Image found:"
|
|
{{Cl|COLOR}} _RGB32(255, 255, 255)
|
|
{{Cl|PRINT}} "Width :"; {{Cl|_WIDTH (function)|_WIDTH}}(img&)
|
|
{{Cl|PRINT}} "Height:"; {{Cl|_HEIGHT|_HEIGHT}}(img&)
|
|
w = {{Cl|_WIDTH (function)|_WIDTH}} / 2 - {{Cl|_WIDTH (function)|_WIDTH}}(img&) / 2
|
|
IF w < 0 THEN w = 0
|
|
{{Cl|_PUTIMAGE}} (w, {{Cl|CSRLIN}} * {{Cl|_FONTHEIGHT}}), img&
|
|
ELSE
|
|
PRINT "No image found."
|
|
END IF
|
|
{{Cl|_DISPLAY}}
|
|
{{Cl|_LIMIT}} 10
|
|
{{Cl|LOOP}}
|
|
{{CodeEnd}}
|
|
{{small|Code by Fellippe Heitor}}
|
|
|
|
|
|
{{PageSeeAlso}}
|
|
* [[_CLIPBOARDIMAGE]] {{text|(statement - used to copy an image to the clipboard)}}
|
|
* [[_CLIPBOARD$]], [[_CLIPBOARD$ (statement)]] {{text|(used to copy/paste text)}}
|
|
|
|
|
|
{{PageNavigation}}
|