Example: /Images/GIF/Animated Gif

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

/Images/GIF/Animated Gif


Required plugins for this example: MBS Images Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Images/GIF/Animated Gif

This example is the version from Mon, 22th Nov 2015.

Project "Animated Gif.xojo_binary_project"
FileTypes
Filetype text
Filetype image/gif
End FileTypes
Class Window1 Inherits Window
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() counter=counter+1 canvas1.Backdrop=GetPicture(gif,counter) End EventHandler
End Control
Control Canvas1 Inherits Canvas
ControlInstance Canvas1 Inherits Canvas
End Control
EventHandler Sub Open() dim f as FolderItem dim g as GIFMBS f=GetOpenFolderItem("image/gif") if f=nil then Return if f.Exists then Title=f.DisplayName g=f.OpenAsGIFMBS if g<>nil then canvas1.Backdrop=GetPicture(g,0) gif=g end if end if End EventHandler
Protected Function Combine(p as picture, m as picture) As picture dim q as Picture = New Picture(p.Width,p.Height,32) q.Graphics.DrawPicture p,0,0 q.Mask.Graphics.DrawPicture m,0,0 Return q End Function
Protected Function GetPicture(g as gifmbs, index as integer) As picture dim b as GifBlockMBS dim p as GifPictureMBS dim i,c,n as integer dim q as Picture // Quick and dirty way. // not speed optimized! // does cycle over all images and draws new ones over older ones c=g.Count do for i=0 to c-1 b=g.Block(i) if b<>nil then p=b.Picture if p<>Nil then if n=0 then q=Combine(p.MakePicture,p.MakeMask) else q.Graphics.DrawPicture Combine(p.MakePicture,p.MakeMask),p.Left,p.top end if if index=n then Return q end if n=n+1 // found a picture end if end if next loop End Function
Property Protected counter As integer
Property Protected gif As gifmbs
End Class
MenuBar MenuBar1
MenuItem UntitledMenu1 = ""
MenuItem FileMenu = "&File"
MenuItem FileQuit = "Quit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu0 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class
End Project

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


💬 Ask a question or report a problem