MBS Plugin Documentation

Search:

Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchie

New in Version 7.0 7.1 7.2 7.3 7.4 7.5 7.6 7.7 7.8 8.0 8.1 8.2 8.3 8.4 8.5 8.6 8.7 9.0

The list of the   themes,   classes,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

Previous items

Picture.ScaleMBS(width as integer, height as integer, AntiAlias as boolean=false, YieldTicks as integer=0) as picture
method, Graphics & Pictures, MBS Picture Plugin (PictureScale), class Picture, Plugin version: 5.1, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Scales the picture to the new size.
Notes:
This is a self made algorithm which produces nice pictures on all platforms.
It is slower than QuickDraw on Mac OS, but nicer than drawpicture on Windows.
Returns nil on low memory or invalid width and height values.

AntiAlias is set to false if width<=self.width or height<=self.height.

If YieldTicks is 0, no time is given to other threads in your application. If it is a value > 0, this time is waited before a thread switch is done. Setting it to 1 will give away control to another thread after 1/60th of a second. We recommend a value of 3 to 5 for a good reponsibility of your application.

Some examples which use this method:

Picture.ScalingMBS(mode as integer, width as integer, height as integer) as picture
method, Graphics & Pictures, MBS Picture Plugin (PictureScaling), class Picture, Plugin version: 8.0, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Scales the picture to the given size.
Notes:
On low memory this function can return nil or the image may look bad. (e.g. all black)

The memory used for the temporary storage is original height * new width * 12 bytes plus some extra.

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

Returns nil ony error. (e.g. destwidth=0)

Modes:
1triangle
2box, nereast neighbor
3lanczos 3
4lanczos 8
5mitchell
6poly 3
7cubic
Picture.ScrollHorizontalMBS(delta as integer, wrap as boolean, scrollmask as boolean) as boolean
method, Graphics & Pictures, MBS Picture Plugin (Picture), class Picture, Plugin version: 6.5, Mac OS X: Works, Windows: Works, Linux x86: Does nothing, Feedback.

Function: Scrolls the image data horizontally.
Example:
dim p as Picture

p=bild2.BitmapMBS // any bitmap image

if p.ScrollHorizontalMBS(100,true,false) then
Title="ok"
end if

Backdrop=p


Notes:
Returns true on success and false on failure.
Works only on Mac OS and Windows with 32bit bitmap images.
scrollmask defines whether a mask (if one exists) is also scrolled.
Wrap will define whether the image will wrap on the edges. If wrap is enabled on Mac, the whole thing speeds up.
Picture.ScrollMBS(deltaX as integer, deltaY as integer, wrap as boolean, scrollmask as boolean) as boolean
method, Graphics & Pictures, MBS Picture Plugin (Picture), class Picture, Plugin version: 6.5, Mac OS X: Works, Windows: Works, Linux x86: Does nothing, Feedback.

Function: Combines calls to ScrollHorizontalMBS and ScrollVerticalMBS.
Notes:
Returns true on success and false on failure.
Works only on Mac OS and Windows with 32bit bitmap images.
scrollmask defines whether a mask (if one exists) is also scrolled.
Wrap will define whether the image will wrap on the edges. If wrap is enabled on Mac, the whole thing speeds up.

Some examples which use this method:

Picture.ScrollVerticalMBS(delta as integer, wrap as boolean, scrollmask as boolean) as boolean
method, Graphics & Pictures, MBS Picture Plugin (Picture), class Picture, Plugin version: 6.5, Mac OS X: Works, Windows: Works, Linux x86: Does nothing, Feedback.

Function: Scrolls the image data vertically.
Example:
dim p as Picture

p=bild2.BitmapMBS // any bitmap image

if p.ScrollVerticalMBS(100,true,false) then
Title="ok"
end if

Backdrop=p



Notes:
Returns true on success and false on failure.
Works only on Mac OS and Windows with 32bit bitmap images.
scrollmask defines whether a mask (if one exists) is also scrolled.
Wrap will define whether the image will wrap on the edges. If wrap is enabled on Mac, the whole thing speeds up.
TintPictureMBS(source as picture, GreyBase as color, SepiaBase as color) as picture
global method, Graphics & Pictures, MBS Picture Plugin (Picture), Plugin version: 4.3, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Tints the image.
Example:
// The code does the same thing as this Realbasic code:

