SOURCE: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
(Created page with "{{DISPLAYTITLE:_SOURCE}} The _SOURCE statement establishes the image SOURCE using a handle created by _LOADIMAGE, _NEWIMAGE or _COPYIMAGE. {{PageSyntax}} : _SOURCE {{Parameter|handle&}} {{PageDescription}} * The handle is a LONG integer value from the _SOURCE function or a handle created by _NEWIMAGE. * If the handle is designated as 0, it refers to the current SCREEN image. * A source image can only supply info...")
 
No edit summary
 
(5 intermediate revisions by the same user not shown)
Line 8: Line 8:


{{PageDescription}}
{{PageDescription}}
* The handle is a [[LONG]] integer value from the [[_SOURCE (function)|_SOURCE]] function or a handle created by [[_NEWIMAGE]].  
* The handle is a [[LONG]] integer value from the [[_SOURCE (function)|_SOURCE]] function or a handle created by [[_NEWIMAGE]].
* If the handle is designated as 0, it refers to the current [[SCREEN]] image.
* If the handle is designated as 0, it refers to the current [[SCREEN]] image.
* A source image can only supply information to a program. [[POINT]] and [[GET (graphics statement)|GET]] might require a source other than the one currently active.
* A source image can only supply information to a program. [[POINT]] and [[GET (graphics statement)|GET]] might require a source other than the one currently active.
Line 14: Line 14:


{{PageExamples}}
{{PageExamples}}
{{CodeStart}} '' ''
{{CodeStart}}
{{Cl|SCREEN}} 13
{{Cl|SCREEN}} 13
a = {{Cl|_NEWIMAGE}}(320,200,13)
a = {{Cl|_NEWIMAGE}}(320,200,13)
Line 21: Line 21:
{{Cl|_SOURCE}} a
{{Cl|_SOURCE}} a
{{Cl|_DEST}} 0
{{Cl|_DEST}} 0
{{Cl|PRINT}} {{Cl|POINT}}(100, 100) '' ''
{{Cl|PRINT}} {{Cl|POINT}}(100, 100)
{{CodeEnd}}
{{CodeEnd}}
{{OutputStart}}
{{OutputStart}}
Line 28: Line 28:
: ''Explanation:'' Create a new image with handle 'a', then use [[_DEST]] to define the image to draw on. Draw a pixel then set the source to 'a' and use [[POINT]] to show what color is in that position. White (15) and is the color set with [[PSET]]. Use [[_DEST]] 0 for the screen to display the results.
: ''Explanation:'' Create a new image with handle 'a', then use [[_DEST]] to define the image to draw on. Draw a pixel then set the source to 'a' and use [[POINT]] to show what color is in that position. White (15) and is the color set with [[PSET]]. Use [[_DEST]] 0 for the screen to display the results.


 
=== More examples ===
===More examples===
See the examples in:
* [[Bitmaps]]
* [[Bitmaps]]
* [[SAVEIMAGE]]
* [[SaveImage SUB]]
* [[SaveIcon32]]
* [[SaveIcon32]]



Latest revision as of 20:05, 5 January 2024

The _SOURCE statement establishes the image SOURCE using a handle created by _LOADIMAGE, _NEWIMAGE or _COPYIMAGE.


Syntax

_SOURCE handle&


Description

  • The handle is a LONG integer value from the _SOURCE function or a handle created by _NEWIMAGE.
  • If the handle is designated as 0, it refers to the current SCREEN image.
  • A source image can only supply information to a program. POINT and GET might require a source other than the one currently active.


Examples

SCREEN 13
a = _NEWIMAGE(320,200,13)
_DEST a
PSET (100, 100), 15
_SOURCE a
_DEST 0
PRINT POINT(100, 100)
 15
Explanation: Create a new image with handle 'a', then use _DEST to define the image to draw on. Draw a pixel then set the source to 'a' and use POINT to show what color is in that position. White (15) and is the color set with PSET. Use _DEST 0 for the screen to display the results.

More examples


See also



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