Platforms to show: All Mac Windows Linux Cross-Platform

Next items

Picture.AutoLevelCopyMBS as picture
method, Graphics & Pictures, MBS REALbasic Picture Plugin (PictureAutoLevel), class Picture, Plugin version: 9.2, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Applies auto levels on the picture.
Notes:
The histogram is built, white and back points are searched and all pixels adjusted.
Returns nil on any error.
Thanks to Jeff Thoman for his code.

This version of the method makes a copy of the picture so it works on any kind of picture.

Renamed in version 9.2 from AutoLevelMBS to AutoLevelCopyMBS.
Picture.AutoLevelMBS as boolean
method, Graphics & Pictures, MBS REALbasic Picture Plugin (PictureAutoLevel), class Picture, Plugin version: 9.1, Mac OS X: Works, Windows: Works, Linux x86: Does nothing, Feedback.

Function: Applies auto levels on the picture.
Notes:
The histogram is built, white and back points are searched and all pixels adjusted.
Returns true on success and false on any error.
Thanks to Jeff Thoman for his code.

This version of the method modifies the pixels on the picture. Works on 32bit and 24bit pictures.

If you get a type mismatch error on using this function, you may want to use AutoLevelCopyMBS which is the old behavior.
Picture.BitmapMBS as picture
method, Graphics & Pictures, MBS REALbasic Picture Plugin (PictureRotate), class Picture, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Returns the picture as a bitmap picture.
Example:
dim p,r as picture
r=LogoMBS(500)
p=r.BitmapMBS
canvas1.backdrop=p

Notes:
A Realbasic picture object may contain an icon, a bitmap, a picture handle or something else what Realbasic will support as a picture in the future.
The picture editing functions of this plugin can only work with bitmap pictures and this clone function creates such pictures for you.
This function takes a look on the picture and returns it unchanged if it is allready a bitmap, but if not, the picture is Cloned as a bitmap. If you prefer to get a copy of the picture as a bitmap picture, use clone instead.

app.resourceFork.getpicture(148) is the about picture of REALbasic in the 4.5 release. This may change in future releases, so you will get nil. But using this picture will make the plugin download smaller.

The Cloned picture does not have a mask.

Some examples which use this method:

BlendPicturesMBS(source as picture, sourcepercent as double, dest as picture, destpercent as double) as picture
global method, Graphics & Pictures, MBS REALbasic Picture Plugin (PictureBlend), Plugin version: 4.3, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Blends two pictures.
Example:
dim a,b,c as picture

a=newpicture(100,100,32)
b=newpicture(100,100,32)
' ... draw something in a and b
c=newpicture(100,100,32)
c=BlendPicturesMBS(a,0.5,b,0.5)

Notes:
Percent is in range from 0 to 1. Values out of this range may work, but you get strange results.

Reason for returning nil:
- One of the two pictures used is nil.
- One of the pictures is not a 32bit bitmap picture.
- The two parameter pictures have not the same size as the others.

Some examples using this method:

BlendPicturesWithMaskMBS(source as picture, dest as picture, mask as picture) as picture
global method, Graphics & Pictures, MBS REALbasic Picture Plugin (PictureBlend), Plugin version: 4.3, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Blends two pictures.
Example:
dim a,b,c,m as picture

a=newpicture(100,100,32)
b=newpicture(100,100,32)
m=newpicture(100,100,32)
' ... draw something in a and b
c=BlendPicturesWithMaskMBS(a,b,m)

Notes:
The mask defines how much from one picture is used.

Reason for returning false:
- One of the three pictures used is nil.
- One of the pictures is not a 32bit bitmap picture.
- The three parameter pictures have not the same size as the others.

Some examples using this method:

BuildPictureWithGWorldHandleMBS(handle as integer, ByPassOwernerShip as boolean) as picture
global method, Graphics & Pictures, MBS REALbasic Picture Plugin (Picture), Plugin version: 3.3, Mac OS X: Works, Windows: Works, Linux x86: Does nothing, Feedback.

