Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

/Images/GIF/Gif Write Picture
Required plugins for this example: MBS Images Plugin, MBS Main Plugin, MBS Picture Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Images/GIF/Gif Write Picture
This example is the version from Mon, 22th Nov 2015.
Project "Gif Write Picture.rbp"
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() // take some picture dim pic as Picture = logoMBS(500) dim pc as new PaletteCalculatorMBS call pc.CreatePicturePalette(pic) // create palette dim pal as new GifPaletteMBS pal.Count=256 for i as integer=0 to 255 dim co as color=pc.col(i) pal.Red(i)=co.red pal.green(i)=co.green pal.blue(i)=co.blue next // create 8 bit picture for that palette dim data as MemoryBlock = pc.TransformBetterDithering(pic) // assemble the GIF image dim p as new GifPictureMBS p.Data = data p.Width = pic.Width p.Height = pic.Height p.Palette = pal p.Top = 0 p.Left = 0 p.Interlace = true p.PaletteDepth = 8 Dim b as new GifBlockMBS b.Intro=&h2C // picture block b.Picture=p dim c as new GifScreenMBS c.Height = pic.Height c.Width = pic.Width c.Palette=pal c.PaletteDepth=8 c.HasPalette = true c.ColorResolution = 8 c.BackgroundColor = 0 dim g as new GIFMBS g.Add b g.Screen=c dim f as FolderItem = SpecialFolder.Desktop.Child("Gif Write Test.gif") if f.SaveAsGIFMBS(g) then MsgBox "ok" f.Launch else MsgBox "fail" end if Quit End EventHandler
End Class
End Project

See also:

Feedback, Comments & Corrections

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

MBS Xojo Plugins