MBS Plugin Documentation
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
method, Graphics & Pictures, MBS Picture Plugin (PictureMemory), class Picture, Plugin version: 8.5, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Copies raw image data into a memoryblock.
Notes:
Returns true on success.
destination should not be nil.
offset should be 0 or bigger and is the start position in the memoryblock.
The function will crash if the memoryblock is too small. Needs picture.width*picture.height*4 bytes in the memoryblock.
Does not access the mask inside the image!
This method was written for speed, so the creation of the memoryblock is your part. You can of course reuse memoryblocks for batch processing images as long as the memoryblock is big enough.
The X variant of this method does not touch the alpha channel in the memoryblock and the A variant changes the alpha value to the given value.
method, Graphics & Pictures, MBS Picture Plugin (PictureMemory), class Picture, Plugin version: 5.3, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Copies raw image data into a memoryblock.
Example:
dim m as MemoryBlock
dim p as Picture
p=NewPicture(100,100,32)
p.Graphics.ForeColor=rgb(255,128,1)
p.Graphics.FillRect 0,0,100,100
// Make a new MemoryBlock
m=NewMemoryBlock(100*100*3) // 3 bytes per Pixel
// Copy RGB without alpha
if p.CopyRGBtoMemoryblockMBS(m,0) then
MsgBox EncodingToHexMBS(m.StringValue(0,99))
end if
Notes: Returns true on success.
destination should not be nil.
offset should be 0 or bigger and is the start position in the memoryblock.
The function will crash if the memoryblock is too small. Needs picture.width*picture.height*3 bytes in the memoryblock.
Does not access the mask inside the image!
This method was written for speed, so the creation of the memoryblock is your part. You can of course reuse memoryblocks for batch processing images as long as the memoryblock is big enough.
method, Graphics & Pictures, MBS Picture Plugin (PictureMemory), class Picture, Plugin version: 8.5, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Copies raw image data into a memoryblock.
Notes:
Returns true on success.
destination should not be nil.
offset should be 0 or bigger and is the start position in the memoryblock.
The function will crash if the memoryblock is too small. Needs picture.width*picture.height*4 bytes in the memoryblock.
Does not access the mask inside the image!
This method was written for speed, so the creation of the memoryblock is your part. You can of course reuse memoryblocks for batch processing images as long as the memoryblock is big enough.
The X variant of this method does not touch the alpha channel in the memoryblock and the A variant changes the alpha value to the given value.
method, Graphics & Pictures, MBS Picture Plugin (PictureMemory), class Picture, Plugin version: 5.3, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Copies raw image data into a memoryblock.
Example:
const kAlphaOffset=0 ' (BigEndian) and 3 (LittleEndian)
dim m as MemoryBlock
dim p as Picture
p=NewPicture(100,100,32)
p.Graphics.ForeColor=rgb(255,128,1)
p.Graphics.FillRect 0,0,100,100
p.mask.Graphics.ForeColor=rgb(127,127,127)
p.mask.Graphics.FillRect 0,0,100,100
// Make a new MemoryBlock
m=NewMemoryBlock(100*100*4) // 4 bytes per Pixel
// copy RGB and leave room for alpha
if p.CopyARGBtoMemoryblockMBS(m,0,false,-1) then
MsgBox EncodingToHexMBS(m.StringValue(0,99))
end if
// copy Red channel from mask image into Memoryblock
if p.mask.CopyRtoMemoryblockMBS(m,kAlphaOffset,4) then
MsgBox EncodingToHexMBS(m.StringValue(0,99))
end if
Notes: Returns true on success.
destination should not be nil.
offset should be 0 or bigger and is the start position in the memoryblock.
PixelByteSize is normally 4 for 32bit per Pixel.
By using a different offset you can have this function working correctly on non BigEndian platforms.
The function will crash if the memoryblock is too small. Needs picture.width*picture.height*PixelByteSize bytes in the memoryblock.
Mask images in RB are all gray so it does not matter which channel you copy to get the alpha channel. This function takes the red channel from the source image.
This method was written for speed, so the creation of the memoryblock is your part. You can of course reuse memoryblocks for batch processing images as long as the memoryblock is big enough.
method, Graphics & Pictures, MBS Picture Plugin (PictureMemory), class Picture, Plugin version: 8.5, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Copies raw image data into a memoryblock.
Notes:
Returns true on success.
destination should not be nil.
offset should be 0 or bigger and is the start position in the memoryblock.
The function will crash if the memoryblock is too small. Needs picture.width*picture.height*4 bytes in the memoryblock.
Does not access the mask inside the image!
This method was written for speed, so the creation of the memoryblock is your part. You can of course reuse memoryblocks for batch processing images as long as the memoryblock is big enough.
The X variant of this method does not touch the alpha channel in the memoryblock and the A variant changes the alpha value to the given value.
method, Graphics & Pictures, MBS Picture Plugin (PictureMemory), class Picture, Plugin version: 8.5, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Copies raw image data into a memoryblock.
Notes:
Returns true on success.
destination should not be nil.
offset should be 0 or bigger and is the start position in the memoryblock.
The function will crash if the memoryblock is too small. Needs picture.width*picture.height*4 bytes in the memoryblock.
Does not access the mask inside the image!
This method was written for speed, so the creation of the memoryblock is your part. You can of course reuse memoryblocks for batch processing images as long as the memoryblock is big enough.
The X variant of this method does not touch the alpha channel in the memoryblock and the A variant changes the alpha value to the given value.
method, Graphics & Pictures, MBS Picture Plugin (Picture), class Picture, Plugin version: 3.3, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Counts the pixels with the given colors.
Notes: Returns the number of pixels found.
method, Graphics & Pictures, MBS Picture Plugin (Picture), class Picture, Plugin version: 3.3, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Counts the color parts of each pixel.
Notes:
red, blue and green are filled with 1024 bytes big memoryblocks. One 4 byte integer for each color value possible.
Count is filled with the number of pixels processed.
method, Graphics & Pictures, MBS Mac Plugin (PictureMac), class Picture, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.
Function: Draws a picture into another picture and uses a mask.
Notes: Works only with BITMAP pictures.
method, Graphics & Pictures, MBS Mac Plugin (PictureMac), class Picture, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.
Function: Draws a picture into another picture.
Notes:
The constants for mode:
| srcCopy | 0 | If the source is black, apply the foreground color to the destination; if the source is white, apply the background color; otherwise apply weighted portions of the foreground and background colors. |
| srcOr | 1 | If the source is black, apply the foreground color to the destination; if the source is white, do nothing; otherwise apply weighted portions of the foreground color. |
| srcXor | 2 | If the source is black, invert the destination (this operation is undefined for a colored destination). Otherwise, do nothing. |
| srcBic | 3 | If the source is black, apply the background color to the destination. If the source is white, do nothing. Otherwise, apply weighted portions of the background color. |
| notSrcCopy | 4 | If the source is white, apply the foreground color to the destination; if the source is black, apply the background color; otherwise apply weighted portions of the foreground and background colors. |
| notSrcOr | 5 | If the source is white, apply the foreground color to the destination; if the source is black, do nothing; otherwise apply weighted portions of the foreground color. |
| notSrcXor | 6 | If the source is white, invert the destination (this operation is undefined for a colored destination pixel). Otherwise, do nothing. |
| notSrcBic | 7 | If the source is white, apply the background color to the destination. If the source is black, do nothing. Otherwise, apply weighted portions of the background color. |
| Text dimming: | ||
| grayishTextOr | 49 | Dim the destination. If in color, replace it with a blend of the foreground and background; if black-and-white, replace it with dithered black and white. This mode is used primarily for text. |
| Highlighting: | ||
| hilite | 50 | Replace the background color with the highlight color. |
| Arithmetic modes: | ||
| blend | 32 | Replace the destination with a blend of the source and destination colors. If the destination is a bitmap, this is the same as srcCopy. |
| addPin | 33 | Replace the destination with the sum of the source and destination, up to a maximum value. If the destination is a bitmap, this is the same as srcBic. |
| addOver | 34 | Replace the destination with the sum of the source and destination, but if the resulting red, green, or blue value exceeds 65536, then subtract 65536 from it. If the destination is a bitmap, this is the same as srcXor. |
| subPin | 35 | Replace the destination with the difference between the source and destination, but not less than a minimum value. If the destination is a bitmap, this is the same as srcOr. |
| addMax | 37 | Compare the source and destination, and replace the destination with the greater value of each of the red, green, and blue components. If the destination is a bitmap, this is the same as srcBic. |
| subOver | 38 | Replace the destination with the difference between the source and destination, but if the resulting red, green, or blue value is negative, then add 65536 to it. If the destination is a bitmap, this is the same as srcXor. |
| addMin | 39 | Compare the source and destination, and replace the destination with the lesser value of each of the red, green, and blue components. If the destination is a bitmap, this is the same as srcOr. |
| ditherCopy | 64 | Replace the destination with a dither mix of the source and destination. |
| Transparent mode: | ||
| transparent | 36 | Replace the destination with the source if the source is not equal to the background. |
Works only with BITMAP pictures.
Some examples which use this method:
method, Graphics & Pictures, MBS Picture Plugin (Picture), class Picture, Plugin version: 4.0, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Read or write a picture mask.
Example:
// Export a mask picture:
dim f as FolderItem
dim t as TiffPictureMBS
dim m,p as Picture
dim q as QTGraphicsExporterMBS
p=NewPicture(100,100,32)
p.Graphics.ForeColor=rgb(100,100,100)
p.Graphics.fillrect 0,0,100,100
p.Graphics.ForeColor=rgb(255,0,0)
p.Graphics.fillrect 20,20,80,30
m=NewPicture(100,100,32)
m.Graphics.ForeColor=rgb(255,255,255)
m.Graphics.FillRect 0,0,30,100
m.Graphics.ForeColor=rgb(200,200,200)
m.Graphics.FillRect 30,0,30,100
m.Graphics.ForeColor=rgb(100,100,100)
m.Graphics.FillRect 60,0,30,100
p.EmbeddedMaskMBS(true)=m
p.Mask.Graphics.DrawPicture m,0,0 // just for showing as a backdrop
q=new QTGraphicsExporterMBS
q.OpenExporter("TIFF")
q.Depth=32
q.InputPicture=p
q.CompressionQuality=1024
q.OutputFile=DesktopFolder.Child("Hello.tif")
title=str(q.Export)
Backdrop=p
Notes: Only useful on 32bit images.
Realbasic takes white for transparent, so you may need to swap this to black using the swap parameter.
(Read and Write runtime property)
Some examples which use this method:
method, Graphics & Pictures, MBS Picture Plugin (Picture), class Picture, Plugin version: 7.7, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Searches the first color and writes matching pixels with the secon color.
Example:
dim p as Picture
p=NewPicture(300,300,32)
p.Graphics.ForeColor=&cFF0000
p.Graphics.FillRect 000,100,100,100
p.Graphics.ForeColor=&c00FF00
p.Graphics.FillRect 100,100,100,100
p.Graphics.ForeColor=&c0000FF
p.Graphics.FillRect 200,100,100,100
p.Graphics.ForeColor=&c777700
p.Graphics.FillRect 100,200,100,100
// shows just a violet box on the left
backdrop=p.ExtractColorMBS(&cFF0000,&cFF00FF,&c000000)
Notes: All pixels which do not match the search color are written to the new picture using the given background color.
Returns nil on any error.
method, Graphics & Pictures, MBS Mac Plugin (PictureMac), class Picture, Plugin version: 8.7, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.
Function: Returns a memoryblock pointing to the pixels of a GWorld Picture.
Notes:
Returns nil on any error.
Works only with Pictures made using a Gworld, e.g. using NewPicture() on Mac OS.
(Read and Write runtime property)
method, Graphics & Pictures, MBS Mac Plugin (PictureMac), class Picture, Plugin version: 8.7, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.
Function: Returns a row byte size of a GWorld Picture.
Notes:
Returns zero on any error.
Works only with Pictures made using a Gworld, e.g. using NewPicture() on Mac OS.
method, Graphics & Pictures, MBS Picture Plugin (Picture), class Picture, Plugin version: 6.4, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Whether this picture has a mask or not.
Notes: Returns true if yes or false if not.
method, Graphics & Pictures, MBS Picture Plugin (PictureRotate), class Picture, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Mirrors the picture horizontally.
Example:
canvas1.backdrop=pic.HMirrorMBS
Notes: This method returns a copy of the picture mirrored.
Returns nil on low memory.
Some examples which use this method:
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 horizontally.
Example:
if pic.HMirrorPictureMBS then // mirror picture
canvas1.backdrop=pic
else
canvas1.backdrop=pic.HMirrorMBS // 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:
method, Graphics & Pictures, MBS Picture Plugin (Picture), class Picture, Plugin version: 7.5, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Inverts the whole picture.
Example:
dim invertedpic as picture
dim pic as picture
pic=newpicture(100,100,32) // will be white
invertedpic=pic.InvertMBS // will be black
Notes: Returns nil on any error.Some examples which use this method:
method, Graphics & Pictures, MBS Picture Plugin (Picture), class Picture, Plugin version: 4.3, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Inverts the picture.
Example:
dim invertedpic as picture
dim pic as picture
pic=newpicture(100,100,32) // will be white
invertedpic=pic.InvertMBS(0,0,100,100) // will be black
Notes: Returns nil on any error.Some examples which use this method:
method, Graphics & Pictures, MBS Picture Plugin (Picture), class Picture, Mac OS X: Does nothing, Windows: Works, Linux x86: Does nothing, Feedback.
Function: Returns a HBITMAP handle to the picture.
Notes:
The picture is cloned but both pictures may use the same binary data in background.
You will have to free this handle with DeleteObject:
Declare Function DeleteObject Lib "gdi32" (hObject As Integer) As Integer
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 and horizontally.
Example:
canvas1.backdrop=pic.MirrorMBS
Notes: Same as rotation by 180 degree.
This method returns a copy of the picture mirrored.
Returns nil on low memory.
Some examples which use this method:
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 and horizontally.
Example:
if pic.MirrorPictureMBS then // mirror picture
canvas1.backdrop=pic
else
canvas1.backdrop=pic.MirrorMBS // mirror a copy
end if
Notes: Same as rotation by 180 degree.
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:
method, Graphics & Pictures, MBS Picture Plugin (PicturePalette), class Picture, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.
Function: Set or get the PaletteMBS of this picture.
Notes:
On Windows, always nil.
May return nil if no PaletteMBS is used for that picture.
(Read and Write runtime property)
Some examples which use this method:
method, Graphics & Pictures, MBS Picture Plugin (Picture), class Picture, Plugin version: 4.1, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.
Function: Returns the picture data as PICT data.
Example:
dim p as Picture
dim s as string
p=app.ResourceFork.GetPicture(130)
Backdrop=p
s=p.PicHandleDataMBS
title= str(len(s))
EditField1.text=S
Notes: If the picture is not a PicHandle picture, it is first converted.
The resulting data may have a 512 byte header which must be removed if you want to put the data into the clipboard.
Returns "" on any error.
Some examples which use this method:
method, Graphics & Pictures, MBS Picture Plugin (Picture), class Picture, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.
Function: Clones the picture as a PicHandle picture.
Example:
dim p as picture
p=newpicture(100,100,32)
p.graphics.drawline 0,0,100,100
imageWell1.Image=p.picHandleMBS
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.
This function return the picture as a pichandle picture so you can use it for an imagewell control.
Not sure if masks or transparency will work.
Some examples which use this method:
method, Graphics & Pictures, MBS Picture Plugin (Picture), class Picture, Plugin version: 7.7, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Searches the given color and replaces it with the second color.
Example:
dim p as Picture
p=NewPicture(300,300,32)
p.Graphics.ForeColor=&cFF0000
p.Graphics.FillRect 000,100,100,100
p.Graphics.ForeColor=&c00FF00
p.Graphics.FillRect 100,100,100,100
p.Graphics.ForeColor=&c0000FF
p.Graphics.FillRect 200,100,100,100
p.Graphics.ForeColor=&c777700
p.Graphics.FillRect 100,200,100,100
// shows a violet box on the left. Other pixels unchanged
backdrop=p.ReplaceColorMBS(&cFF0000,&cFF00FF)
Notes: All other pixels are copied to the new picture.
Returns nil on any error.
method, Graphics & Pictures, MBS Picture Plugin (PictureRotate), class Picture, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Rotates the picture by 180° counter clockwise.
Example:
r=app.resourceFork.getpicture(148)
p=r.cloneMBS
canvas1.backdrop=p.Rotate180MBS
Notes: You may use the function picture.bitmap to make sure that the picture is a bitmap, because this function works only for bitmap pictures.
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.
Some examples which use this method:
method, Graphics & Pictures, MBS Picture Plugin (PictureRotate), class Picture, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Rotates the picture by 270° counter clockwise.
Example:
r=app.resourceFork.getpicture(148)
p=r.cloneMBS
canvas1.backdrop=p.Rotate270MBS
Notes: You may use the function picture.bitmap to make sure that the picture is a bitmap, because this function works only for bitmap pictures.
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.
Some examples which use this method:
method, Graphics & Pictures, MBS Picture Plugin (PictureRotate), class Picture, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Rotates the picture by 90° counter clockwise.
Example:
r=app.resourceFork.getpicture(148)
p=r.cloneMBS
canvas1.backdrop=p.Rotate90MBS
Notes: You may use the function picture.bitmap to make sure that the picture is a bitmap, because this function works only for bitmap pictures.
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.
Some examples which use this method:
method, Graphics & Pictures, MBS Picture Plugin (PictureRotate), class Picture, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Rotates the picture by angle° counter clockwise.
Example:
r=app.resourceFork.getpicture(148)
p=r.cloneMBS
canvas1.backdrop=p.RotateMBS(42.3,rgb(255,255,255))
Notes: The area around the picture is filled using the backcolor.
You may use the function picture.bitmap to make sure that the picture is a bitmap, because this function works only for bitmap pictures.
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.
Some examples which use this method:
method, Graphics & Pictures, MBS Picture Plugin (PictureScale), class Picture, Plugin version: 7.0, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Scales the picture to the new size including mask (in case one exists).
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.
The items on this page are in the following plugins: MBS Mac Plugin, MBS Picture Plugin.
Monkeybread Software Realbasic Plugins - Bilder aus Nickenich