Platforms to show: All Mac Windows Linux Cross-Platform
method, Graphics & Pictures, MBS REALbasic 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 REALbasic 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
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 REALbasic 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
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 REALbasic 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 computed property)
Some examples which use this method:
method, Graphics & Pictures, MBS REALbasic 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=LogoMBS(500)
Backdrop=p
s=p.PicHandleDataMBS
title= str(len(s))
EditField1.text=S
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 REALbasic 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
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 REALbasic Picture Plugin (Picture), class Picture, Console safe in REAL Studio 2010r3 and newer, Plugin version: 9.4, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Returns a copy of the picture with the blue channel replaced with the blue channel of the given picture.
Notes: Returns nil on low memory.
method, Graphics & Pictures, MBS REALbasic 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)
All other pixels are copied to the new picture.
Returns nil on any error.
method, Graphics & Pictures, MBS REALbasic Picture Plugin (Picture), class Picture, Console safe in REAL Studio 2010r3 and newer, Plugin version: 9.4, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Returns a copy of the picture with the green channel replaced with the green channel of the given picture.
Notes: Returns nil on low memory.
method, Graphics & Pictures, MBS REALbasic Picture Plugin (Picture), class Picture, Console safe in REAL Studio 2010r3 and newer, Plugin version: 9.4, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Returns a copy of the picture with the red channel replaced with the red channel of the given picture.
Notes: Returns nil on low memory.
method, Graphics & Pictures, MBS REALbasic Picture Plugin (PictureRotate), class Picture, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Rotates the picture by 180° counter clockwise.
Example:
dim p,r as picture
r=LogoMBS(500)
p=r.cloneMBS
canvas1.backdrop=p.Rotate180MBS
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 REALbasic Picture Plugin (PictureRotate), class Picture, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Rotates the picture by 270° counter clockwise.
Example:
dim p,r as picture
r=LogoMBS(500)
p=r.cloneMBS
canvas1.backdrop=p.Rotate270MBS
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 REALbasic Picture Plugin (PictureRotate), class Picture, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Rotates the picture by 90° counter clockwise.
Example:
dim p,r as picture
r=LogoMBS(500)
p=r.cloneMBS
canvas1.backdrop=p.Rotate90MBS
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 REALbasic Picture Plugin (PictureRotate), class Picture, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Rotates the picture by angle° counter clockwise.
Example:
dim p,r as picture
r=LogoMBS(500)
p=r.cloneMBS
canvas1.backdrop=p.RotateMBS(42.3,rgb(255,255,255))
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 REALbasic Picture Plugin (PictureRotate), class Picture, Plugin version: 10.4, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Returns the memory needed to roatet the picture with the given angle.
Notes: RotateMBS needs temporary buffers and fails if somewhere between memory is low.
method, Graphics & Pictures, MBS REALbasic Picture Plugin (PictureScale), class Picture, Not console safe, 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.
method, Graphics & Pictures, MBS REALbasic Picture Plugin (PictureScale), class Picture, Not console safe, 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:
method, Graphics & Pictures, MBS REALbasic Picture Plugin (PictureScaling), class Picture, Not console safe, Plugin version: 8.0, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Scales the picture to the given size.
Example:
dim p as Picture
p=LogoMBS(1000)
p=p.ScalingMBS(2, 4000, 4000)
backdrop=p
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:
| 1 | triangle |
| 2 | box, nereast neighbor |
| 3 | lanczos 3 |
| 4 | lanczos 8 |
| 5 | mitchell |
| 6 | poly 3 |
| 7 | cubic |
method, Graphics & Pictures, MBS REALbasic 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=LogoMBS(500) // any bitmap image
if p.ScrollHorizontalMBS(100,true,false) then
Title="ok"
end if
Backdrop=p
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.
method, Graphics & Pictures, MBS REALbasic 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:
method, Graphics & Pictures, MBS REALbasic 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=LogoMBS(500) // any bitmap image
if p.ScrollVerticalMBS(100,true,false) then
Title="ok"
end if
Backdrop=p
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.
method, Graphics & Pictures, MBS REALbasic Picture Plugin (PictureMT), class Picture, Console safe in REAL Studio 2010r3 and newer, Plugin version: 10.0, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Performs a transformation to the picture.
Example:
dim p as Picture = LogoMBS(500)
dim map(-1) as color
for r as integer = 0 to 255
for g as integer = 0 to 255
for b as integer = 0 to 255
// index is r*65536+g*256+b
// we swap colors: r gives g, g gives b, b gives r
map.Append rgb(g,b,r)
next
next
next
Backdrop=p.ThreadedTransformMBS(0, map)
Threaded 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.
For each color in the source picture the red, blue and green values are used as index (blue+green*256+blue*65536) in the arrays to get the new color value.
The arrays should have 2^24 entries.
See also:
- ThreadedTransformMBS(Threaded as integer, Map() as integer) as picture
- ThreadedTransformMBS(Threaded as integer, RedMap as memoryblock, GreenMap as memoryblock, BlueMap as memoryblock) as picture
- ThreadedTransformMBS(Threaded as integer, RedMap() as integer, GreenMap() as integer, BlueMap() as integer) as picture
Some examples which use this method:
method, Graphics & Pictures, MBS REALbasic Picture Plugin (PictureMT), class Picture, Console safe in REAL Studio 2010r3 and newer, Plugin version: 10.0, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Performs a transformation to the picture.
Example:
dim p as Picture = LogoMBS(500)
dim map(-1) as integer
for r as integer = 0 to 255
for g as integer = 0 to 255
for b as integer = 0 to 255
// index is r*65536+g*256+b
// we swap colors: r gives g, g gives b, b gives r
map.Append g*65536+b*256+r
next
next
next
Backdrop=p.ThreadedTransformMBS(0, map)
Threaded 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.
For each color in the source picture the red, blue and green values are used as index (blue+green*256+blue*65536) in the arrays to get the new color value.
The arrays should have 2^24 entries.
See also:
- ThreadedTransformMBS(Threaded as integer, Map() as color) as picture
- ThreadedTransformMBS(Threaded as integer, RedMap as memoryblock, GreenMap as memoryblock, BlueMap as memoryblock) as picture
- ThreadedTransformMBS(Threaded as integer, RedMap() as integer, GreenMap() as integer, BlueMap() as integer) as picture
Some examples which use this method:
method, Graphics & Pictures, MBS REALbasic Picture Plugin (PictureMT), class Picture, Console safe in REAL Studio 2010r3 and newer, Plugin version: 10.0, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Performs a transformation to the picture.
Example:
dim p as Picture = LogoMBS(500)
dim red as MemoryBlock = NewMemoryBlock(256)
dim green as MemoryBlock = NewMemoryBlock(256)
dim blue as MemoryBlock = NewMemoryBlock(256)
for i as integer=0 to 255
red.Byte(i)=i/2
green.Byte(i)=i/2
blue.Byte(i)=i/2
next
Backdrop=p.ThreadedTransformMBS(0, red, green, blue)
Threaded 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.
For each color in the source picture the red, blue and green values are used as index in the memoryblocks to get the new color value.
The memoryblocks must have a size of 256 Bytes.
See also:
- ThreadedTransformMBS(Threaded as integer, Map() as color) as picture
- ThreadedTransformMBS(Threaded as integer, Map() as integer) as picture
- ThreadedTransformMBS(Threaded as integer, RedMap() as integer, GreenMap() as integer, BlueMap() as integer) as picture
Some examples which use this method:
method, Graphics & Pictures, MBS REALbasic Picture Plugin (PictureMT), class Picture, Console safe in REAL Studio 2010r3 and newer, Plugin version: 10.0, Mac OS X: Works, Windows: Works, Linux x86: Works, Feedback.
Function: Performs a transformation to the picture.
Example:
dim p as Picture = LogoMBS(500)
dim red(-1) as integer
dim green(-1) as integer
dim blue(-1) as integer
for i as integer=0 to 255
red.Append i/2
green.Append i/2
blue.Append i/2
next
Backdrop=p.ThreadedTransformMBS(0, red, green, blue)
Threaded 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.
For each color in the source picture the red, blue and green values are used as index in the arrays to get the new color value.
The arrays should have 256 entries.
See also:
- ThreadedTransformMBS(Threaded as integer, Map() as color) as picture
- ThreadedTransformMBS(Threaded as integer, Map() as integer) as picture
- ThreadedTransformMBS(Threaded as integer, RedMap as memoryblock, GreenMap as memoryblock, BlueMap as memoryblock) as picture
Some examples which use this method:
global method, Graphics & Pictures, MBS REALbasic Picture Plugin (Picture), Console safe in REAL Studio 2010r3 and newer, 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
You can use the code to do something like a Sepia effect.
Returns a new picture on success.
Some examples using this method:
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: 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])
method, Graphics & Pictures, MBS REALbasic Picture Plugin (PictureTrim), class Picture, Console safe in REAL Studio 2010r3 and newer, 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 = LogoMBS(500)
Backdrop = p.TrimMBS(100,100,300,300)
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:
method, Graphics & Pictures, MBS REALbasic Picture Plugin (PictureTrim), class Picture, Console safe in REAL Studio 2010r3 and newer, 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
dim someimage as Picture = LogoMBS(100)
p=someimage.TrimWithMaskMBS(100,200,300,400)
left and top are zero based.
Returns nil on low memory or bad parameters.
method, Graphics & Pictures, MBS REALbasic 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
This method returns a copy of the picture mirrored.
Returns nil on low memory.
Some examples which use this method:
The items on this page are in the following plugins: MBS REALbasic Picture Plugin.
Links
MBS REAL studio tutorial videos - Pfarrgemeinde Messdiener Nickenich