Scripting Resources for DigitalMicrograph™

banner

Dave Mitchell's DigitalMicrograph™ Scripting Website

Home | Scripts | Examples | Functions | Recent Updates | Tutorials | Resources | Publications | Consulting | Projects | Contact & Bio |PyJEM| Search

 

Zoom To Full Screen
Function
Zooms the image to fit the full size of the screen.
Version
version:20030202, v3.0
Author
D. R. G. Mitchell
Acknowledgements
-
Comments
Useful for displaying images to groups of people. This tool is incorporated into DisplayTools - a suite of tools for manipulating image displays.
System Requirements
Should be compatible with all recent versions of DigitalMicrograph.
Known Issues
-
Supported
Yes
Included Files
Main script file.
Source Code

// Zooms the image to the fit the full size of the monitor

// D. R. G. Mitchell, adminnospam@dmscripting.com (remove the nospam to make this email address work)

// version:20030202

// v3.0, Feb 2003

 

 

// Count the number of open images (type 5) and exit if none shown

 

number shownimages=countdocumentwindowsoftype(5)

 

if(shownimages<1) exit(0)

 

Image myImage := GetFrontImage()

 

number screenWidth, screenHeight, imagewidth, imageheight, zoomfactor

number xPos, yPos, zoom

GetScreenSize( screenWidth, screenHeight )

number workingareawidth = screenwidth-150

number workingareaheight = screenheight-32

 

GetSize( myImage, imagewidth, imageheight)

number scalewidth = workingareawidth/imagewidth

number scaleheight = workingareaheight/imageheight

 

If(scalewidth>scaleheight)

{

zoomfactor = scaleheight

}

else

{

zoomfactor = scalewidth

}

 

SetWindowPosition( myImage, 142,24 )

SetWindowSize( myImage, imagewidth*zoomfactor, imageheight*zoomfactor)

setzoom(myimage, zoomfactor)

SetImagePositionWithinWindow( myImage, 0, 0 )