Platforms to show: All Mac Windows Linux Cross-Platform

Back to PictureMBS class.

Previous items

PictureMBS.Rotate180(dest as PictureMBS=nil) as PictureMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Large Picture MBS Images Plugin 9.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Rotates the picture by 180 degree.
Example
dim l as Picture = LogoMBS(500)
dim p as new PictureMBS(l)
p = p.Rotate180
window1.Backdrop = p.CopyPicture

If dest is nil, the PictureFactoryMBS object (local on self or global) is used to create the new picture.

Same as HMirror and VMirror together.

There are two Rotate180 methods. One makes a copy and one not. This one does make a copy.

Works with Gray, RGB and CMYK pictures and supports alpha channel.

See also:

PictureMBS.Rotate270(dest as PictureMBS=nil) as PictureMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Large Picture MBS Images Plugin 9.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Rotates the picture by 270 degree.
Example
dim l as Picture = LogoMBS(500)
dim p as new PictureMBS(l)
p = p.Rotate270
window1.Backdrop = p.CopyPicture

If dest is nil, the PictureFactoryMBS object (local on self or global) is used to create the new picture.
Works with Gray, RGB and CMYK pictures and supports alpha channel.

PictureMBS.Rotate270slow(dest as PictureMBS=nil) as PictureMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Large Picture MBS Images Plugin 9.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Rotates the picture by 270 degree.
Example
dim l as Picture = LogoMBS(500)
dim p as new PictureMBS(l)
p = p.Rotate270slow
window1.Backdrop = p.CopyPicture

If dest is nil, the PictureFactoryMBS object (local on self or global) is used to create the new picture.
Works with Gray, RGB and CMYK pictures and supports alpha channel.

Some examples using this method:

PictureMBS.Rotate90(dest as PictureMBS=nil) as PictureMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Large Picture MBS Images Plugin 9.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Rotates the picture by 90 degree.
Example
dim l as Picture = LogoMBS(500)
dim p as new PictureMBS(l)
p = p.Rotate90
window1.Backdrop = p.CopyPicture

If dest is nil, the PictureFactoryMBS object (local on self or global) is used to create the new picture.
Works with Gray, RGB and CMYK pictures and supports alpha channel.

PictureMBS.Rotate90slow(dest as PictureMBS=nil) as PictureMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Large Picture MBS Images Plugin 9.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Rotates the picture by 90 degree.
Example
dim l as Picture = LogoMBS(500)
dim p as new PictureMBS(l)
p = p.Rotate90slow
window1.Backdrop = p.CopyPicture

If dest is nil, the PictureFactoryMBS object (local on self or global) is used to create the new picture.
Works with Gray, RGB and CMYK pictures and supports alpha channel.

The Rotate90slow function is the older implementation. Please use Rotate90 unless you need the old behavior.

Some examples using this method:

PictureMBS.Row(index as Integer) as memoryblock

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Large Picture MBS Images Plugin 9.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
A memoryblock with the data of this row.
Example
// create new image
dim p as new PictureMBS(100,100,PictureMBS.ImageFormatRGB)
// copy row
dim m as MemoryBlock = p.Row(10)
// modify
m.FillBytesMBS(10,100,200)
// copy back
p.row(10)=m
// show in window
window1.Backdrop = p.CopyPicture

You can get and set a row with this method in the native format.
If you set the row, use a memoryblock with at least RowSize bytes.
If you query the row, you will get a copy of the row bytes in a new memoryblock.
Returns "" on any error.
May raise OutOfBoundsException for invalid index.
(Read and Write computed property)

PictureMBS.RowInFormat(index as Integer, ImageFormat as Integer) as memoryblock

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Large Picture MBS Images Plugin 9.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
A memoryblock with the data of this row in the format you request.
Example
// create new image
dim p as new PictureMBS(100,100,PictureMBS.ImageFormatRGB)
// copy row
dim m as MemoryBlock = p.RowInFormat(10, p.ImageFormatRofRGB)
// modify
m.FillBytesMBS(10,80,200)
// copy back
p.RowInFormat(10, p.ImageFormatRofRGB)=m
// show in window
window1.Backdrop = p.CopyPicture

You can get and set a row with this method in the given format.
If you set the row, use a memoryblock with at least Width*PixelSize bytes. PixelSize is the format dependend size in bytes for one pixel.
If you query the row, you will get a copy of the row bytes in a new memoryblock.
Returns nil on any error.
May raise OutOfBoundsException for invalid index.
(Read and Write computed property)

See also:

Some examples using this property:

PictureMBS.RowInFormat(index as Integer, ImageFormat as Integer, InvertAlpha as boolean) as memoryblock

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Large Picture MBS Images Plugin 9.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
A memoryblock with the data of this row in the format you request.
Example
// create new image
dim p as new PictureMBS(100,100,PictureMBS.ImageFormatRGB)
// copy row
dim m as MemoryBlock = p.RowInFormat(10, p.ImageFormatRGB, true)
// modify
m.FillBytesMBS(10,80,200)
// copy back
p.RowInFormat(10, p.ImageFormatRGB, true)=m
// show in window
window1.Backdrop = p.CopyPicture

