CLIPBOARDIMAGE: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
No edit summary
(Update availability)
Line 15: Line 15:


{{PageAvailability}}
{{PageAvailability}}
* '''Build 20170906/64''' onward.
<!-- QB64 = a version or none, QBPE = a version or all, Platforms = yes or no -->
<gallery widths="48px" heights="48px" mode="nolines">
File:Qb64.png|'''v1.3'''
File:Qbpe.png|'''all'''
File:Apix.png
File:Win.png|'''yes'''
File:Lnx.png|'''yes'''
File:Osx.png|'''yes'''
</gallery>
<!-- additional availability notes go below here -->
* Available for ''macOS'' and ''Linux'' since '''QB64-PE v3.13.0'''





Revision as of 12:03, 6 April 2024

The _CLIPBOARDIMAGE statement copies a valid QB64 image to the clipboard.


Syntax

_CLIPBOARDIMAGE = existingImageHandle&


Description


Availability

  • Available for macOS and Linux since QB64-PE v3.13.0


Examples

Example: Create a sample image and copy it to the clipboard:

SCREEN _NEWIMAGE(800, 600, 32)

'Create image in memory:
canvas& = _NEWIMAGE(300, 200, 32)
_DEST canvas&

'Draw some random rectangles:
RANDOMIZE TIMER
FOR i = 1 TO 100
    LINE (-100 + RND * _WIDTH, -100 + RND * _HEIGHT)-STEP(RND * 150, RND * 150), _RGB(RND * 255, RND * 255, RND * 255), BF
NEXT
LINE (0, 0)-(_WIDTH - 1, _HEIGHT - 1), _RGB(255, 255, 255), B
COLOR _RGB(0, 0, 0), _RGB(255, 255, 255)
m$ = " Hello, world! "
_PRINTSTRING (_WIDTH / 2 - _PRINTWIDTH(m$) / 2, _HEIGHT / 2 - _FONTHEIGHT / 2), m$

'Show the image:
_DEST 0
_PUTIMAGE (_WIDTH / 2 - _WIDTH(canvas&) / 2, _HEIGHT / 2 - _HEIGHT(canvas&) / 2), canvas&
PRINT "Image generated."

'Copy to the clipboard:
_CLIPBOARDIMAGE = canvas&

PRINT "Image copied to clipboard."
Code by Fellippe Heitor


See also



Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link