Example: /MacCG/CoreGraphics DirectDisplay/Capture Screen with CGContextMBS

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCG/CoreGraphics DirectDisplay/Capture Screen with CGContextMBS


Required plugins for this example: MBS MacCG Plugin, MBS MacCF Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCG/CoreGraphics DirectDisplay/Capture Screen with CGContextMBS

This example is the version from Sun, 17th Mar 2012.

Project "Capture Screen with CGContextMBS.xojo_binary_project"
Class Window1 Inherits Window
EventHandler Sub Close() dim e as integer w.cancel=True do loop until w.finished e=display.ShowCursor e=display.ReleaseAllDisplays End EventHandler
EventHandler Function KeyDown(Key As String) As Boolean if asc(key)=27 then // esc quit Return true end if End EventHandler
EventHandler Sub Open() dim e as integer display = CGDisplayMBS.MainDisplay // main screen e=display.CaptureAllDisplays e=display.HideCursor w=new WorkThread w.display = Display w.run End EventHandler
Property Protected display As CGDisplayMBS
Property Protected w As workThread
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
EventHandler Sub Open() MsgBox "Command Q will stop it." End EventHandler
End Class
Class WorkThread Inherits Thread
EventHandler Sub Run() finished=False cancel=False count=240 // start with white do work loop until cancel finished=true End EventHandler
Protected Sub Work() dim c as CGContextMBS = Display.DrawingContext if c<>Nil then c.SetRGBFillColor rnd, rnd, rnd, 1.0 c.FillRect CGMakeRectMBS(0,0,Display.PixelsWide,Display.PixelsHigh) end if End Sub
Property cancel As boolean
Property count As integer
Property display As CGDisplayMBS
Property finished As boolean
End Class
End Project

See also:

The items on this page are in the following plugins: MBS MacCG Plugin.


💬 Ask a question or report a problem