Example: /Images/PNG/Write Gray image

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/PNG/Write Gray image


Required plugins for this example: MBS Main Plugin, MBS Images Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Images/PNG/Write Gray image

This example is the version from Sun, 5th May 2018.

Project "Write Gray image.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
EventHandler Sub Open() // Write a RGBA PNG file dim current as Picture = LogoMBS(500) // needs Main Plugin // create a mask dim g as Graphics = current.Mask.Graphics g.ForeColor = &cFFFFFF g.FillRect 0,0,500,500 g.ForeColor = &c000000 g.FillOval 0,0,500,500 // show in window window1.Backdrop = current // and write to file dim f as FolderItem = SpecialFolder.Desktop.Child("test with alpha.png") dim p as new PNGWriterMBS if p.OpenWriteDestination(f) then // open file if p.SetGrayPicture(current, current.mask) then // set picture to write if p.SetHeader(false, -1) then // setup file header if p.SetGamma(0) then // and default gamma if p.WriteInfo then // write file header if p.WriteRows then // write pixels if p.WriteEnd then // and write file end p = nil // cleanup f.Launch end if end if end if end if end if end if end if f = SpecialFolder.Desktop.Child("test without alpha.png") p = new PNGWriterMBS if p.OpenWriteDestination(f) then // open file if p.SetGrayPicture(current) then // set picture to write if p.SetHeader(false, -1) then // setup file header if p.SetGamma(0) then // and default gamma if p.WriteInfo then // write file header if p.WriteRows then // write pixels if p.WriteEnd then // and write file end p = nil // cleanup f.Launch end if end if end if end if end if end if end if End EventHandler
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
Class Window1 Inherits Window
End Class
End Project

See also:

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


💬 Ask a question or report a problem