Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

PNGWriterMBS class

Type Topic Plugin Version macOS Windows Linux Console & Web iOS
class PNG MBS Images Plugin 9.0 Yes Yes Yes Yes No
Function: 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
Notes:
You can use this class to write PNG files by row.

Based on LibPNG.

Feedback, Comments & Corrections

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 which use this class:


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


PNGReaderMBS   -   Popupmenu




Links
MBS FileMaker Plugins