Function: Creates a new Realbasic picture using a GWorld Handle.
Notes:
If ByPassOwernerShip is true, RB will destroy the GWorld Handle later if the picture is destroyed. If ByPassOwernerShip is false, the Picture will become unuseable (maybe crashes when used) as soon as the given handle is destroyed.

Returns nil on any error.
Requires QuickTime on Windows.
BuildPictureWithPicHandleDataMBS(data as string) as picture
global method, Graphics & Pictures, MBS REALbasic Picture Plugin (Picture), Plugin version: 3.3, Mac OS X: Works, Windows: Works, Linux x86: Does nothing, Feedback.

Function: Creates a Realbasic picture from data from a PicHandle.
Example:
// Use an AppleScript to get a picture, decode the picture, and make a RB picture

dim s as String
dim a as AppleScriptMBS
dim i as integer

s="set p to the clipboard as ""PICT"""+chr(13)
s=s+"return p"

a=new AppleScriptMBS
a.Compile s

a.Execute

S=A.Result

i=instr(s,"PICT")
s=mid(s,i+4)

s=DecodingFromHexMBS(s)

Backdrop=BuildPictureWithPicHandleDataMBS(s)

Notes:
Returns nil on any error.
Requires QuickTime on Windows.
The data is copied into the new picture object.
Picture.ChangeBrightnessAbsoluteMBS(r as double, g as double, b as double) as picture
method, Graphics & Pictures, MBS REALbasic Picture Plugin (Picture), class Picture, Plugin version: 4.3, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Changes the bightness of an image.
Notes:
To every pixel component the value is added.
Returns nil if the picture is no bitmap picture.

PS: This function may be optimized, if someone needs it to be faster.

Basicly Picture.ChangeBrightnessAbsoluteMBS does this:

for each pixel in picture
pixel.red = pixel.red + r
pixel.green = pixel.green + g
pixel.blue = pixel.blue + b
next

and it limits the pixel values to the range 0 to 255.

See also:

Some examples which use this method:

Picture.ChangeBrightnessAbsoluteMBS(x as double) as picture
method, Graphics & Pictures, MBS REALbasic Picture Plugin (Picture), class Picture, Plugin version: 4.3, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Changes the bightness of an image.
Notes:
To every pixel component the value is added.
Returns nil if the picture is no bitmap picture.

PS: This function may be optimized, if someone needs it to be faster.

See also:

Some examples which use this method:

Picture.ChangeBrightnessLinearMBS(r as double, g as double, b as double) as picture
method, Graphics & Pictures, MBS REALbasic Picture Plugin (Picture), class Picture, Plugin version: 4.3, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Changes the bightness of an image linear.
Notes:
Returns nil if the picture is no bitmap picture.
PS: This function may be optimized, if someone needs it to be faster (e.g. using Altivec).

See also:

Some examples which use this method:

Picture.ChangeBrightnessLinearMBS(x as double) as picture
method, Graphics & Pictures, MBS REALbasic Picture Plugin (Picture), class Picture, Plugin version: 4.3, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Changes the bightness of an image linear.
Notes:
Returns nil if the picture is no bitmap picture.
PS: This function may be optimized, if someone needs it to be faster (e.g. using Altivec).

See also:

Some examples which use this method:

Picture.ChangeContrastMBS(x as double) as picture
method, Graphics & Pictures, MBS REALbasic Picture Plugin (Picture), class Picture, Plugin version: 4.3, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Changes the contrast of the picture.
Notes:
All three color channels are handled with the same contrast change.
Returns a picture on success or nil on any error.
Parameters can have any value.
(values >=0.0 will add contrast, values below 0.0 will reduce contrast till gray picture at -1.0, values below -1.0 will add contrast again and also invert the picture)

See also:

Some examples which use this method:

Picture.ChangeContrastMBS(xr as double, xg as double, xb as double) as picture
method, Graphics & Pictures, MBS REALbasic Picture Plugin (Picture), class Picture, Plugin version: 4.3, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Changes the contrast of the picture.
Notes:
Three different values, one for each channel.
Returns a picture on success or nil on any error.
(values >=0.0 will add contrast, values below 0.0 will reduce contrast till gray picture at -1.0, values below -1.0 will add contrast again and also invert the picture)