You can get and set a row with this method in the given format.
If you set the row, use a memoryblock with at least Width*PixelSize bytes. PixelSize is the format dependend size in bytes for one pixel.
If you query the row, you will get a copy of the row bytes in a new memoryblock.
Returns nil on any error.
May raise OutOfBoundsException for invalid index.
If InvertAlpha is true, the alpha values are inverted by using A=255-A.
(Read and Write computed property)

See also:

PictureMBS.RowStringInFormat(index as Integer, ImageFormat as Integer) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Large Picture MBS Images Plugin 9.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The row as a string.

You can get and set a row with this method in the native format.
If you set the row, use a memoryblock with at least RowSize bytes.
If you query the row, you will get a copy of the row bytes in a string.
Returns nil on any error.
May raise OutOfBoundsException for invalid index.
(Read and Write computed property)

Some examples using this property:

PictureMBS.Scale(source as PictureMBS, temp as PictureMBS, mode as Integer, width as Integer, height as Integer) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Large Picture MBS Images Plugin 8.7 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Scales the picture to the given size.

The final image is stored in the PictureMBS object you call this method on.
On low memory this function can fail or the image may look bad. (e.g. all black)

The size of the temporary picture must have the size of the destination width and the source height. Use ImageFormatScaling when you create the temp image to give it the correct size. Temp picture may not be mapped.

For scaling with the same size as the picture already has, the scaling is still performed.

Returns true on success and false on any error. (e.g. width=0)

Use the constants for the mod:
ScaleTriangletriangle
ScaleBoxbox, nereast neighbor
ScaleLanczos3lanczos 3
ScaleLanczos8lanczos 8
ScaleMitchellmitchell
ScalePoly3poly 3
ScaleCubiccubic

This function is optimized for several image formats:
- Gray to Gray.
- RGB to Gray uses R*0.3+G*0.59+B*0.11.
- RGB to RGB.
- Gray to RGB fill red, green and blue with the same gray value.
If an alpha channel exists in both images, it is copied.

PictureMBS.ScaleFast(source as PictureMBS, width as Integer, height as Integer) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Large Picture MBS Images Plugin 8.7 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Scales the picture to the new size fast.

The final image is stored in the PictureMBS object you call this method on.
Returns true on success and false on failure.

This is a low quality alorithm, but it is fast.

This function is optimized for several image formats:
- Gray to Gray.
- RGB to Gray uses R*0.3+G*0.59+B*0.11.
- RGB to RGB.
- Gray to RGB fill red, green and blue with the same gray value.
If an alpha channel exists in both images, it is copied.

Some examples using this method:

PictureMBS.ScaleMT(threads as Integer, source as PictureMBS, temp as PictureMBS, mode as Integer, width as Integer, height as Integer) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Large Picture MBS Images Plugin 11.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The multithreaded variant of Scale function.

Same as Scale, but with additional multithreading.

Threads parameter specifies how many threads you want to use:
A negative value disables threading, zero will use one thread for each CPU core and a positive number specifies the thread count.

If one of the pictures used has IsMapping = true, the plugin calls Scale() function.

The work is performed on a preemptive thread, so this function does not block the application and can yield time to other Xojo threads. Must be called in a Xojo thread to enjoy benefits. If called in main thread will block, but keep other background threads running.
If you run several threads calling MT methods, you can get all CPU cores busy while main thread shows GUI with progress window.

Some examples using this method:

PictureMBS.SolarizeFilter(dest as PictureMBS) as PictureMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Large Picture MBS Images Plugin 9.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Applies the solarize filter to the picture.
Example
// get some picture
dim l as Picture = LogoMBS(500)
// create new image
dim p as new PictureMBS(l)
// add filter
p = p.SolarizeFilter(nil)
// show in window
window1.Backdrop = p.CopyPicture

if dest is nil, the picture factory is used to create a new picture.
On success dest or the new picture is returned.
If dest is not nil, it must match the size of the original picture.

Returns nil on any error.
Works with Gray, RGB and CMYK pictures and supports alpha channel.

Some examples using this method:

PictureMBS.StampFilter(dest as PictureMBS, radius as Double, threshold as Double, softness as Double, Black as Color, White as Color) as PictureMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Large Picture MBS Images Plugin 9.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Applies the stamp filter to the picture.

if dest is nil, the picture factory is used to create a new picture.
On success dest or the new picture is returned.
If dest is not nil, it must match the size of the original picture.

Returns nil on any error.
Works with Gray and RGB pictures and supports alpha channel.

Some examples using this method:

PictureMBS.TransferFilter(dest as PictureMBS, gray() as Integer) as PictureMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Large Picture MBS Images Plugin 9.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Transfers a picture to another picture by looking up each pixel value in the given array.
Example
dim l as Picture = LogoMBS(500)
dim p as new PictureMBS(l)

dim gray(256) as Integer

for i as Integer = 0 to 255
gray(i)=255-i // invert
next

// inverts the picture
dim d as PictureMBS = p.TransferFilter(nil,gray)

Backdrop = d.CopyPicture

if dest is nil, the picture factory is used to create a new picture.
On success dest or the new picture is returned.
If dest is not nil, it must match the size of the original picture.

The array for gray must have 256 entries starting with index 0.
For RGB pictures the gray array is used for all three channels.

Returns nil on any error.

See also:

Some examples using this method:

PictureMBS.TransferFilter(dest as PictureMBS, gray() as Integer, alpha() as Integer) as PictureMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Large Picture MBS Images Plugin 9.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Transfers a picture to another picture by looking up each pixel value in the given arrays.

if dest is nil, the picture factory is used to create a new picture.
On success dest or the new picture is returned.
If dest is not nil, it must match the size of the original picture.

The arrays for gray and alpha must have 256 entries starting with index 0.
For RGB pictures the gray array is used for all three channels.
If the picture has no alpha channel, the alpha parameter is ignored.

Returns nil on any error.

See also:

PictureMBS.TransferFilter(dest as PictureMBS, red() as Integer, green() as Integer, blue() as Integer) as PictureMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Large Picture MBS Images Plugin 9.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Transfers a picture to another picture by looking up each pixel value in the given arrays.
Example
dim l as Picture = LogoMBS(500)
dim p as new PictureMBS(l)

dim red(256) as Integer
dim green(256) as Integer
dim blue(256) as Integer

for i as Integer = 0 to 255
red(i)=i
green(i)=i
blue(i)=255-i // invert blue
next

dim d as PictureMBS = p.TransferFilter(nil,red,green,blue)

Backdrop = d.CopyPicture

if dest is nil, the picture factory is used to create a new picture.
On success dest or the new picture is returned.
If dest is not nil, it must match the size of the original picture.

The arrays for red, green and blue must have 256 entries starting with index 0.
For grayscale pictures the green array is used for the gray channel.

Returns nil on any error.

See also:

PictureMBS.TransferFilter(dest as PictureMBS, red() as Integer, green() as Integer, blue() as Integer, alpha() as Integer) as PictureMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Large Picture MBS Images Plugin 9.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Transfers a picture to another picture by looking up each pixel value in the given arrays.

if dest is nil, the picture factory is used to create a new picture.
On success dest or the new picture is returned.
If dest is not nil, it must match the size of the original picture.

The arrays for red, green, blue and alpha must have 256 entries starting with index 0.
For grayscale pictures the green array is used for the gray channel.
If the picture has no alpha channel, the alpha parameter is ignored.

Returns nil on any error.

See also:

PictureMBS.Unmultiply

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Large Picture MBS Images Plugin 18.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Un-multiplies alpha channel for whole picture.

Pictures with alpha channel must be multiplied, while pictures with mask have the alpha unmultiplied and inverse in the mask.

See also:

Some examples using this method:

PictureMBS.Unmultiply(x as integer, y as integer, width as integer, height as integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Large Picture MBS Images Plugin 18.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Un-multiplies alpha channel for given rectangle in picture.

Pictures with alpha channel must be multiplied, while pictures with mask have the alpha unmultiplied and inverse in the mask.

See also:

PictureMBS.UnsharpFilter(origpixels as PictureMBS, Amount as Double, Threshold as Integer) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Large Picture MBS Images Plugin 9.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Runs the unsharp filter.

You may want to run the BoxBlur filter first before using the unsharp filter.

if dest is nil, the picture factory is used to create a new picture.
On success dest or the new picture is returned.
If dest is not nil, it must match the size of the original picture.

Returns nil on any error.

Works with Gray, RGB and CMYK pictures and supports alpha channel.

PictureMBS.VMirror

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Large Picture MBS Images Plugin 8.7 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Mirrors the image content vertically.
Example
// get some picture
dim l as Picture = LogoMBS(500)
// create new image
dim p as new PictureMBS(l)
// mirror
p.VMirror
// show in window
window1.Backdrop = p.CopyPicture

Works with Gray, RGB and CMYK pictures and supports alpha channel.

Some examples using this method:

PictureMBS.YellowChannel as PictureMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Large Picture MBS Images Plugin 11.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The yellow channel of a CMYK picture as a new PictureMBS object.

Returns nil if this channel does not exist.
No copy is made of the actual pixel data. Modifying the channel picture will modify the original picture.
Use this function to access the pixels of the channel directly.
The resulting PictureMBS object is a grayscale picture.

Previous items

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


The biggest plugin in space...