Platforms to show: All Mac Windows Linux Cross-Platform
/Images/LargePicture/JPEG Save
Required plugins for this example: MBS Images Plugin, MBS Main Plugin, MBS Util Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Images/LargePicture/JPEG Save
This example is the version from Sun, 17th Mar 2012.
Project "JPEG Save.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
EventHandler Sub Open()
dim logo as Picture = LogoMBS(500)
dim p as new PictureMBS(logo)
Backdrop=p.CopyPicture
dim j as new MyJPEGExporterMBS
j.p=p
j.huge=0
j.height=p.height
j.file=SpecialFolder.Desktop.Child("JPEGExporter test.jpg")
j.Quality=75
j.ExportRGBwithRowDataEvent(p.Width, p.Height, p.Width*3)
j.File.Launch
// now test a huge one:
// 625,000,000 pixels = 25000^2
// this image needs 1,7 GB uncompressed!
const huge=50
j=new MyJPEGExporterMBS
j.p=p
j.height=p.height
j.huge=huge
j.file=SpecialFolder.Desktop.Child("JPEGExporter test huge.jpg")
j.Quality=75
j.ExportRGBwithRowDataEvent(p.Width*huge, p.Height*huge, p.Width*3*huge)
j.File.Launch
End EventHandler
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
Class MyJPEGExporterMBS Inherits JPEGExporterMBS
EventHandler Sub Error(message as string, ErrorCode as integer)
MsgBox "Error: "+Message
End EventHandler
EventHandler Function GetRowData(index as integer) As memoryblock
if p=nil then
Return nil
else
if huge>0 then
dim m as MemoryBlock=p.RowInFormat(index mod height, PictureMBS.ImageFormatRGB)
dim size as integer = m.Size*huge
dim n as MemoryBlock=NewMemoryBlock(size)
dim o as integer
for i as integer=1 to huge
m.CopyBytesMBS(0,m.size, n, o)
o=o+m.size
next
Return n
else
dim m as MemoryBlock=p.RowInFormat(index, PictureMBS.ImageFormatRGB)
Return m
end if
end if
End EventHandler
Property height As Integer
Property huge As integer
Property p As PictureMBS
End Class
End Project
See also:
The items on this page are in the following plugins: MBS Images Plugin.