See also:

Some examples which use this method:

Picture.ChangeCustomMBS(a as double, b as double) as picture
method, Graphics & Pictures, MBS REALbasic Picture Plugin (Picture), class Picture, Plugin version: 4.3, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Changes the picture with custom values.
Notes:
Uses this formular:
NewPixelComponent=OldPixelComponent*a+b

Some examples which use this method:

Picture.ChangeSaturationMBS(Amount as integer) as picture
method, Graphics & Pictures, MBS REALbasic Picture Plugin (Picture), class Picture, Plugin version: 9.4, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Returns a copy of the picture with a changed saturation.
Notes:
Range of amount is from -255 to 255.

Value 0 does nothing.
Value -255 returns a gray level picture.
class Picture
class, Graphics & Pictures, MBS REALbasic QuickTime Plugin (QuickTime), class Picture, Console safe, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Extends Realbasic's Picture Class.
Picture.cloneMBS as picture
method, Graphics & Pictures, MBS REALbasic Picture Plugin (PictureRotate), class Picture, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Clones the picture as a bitmap.
Example:
dim p,r as picture
r=LogoMBS(500)
p=r.clonembs
canvas1.backdrop=p

Notes:
A Realbasic picture object may contain an icon, a bitmap, a picture handle or something else what Realbasic will support as a picture in the future.
The picture editing functions of this plugin can only work with bitmap pictures and this clone function creates such pictures for you.
If a picture is a bitmap can be easily tested with the graphics property like this:

if p.graphics=nil then // if no bitmap
p=p.clonembs // make one
end if

app.resourceFork.getpicture(148) is the about picture of REALbasic in the 4.5 release. This may change in future releases, so you will get nil. But using this picture will make the plugin download smaller.

The Cloned picture does not have a mask.

See also:

Some examples which use this method:

Picture.CloneMBS(width as integer, height as integer) as picture
method, Graphics & Pictures, MBS REALbasic Picture Plugin (PictureRotate), class Picture, Plugin version: 7.0, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.

Function: Clones the picture as a bitmap with given size.
Example:
dim p,r as picture
r=LogoMBS(500)
p=r.clonembs(100,100)
canvas1.backdrop=p

Notes:
A Realbasic picture object may contain an icon, a bitmap, a picture handle or something else what Realbasic will support as a picture in the future.
The picture editing functions of this plugin can only work with bitmap pictures and this clone function creates such pictures for you.
If a picture is a bitmap can be easily tested with the graphics property like this:

if p.graphics=nil then // if no bitmap
p=p.clonembs // make one
end if

app.resourceFork.getpicture(148) is the about picture of REALbasic in the 4.5 release. This may change in future releases, so you will get nil. But using this picture will make the plugin download smaller.

The Cloned picture does not have a mask.

See also:

Some examples which use this method:

Picture.CombineMBS(Image As Picture, Mask As Picture, DestX As Integer, DestY As Integer, SourceX As Integer, SourceY As Integer, Width As Integer, Height As Integer, UseColours As Boolean) as boolean
method, Graphics & Pictures, MBS REALbasic Picture Plugin (PictureCombine), class Picture, Plugin version: 8.7, Mac OS X: Works, Windows: Works, Linux x86: Does nothing, Feedback.

Function: Copies pixels from one picture into another picture with some options.
Notes:
Returns true on success and false on failure.

This function has 4 behaviors depending on the parameters:

1. If mask is nil and no ForeColour and MaskColour values are passed, the pixels a copied to the destination picture.

2. But if there is a mask, the pixels are copied with applying the mask.

3. If the mask color is not defined, the the pixels are filled with the fore color applying the mask.

4. As the last variation the pixels are copied and the forecolor, the mask color or black is used with the image as the mask. If UseColours parameter is false black is used for this.

Parameters:
Image: the source picture, must not be nil.
Mask: the mask picture, can be nil.
DestX: destination position
DestY: destination position
SourceX: source position
SourceY: source position
Width: width of the area to copy
Height: height of the area to copy
UseColours: whether to use the mask colour.
ForeColour: the fore colour, optional, can be integer or color
MaskColour: the mask color, optional, can be integer or color

