1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-06-29 11:40:38 +00:00
QB64-PE/internal/help/_CLIPBOARDIMAGE_(function).txt
SteveMcNeill 33adc04fc4 Add temp folder to repo. It's necessary as well!
Just more initial setting on... nothing much to see here.
2022-04-28 13:39:56 -04:00

53 lines
1.9 KiB
Plaintext

{{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]].
==Availability==
* '''Build 20170906/64''' onward.
{{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}}
<