Sub TintPicture(theImg as Picture, pGreyBase as Color, pSepiaBase as Color)
Dim theRGBSurface as RGBSurface
Dim theWidth, theHeight as Integer
Dim pColor as Color
Dim x, y as Integer
Dim theGrey as Integer

dim SepiaBaseR as Double
dim SepiaBaseG as Double
dim SepiaBaseB as Double

dim GreyBaseR as Double
dim GreyBaseG as Double
dim GreyBaseB as Double

SepiaBaseR=pSepiaBase.Red / 255.0
SepiaBaseG=pSepiaBase.Green / 255.0
SepiaBaseB=pSepiaBase.Blue / 255.0

GreyBaseR=pGreyBase.Red / 255.0
GreyBaseG=pGreyBase.Green / 255.0
GreyBaseB=pGreyBase.Blue / 255.0

theRGBSurface = theImg.RGBSurface

theWidth = theImg.Width-1
theHeight = theImg.Height-1

For x = 0 to theWidth
For y = 0 to theHeight
pColor = theImg.RGBSurface.Pixel( x, y )

theGrey = ( GreyBaseR * pColor.Red ) + ( GreyBaseG * pColor.Green ) + ( GreyBaseB * pColor.Blue )
theImg.RGBSurface.Pixel( x, y ) = RGB( theGrey * SepiaBaseR, theGrey * SepiaBaseG, theGrey * SepiaBaseB )

Next
Next
End Sub

Notes:
You can use the code to do something like a Sepia effect.
Returns a new picture on success.

Some examples using this method:

Picture.TransformColorsMBS(red as memoryblock, blue as memoryblock, green as memoryblock) as picture
method, Graphics & Pictures, MBS Picture Plugin (Picture), class Picture, Plugin version: 4.3, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Applies a transform table to the pixels.
Notes:
Red, blue and green are 256 byte big memoryblocks with one byte for each value.

In RB the function does this:
color=rgb(red.byte[color.red], green.byte[color.green], blue.byte[color.blue])
Picture.TrimMBS(left as integer, top as integer, width as integer, height as integer) as picture
method, Graphics & Pictures, MBS Picture Plugin (PictureTrim), class Picture, Plugin version: 8.0, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Trims the picture to the given rectangle.
Example:
dim p as picture

p=someimage.TrimMBS(100,200,300,400)

Notes:
This method does not handle the mask.
So p.Trim(0,0,p.width,p.height) will give you a copy of the image pixels without mask.
left and top are zero based.

Use TrimWithMaskMBS if you need the mask to be trimmed.
Returns nil on low memory or bad parameters.

Some examples which use this method:

Picture.TrimWithMaskMBS(left as integer, top as integer, width as integer, height as integer) as picture
method, Graphics & Pictures, MBS Picture Plugin (PictureTrim), class Picture, Plugin version: 8.0, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Trims the picture to the given rectangle.
Example:
dim p as picture

p=someimage.TrimWithMaskMBS(100,200,300,400)

Notes:
left and top are zero based.
Returns nil on low memory or bad parameters.
Picture.VMirrorMBS as picture
method, Graphics & Pictures, MBS Picture Plugin (PictureRotate), class Picture, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Mirrors the picture vertically.
Example:
canvas1.backdrop=pic.VMirrorMBS

Notes:
This method returns a copy of the picture mirrored.
Returns nil on low memory.

Some examples which use this method:

Picture.VMirrorPictureMBS as boolean
method, Graphics & Pictures, MBS Picture Plugin (PictureRotate), class Picture, Plugin version: 7.8, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Mirrors the picture vertically.
Example:
if pic.VMirrorPictureMBS then // mirror picture
canvas1.backdrop=pic
else
canvas1.backdrop=pic.VMirrorMBS // mirror a copy
end if

Notes: This methods mirrors the picture data itself. Returns true on success and false on failure. Only bitmap pictures can be mirrored this way.

Some examples which use this method:

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