CLIP: Difference between revisions

From QB64 Phoenix Edition Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 16: Line 16:
''Example:'' Placing an image partially or fully offscreen.
''Example:'' Placing an image partially or fully offscreen.
{{CodeStart}}
{{CodeStart}}
{{Cl|DIM}} mypic(500)
{{Cl|DIM}} mypic({{Text|500|#F580B1}})
{{Cl|SCREEN}} 13
{{Cl|SCREEN}} {{Text|13|#F580B1}}


{{Cl|CLS}}
{{Cl|CLS}}
{{Cl|CIRCLE}} (10,10),10
{{Cl|CIRCLE}} ({{Text|10|#F580B1}}, {{Text|10|#F580B1}}), {{Text|10|#F580B1}}
{{Cl|GET (graphics statement)|GET}} (0,0)-(20,20), mypic(0)
{{Cl|GET (general)|GET}} ({{Text|0|#F580B1}}, {{Text|0|#F580B1}})-({{Text|20|#F580B1}}, {{Text|20|#F580B1}}), mypic({{Text|0|#F580B1}})


{{Cl|PRINT}} "This program puts an image off screen."
{{Cl|PRINT}} {{Text|<nowiki>"This program puts an image off screen."</nowiki>|#FFB100}}
{{Cl|PRINT}} "Select which option you'd like to try."
{{Cl|PRINT}} {{Text|<nowiki>"Select which option you'd like to try."</nowiki>|#FFB100}}
{{Cl|PRINT}} "1 will produce an illegal function call."
{{Cl|PRINT}} {{Text|<nowiki>"1 will produce an illegal function call."</nowiki>|#FFB100}}
{{Cl|PRINT}} "1 is putting without _CLIP."
{{Cl|PRINT}} {{Text|<nowiki>"1 is putting without _CLIP."</nowiki>|#FFB100}}
{{Cl|PRINT}} "2 is putting with _CLIP PSET."
{{Cl|PRINT}} {{Text|<nowiki>"2 is putting with _CLIP PSET."</nowiki>|#FFB100}}
{{Cl|PRINT}} "3 is putting with _CLIP XOR."
{{Cl|PRINT}} {{Text|<nowiki>"3 is putting with _CLIP XOR."</nowiki>|#FFB100}}
{{Cl|PRINT}} "4 is putting with _CLIP PSET, 4."
{{Cl|PRINT}} {{Text|<nowiki>"4 is putting with _CLIP PSET, 4."</nowiki>|#FFB100}}


{{Cl|INPUT}} sel
{{Cl|INPUT}} sel
{{Cl|IF...THEN|IF}} sel = 1 {{Cl|THEN}} {{Cl|PUT (graphics statement)|PUT}} (-10, 10), mypic(0), PSET ' this causes an illegal function call
{{Cl|IF}} sel = {{Text|1|#F580B1}} {{Cl|THEN}} {{Cl|PUT (general)|PUT}} ({{Text|-10|#F580B1}}, {{Text|10|#F580B1}}), mypic({{Text|0|#F580B1}}), {{Cl|PSET}} {{Text|<nowiki>' this causes an illegal function call</nowiki>|#919191}}
{{Cl|IF...THEN|IF}} sel = 2 {{Cl|THEN}} {{Cl|PUT (graphics statement)|PUT}} (-10, 10), mypic(0), {{Cl|_CLIP}} PSET ' allows graphic to be drawn off-screen
{{Cl|IF}} sel = {{Text|2|#F580B1}} {{Cl|THEN}} {{Cl|PUT (general)|PUT}} ({{Text|-10|#F580B1}}, {{Text|10|#F580B1}}), mypic({{Text|0|#F580B1}}), {{Cl|_CLIP}} {{Cl|PSET}} {{Text|<nowiki>' allows graphic to be drawn off-screen</nowiki>|#919191}}
{{Cl|IF...THEN|IF}} sel = 3 {{Cl|THEN}} {{Cl|PUT (graphics statement)|PUT}} (-10, 10), mypic(0), {{Cl|_CLIP}} ' uses the default PUT XOR operation
{{Cl|IF}} sel = {{Text|3|#F580B1}} {{Cl|THEN}} {{Cl|PUT (general)|PUT}} ({{Text|-10|#F580B1}}, {{Text|10|#F580B1}}), mypic({{Text|0|#F580B1}}), {{Cl|_CLIP}} {{Text|<nowiki>' uses the default PUT XOR operation</nowiki>|#919191}}
{{Cl|IF...THEN|IF}} sel = 4 {{Cl|THEN}} {{Cl|PUT (graphics statement)|PUT}} (-10, 10), mypic(0), {{Cl|_CLIP}} PSET, 4 ' doesn't draw red pixels
{{Cl|IF}} sel = {{Text|4|#F580B1}} {{Cl|THEN}} {{Cl|PUT (general)|PUT}} ({{Text|-10|#F580B1}}, {{Text|10|#F580B1}}), mypic({{Text|0|#F580B1}}), {{Cl|_CLIP}} {{Cl|PSET}}, {{Text|4|#F580B1}} {{Text|<nowiki>' doesn't draw red pixels</nowiki>|#919191}}


{{Cl|END}}  
{{Cl|END}}
{{CodeEnd}}
{{CodeEnd}}


Line 48: Line 48:


{{PageNavigation}}
{{PageNavigation}}
[[Category:Latest]]

Latest revision as of 14:08, 20 March 2023

The _CLIP option is used in a QB64 graphics PUT to allow placement of an image partially off of the screen.


Syntax

PUT [[[STEP]]](column, row), image_array(start)[, _CLIP] [{XOR|PSET|AND|OR|PRESET}][, omitcolor]


Description

  • _CLIP should be placed immediately before the PUT action if used. XOR is default when not used.
  • The offscreen portions of the image will be the omit color.
  • GET can get portions of the images off screen in QB64.


Examples

Example: Placing an image partially or fully offscreen.

DIM mypic(500)
SCREEN 13

CLS
CIRCLE (10, 10), 10
GET (0, 0)-(20, 20), mypic(0)

PRINT "This program puts an image off screen."
PRINT "Select which option you'd like to try."
PRINT "1 will produce an illegal function call."
PRINT "1 is putting without _CLIP."
PRINT "2 is putting with _CLIP PSET."
PRINT "3 is putting with _CLIP XOR."
PRINT "4 is putting with _CLIP PSET, 4."

INPUT sel
IF sel = 1 THEN PUT (-10, 10), mypic(0), PSET ' this causes an illegal function call
IF sel = 2 THEN PUT (-10, 10), mypic(0), _CLIP PSET ' allows graphic to be drawn off-screen
IF sel = 3 THEN PUT (-10, 10), mypic(0), _CLIP ' uses the default PUT XOR operation
IF sel = 4 THEN PUT (-10, 10), mypic(0), _CLIP PSET, 4 ' doesn't draw red pixels

END


See also



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