My Submission for
SetScissor is a screen magnifier using view offset and zoom (the submit doesn't seem to be working for me (chrome) -
http://www.appgamekit.com/documentation/Reference/Core/SetScissor.htm)
Version: 108.14
Tier: 1
// Screen Magnifier - Example of Using SetScissor with SetViewOffset() & SetViewZoom()
// By Marl = 12 July 2013
//
// To use this example, you will need a picture in the media folder of the project
// Called "background.png", this should ideally be the same aspect ratio as the device.
//
// Operation
// Touch the screen at the point to be magnified
// Escape (Back) to exit
//
// Get Device Resolution
thisWidth = getDeviceWidth()
thisHeight = getDeviceHeight()
thisMidX = thisWidth * 0.5
thisMidY = thisHeight * 0.5
// Size of area to be magnified ( initially 1/3 of display )
ScissorW = thisWidth / 3.0
ScissorH = thisHeight / 3.0
// Zoom Magnification
myZoom# = 3.0
// Switch Device Resolution
setVirtualResolution( thisWidth , thisHeight )
sync()
// Load an image for the background and create a sprite for it
myImage = loadImage( "background.png" )
mySprite = createSprite( myImage )
// Set Sprite Size to full screen and depth to 100
setSpriteSize( mySprite , thisWidth , thisHeight )
setSpriteDepth( mySprite , 100 )
// Set Sprite to World Plane so we can use setviewOffset()
fixSpriteToScreen( mySprite , 0)
ScissorX = 0
ScissorY = 0
// Precalculate offset from pointer to top left of magnified area
myOffsetScale# = 0.5 / myZoom#
myOffsetX# = ScissorW * myOffsetScale#
myOffsetY# = ScissorH * myOffsetScale#
// Initialise X and Y of portion to magnify - initially center
myX = thisMidX - myOffsetX#
myY = thisMidY - myOffsetY#
// Create a Sprite to represent to zoomed portion in Transparent Orange
mySprite2 = createSprite( 0 )
setSpriteSize( mySprite2 , myOffsetX# * 2.0 , myOffsetY# * 2.0 )
setSpriteColor( mySprite2 , 255 , 191 , 0 , 127 )
setSpritePositionByOffset( mySprite2 , thisMidX , thisMidY )
do
// Escape Key to Exit (Back on mobile devices)
if getRawKeyState(27) then exit
// Check if pointer is pressed
if getPointerState()
// Get pointer position and determine offset to top left of magnified region
pointerX = getPointerX()
pointerY = getPointerY()
myX = pointerX - myOffsetX#
myY = pointerY - myOffsetY#
// Position Orange Sprite
setSpritePositionByOffset( mySprite2 , pointerX , pointerY )
// Position zoom region away from pointer
if pointerX > thisMidX
ScissorX = 0
else
ScissorX = thisWidth - ScissorW
endif
if pointerY > thisMidY
ScissorY = 0
else
ScissorY = thisHeight - ScissorH
endif
endif
// Render full screen Image
update(0)
render()
// Limit drawing to magnified region
setScissor( ScissorX , ScissorY , ScissorX + ScissorW , ScissorY + ScissorH )
setViewZoom( myZoom# )
setViewOffset( myX - ScissorX / myZoom# , myY - ScissorY / myZoom# )
// Hide Highlight Sprite
setSpriteVisible( mySprite2 , 0 )
// Draw magnified region
render()
// Restore Scissor
setScissor( 0 , 0, thisWidth , thisHeight )
setViewZoom( 1.0 )
setViewOffset( 0 , 0 )
// Show Highlight Sprite
setSpriteVisible( mySprite2 , 1 )
// Swap Buffer
swap()
loop
// Clean up
deleteSprite( mySprite )
deleteSprite( mySprite2 )
deleteimage( myImage )
// Exit
end

edit: Typos and additional comments in code