This function is 5 times in the plugin defined to implement having the last two parameters optional and either integer or color. You can pass a negative number for MaskColour or ForeColour to disable this parameter.

The destination image (self) can be either 24 bit or 32 bit.

See also:

Some examples which use this method:

Picture.CombineMBS(Image As Picture, Mask As Picture, DestX As Integer, DestY As Integer, SourceX As Integer, SourceY As Integer, Width As Integer, Height As Integer, UseColours As Boolean, ForeColour As color) as boolean
method, Graphics & Pictures, MBS REALbasic Picture Plugin (PictureCombine), class Picture, Plugin version: 8.7, Mac OS X: Works, Windows: Works, Linux x86: Does nothing, Feedback.

Function: Copies pixels from one picture into another picture with some options.
Example:
dim DestImage As Picture
dim Image As Picture
dim Mask As Picture
dim DestX As Integer=100
dim DestY As Integer=100
dim SourceX As Integer=0
dim SourceY As Integer=0
dim Width As Integer=500
dim Height As Integer=500

image=LogoMBS(500)
Mask=nil
DestImage=NewPicture(700,700,32)

if DestImage.CombineMBS(image,Mask,DestX,DestY,SourceX,SourceY,Width,Height,true,&c777777,&c777777) then
window1.Backdrop=DestImage
end if

Notes:
Returns true on success and false on failure.

This function has 4 behaviors depending on the parameters:

1. If mask is nil and no ForeColour and MaskColour values are passed, the pixels a copied to the destination picture.

2. But if there is a mask, the pixels are copied with applying the mask.

3. If the mask color is not defined, the the pixels are filled with the fore color applying the mask.

4. As the last variation the pixels are copied and the forecolor, the mask color or black is used with the image as the mask. If UseColours parameter is false black is used for this.

Parameters:
Image: the source picture, must not be nil.
Mask: the mask picture, can be nil.
DestX: destination position
DestY: destination position
SourceX: source position
SourceY: source position
Width: width of the area to copy
Height: height of the area to copy
UseColours: whether to use the mask colour.
ForeColour: the fore colour, optional, can be integer or color
MaskColour: the mask color, optional, can be integer or color

This function is 5 times in the plugin defined to implement having the last two parameters optional and either integer or color. You can pass a negative number for MaskColour or ForeColour to disable this parameter.

The destination image (self) can be either 24 bit or 32 bit.

See also:

Some examples which use this method:

Picture.CombineMBS(Image As Picture, Mask As Picture, DestX As Integer, DestY As Integer, SourceX As Integer, SourceY As Integer, Width As Integer, Height As Integer, UseColours As Boolean, ForeColour As color, MaskColour As color) as boolean
method, Graphics & Pictures, MBS REALbasic Picture Plugin (PictureCombine), class Picture, Plugin version: 8.7, Mac OS X: Works, Windows: Works, Linux x86: Does nothing, Feedback.

Function: Copies pixels from one picture into another picture with some options.
Notes:
Returns true on success and false on failure.

This function has 4 behaviors depending on the parameters:

1. If mask is nil and no ForeColour and MaskColour values are passed, the pixels a copied to the destination picture.

2. But if there is a mask, the pixels are copied with applying the mask.

3. If the mask color is not defined, the the pixels are filled with the fore color applying the mask.

4. As the last variation the pixels are copied and the forecolor, the mask color or black is used with the image as the mask. If UseColours parameter is false black is used for this.

Parameters:
Image: the source picture, must not be nil.
Mask: the mask picture, can be nil.
DestX: destination position
DestY: destination position
SourceX: source position
SourceY: source position
Width: width of the area to copy
Height: height of the area to copy
UseColours: whether to use the mask colour.
ForeColour: the fore colour, optional, can be integer or color
MaskColour: the mask color, optional, can be integer or color

This function is 5 times in the plugin defined to implement having the last two parameters optional and either integer or color. You can pass a negative number for MaskColour or ForeColour to disable this parameter.

