PNGWriterMBS class

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

PNGWriterMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class PNG MBS Images Plugin 9.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The class to write a PNG file.
Example
dim Current as PictureMBS // your picture
dim f as FolderItem

f=GetsaveFolderItem(FileTypes.Png,"test.png")

if f<>Nil then
const PNG_COLOR_MASK_PALETTE = 1
const PNG_COLOR_MASK_COLOR = 2
const PNG_COLOR_MASK_ALPHA = 4

dim p as new PNGWriterMBS

p.Width=Current.Width
p.Height=Current.Height
p.Type=PNG_COLOR_MASK_COLOR
p.bpc=3
p.Rowbytes=p.Width*p.bpc

if p.OpenWriteDestination(f) then
if p.SetHeader(false, -1) then
if p.SetGamma(0) then
if p.WriteInfo then
dim i,c as Integer

c=p.Height-1
for i=0 to c
p.WriteRow current.RowInFormat(i, Current.ImageFormatRGB)
next

if p.WriteEnd then
MsgBox "OK"
end if
end if
end if
end if
end if
end if

You can use this class to write PNG files by row.

Based on LibPNG.

Constants

Constant Value Description
ResolutionDPI 2 One of the resolution unit type constants. The unit for points per inch.
ResolutionMeter 1 One of the resolution unit type constants. The unit for points per meter.
ResolutionUnknown 0 One of the resolution unit type constants.

Type Constants

Constant Value Description
TypeGray 0 Gray
TypeGrayA 4 Gray with Alpha
TypePalette 1 Palette
TypeRGB 2 RGB
TypeRGBA 6 RGB with Alpha.

This class has no sub classes.

Some examples using this class:

Blog Entries

Xojo Developer Magazine

Release notes


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


PNGReaderMBS   -   PopupMenu


💬 Ask a question or report a problem