The destination image (self) can be either 24 bit or 32 bit.

See also:

Some examples which use this method:

Picture.CombineMBS(Image As Picture, Mask As Picture, DestX As Integer, DestY As Integer, SourceX As Integer, SourceY As Integer, Width As Integer, Height As Integer, UseColours As Boolean, ForeColour As Integer) as boolean
method, Graphics & Pictures, MBS REALbasic Picture Plugin (PictureCombine), class Picture, Plugin version: 8.7, Mac OS X: Works, Windows: Works, Linux x86: Does nothing, Feedback.

Function: Copies pixels from one picture into another picture with some options.
Notes:
Returns true on success and false on failure.

This function has 4 behaviors depending on the parameters:

1. If mask is nil and no ForeColour and MaskColour values are passed, the pixels a copied to the destination picture.

2. But if there is a mask, the pixels are copied with applying the mask.

3. If the mask color is not defined, the the pixels are filled with the fore color applying the mask.

4. As the last variation the pixels are copied and the forecolor, the mask color or black is used with the image as the mask. If UseColours parameter is false black is used for this.

Parameters:
Image: the source picture, must not be nil.
Mask: the mask picture, can be nil.
DestX: destination position
DestY: destination position
SourceX: source position
SourceY: source position
Width: width of the area to copy
Height: height of the area to copy
UseColours: whether to use the mask colour.
ForeColour: the fore colour, optional, can be integer or color
MaskColour: the mask color, optional, can be integer or color

This function is 5 times in the plugin defined to implement having the last two parameters optional and either integer or color. You can pass a negative number for MaskColour or ForeColour to disable this parameter.

The destination image (self) can be either 24 bit or 32 bit.

See also:

Some examples which use this method:

Picture.CombineMBS(Image As Picture, Mask As Picture, DestX As Integer, DestY As Integer, SourceX As Integer, SourceY As Integer, Width As Integer, Height As Integer, UseColours As Boolean, ForeColour As Integer, MaskColour As Integer) as boolean
method, Graphics & Pictures, MBS REALbasic Picture Plugin (PictureCombine), class Picture, Plugin version: 8.7, Mac OS X: Works, Windows: Works, Linux x86: Does nothing, Feedback.

Function: Copies pixels from one picture into another picture with some options.
Example:
dim DestImage As Picture
dim Image As Picture
dim Mask As Picture
dim DestX As Integer=100
dim DestY As Integer=100
dim SourceX As Integer=0
dim SourceY As Integer=0
dim Width As Integer=500
dim Height As Integer=500

image=LogoMBS(500)
Mask=nil
DestImage=NewPicture(700,700,32)

if DestImage.CombineMBS(image,Mask,DestX,DestY,SourceX,SourceY,Width,Height,true,&h777777,&h777777) then
window1.Backdrop=DestImage
end if

Notes:
Returns true on success and false on failure.

This function has 4 behaviors depending on the parameters:

1. If mask is nil and no ForeColour and MaskColour values are passed, the pixels a copied to the destination picture.

2. But if there is a mask, the pixels are copied with applying the mask.

3. If the mask color is not defined, the the pixels are filled with the fore color applying the mask.

4. As the last variation the pixels are copied and the forecolor, the mask color or black is used with the image as the mask. If UseColours parameter is false black is used for this.

Parameters:
Image: the source picture, must not be nil.
Mask: the mask picture, can be nil.
DestX: destination position
DestY: destination position
SourceX: source position
SourceY: source position
Width: width of the area to copy
Height: height of the area to copy
UseColours: whether to use the mask colour.
ForeColour: the fore colour, optional, can be integer or color
MaskColour: the mask color, optional, can be integer or color

This function is 5 times in the plugin defined to implement having the last two parameters optional and either integer or color. You can pass a negative number for MaskColour or ForeColour to disable this parameter.

The destination image (self) can be either 24 bit or 32 bit.

See also:

Some examples which use this method:

Previous items Next items

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




Links
MBS Realbasic Plugins - Nachhilfe Nickenich