Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

Previous items Next items

Picture.CopyARGBtoMemoryblockMBS(destination as memoryblock, offset as Integer, MaskForAlpha as picture, StartLine as Integer = 0, EndLine as Integer = -1, Yield as Integer = 0, DestRowBytes as Integer = 0) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Graphics & Pictures MBS Picture Plugin 13.0 Yes Yes Yes Yes No
Function: Copies raw image data into a memoryblock.
Example:
// Create a picture with mask:
dim p as Picture = LogoMBS(200)
dim g as Graphics = p.mask.Graphics

g.ForeColor = &cFFFFFF
g.FillRect 0,0,g.Width,g.Height

g.ForeColor = &c000000
g.Filloval 0,0,g.Width,g.Height

// convert to memoryblock
dim m as new MemoryBlock(4 * p.Width * p.Height)

if p.CopyARGBtoMemoryblockMBS(m, 0, p.Mask) then
// convert back
Backdrop = MemoryblockARGBtoPictureMBS(m, 0, p.Width, p.Height)

break // look into memoryblock with debugger
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.
MaskForAlpha should not be nil and be the mask for this image.

The function will crash if the memoryblock is too small. Needs picture.width*picture.height*4 bytes in the memoryblock. Mask and Picture must have equal size.
The mask is used to fill alpha channel.

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.

StartLine and Endline define the range of source lines from picture. Range is from 0 to picture.height-1. if Endline is -1, we use picture.height-1 internally. Yield specifies how much CPU time is given to other threads. If yield = 0, we give no CPU time away. If yield is > 0, we yield every yield/60th second to other threads. If DestRowBytes is not zero, it specifies the bytes per row in the target memoryblock for each line.

See also:

Feedback, Comments & Corrections

Picture.CopyBGRAtoMemoryblockMBS(destination as memoryblock, offset as Integer, AlphaValue as Integer, StartLine as Integer = 0, EndLine as Integer = -1, Yield as Integer = 0, DestRowBytes as Integer = 0) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Graphics & Pictures MBS Picture Plugin 8.5 Yes Yes Yes Yes No
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.

StartLine and Endline define the range of source lines from picture. Range is from 0 to picture.height-1. if Endline is -1, we use picture.height-1 internally. Yield specifies how much CPU time is given to other threads. If yield = 0, we give no CPU time away. If yield is > 0, we yield every yield/60th second to other threads. If DestRowBytes is not zero, it specifies the bytes per row in the target memoryblock for each line.

See also:

Feedback, Comments & Corrections

Picture.CopyBGRAtoMemoryblockMBS(destination as memoryblock, offset as Integer, MaskForAlpha as picture, StartLine as Integer = 0, EndLine as Integer = -1, Yield as Integer = 0, DestRowBytes as Integer = 0) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Graphics & Pictures MBS Picture Plugin 13.0 Yes Yes Yes Yes No
Function: Copies raw image data into a memoryblock.
Example:
// Create a picture with mask:
dim p as Picture = LogoMBS(200)
dim g as Graphics = p.mask.Graphics

g.ForeColor = &cFFFFFF
g.FillRect 0,0,g.Width,g.Height

g.ForeColor = &c000000
g.Filloval 0,0,g.Width,g.Height

// convert to memoryblock
dim m as new MemoryBlock(4 * p.Width * p.Height)

if p.CopyBGRAtoMemoryblockMBS(m, 0, p.Mask) then
// convert back
Backdrop = MemoryblockBGRAtoPictureMBS(m, 0, p.Width, p.Height)

break // look into memoryblock with debugger
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.
MaskForAlpha should not be nil and be the mask for this image.

The function will crash if the memoryblock is too small. Needs picture.width*picture.height*4 bytes in the memoryblock. Mask and Picture must have equal size.
The mask is used to fill alpha channel.

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.

StartLine and Endline define the range of source lines from picture. Range is from 0 to picture.height-1. if Endline is -1, we use picture.height-1 internally. Yield specifies how much CPU time is given to other threads. If yield = 0, we give no CPU time away. If yield is > 0, we yield every yield/60th second to other threads. If DestRowBytes is not zero, it specifies the bytes per row in the target memoryblock for each line.

See also:

Feedback, Comments & Corrections

Picture.CopyBGRtoMemoryblockMBS(destination as memoryblock, offset as Integer, StartLine as Integer = 0, EndLine as Integer = -1, Yield as Integer = 0, DestRowBytes as Integer = 0) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Graphics & Pictures MBS Picture Plugin 8.5 Yes Yes Yes Yes No
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*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.

StartLine and Endline define the range of source lines from picture. Range is from 0 to picture.height-1. if Endline is -1, we use picture.height-1 internally. Yield specifies how much CPU time is given to other threads. If yield = 0, we give no CPU time away. If yield is > 0, we yield every yield/60th second to other threads. If DestRowBytes is not zero, it specifies the bytes per row in the target memoryblock for each line.

Feedback, Comments & Corrections

Picture.CopyBGRXtoMemoryblockMBS(destination as memoryblock, offset as Integer, StartLine as Integer = 0, EndLine as Integer = -1, Yield as Integer = 0, DestRowBytes as Integer = 0) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Graphics & Pictures MBS Picture Plugin 8.5 Yes Yes Yes Yes No
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.

StartLine and Endline define the range of source lines from picture. Range is from 0 to picture.height-1. if Endline is -1, we use picture.height-1 internally. Yield specifies how much CPU time is given to other threads. If yield = 0, we give no CPU time away. If yield is > 0, we yield every yield/60th second to other threads. If DestRowBytes is not zero, it specifies the bytes per row in the target memoryblock for each line.

Feedback, Comments & Corrections

Picture.CopyBtoMemoryblockMBS(destination as memoryblock, offset as Integer, PixelByteSize as Integer, StartLine as Integer = 0, EndLine as Integer = -1, Yield as Integer = 0, DestRowBytes as Integer = 0) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Graphics & Pictures MBS Picture Plugin 5.3 Yes Yes Yes Yes No
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 Blue channel from mask image into Memoryblock
if p.mask.CopyBtoMemoryblockMBS(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 blue 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.

StartLine and Endline define the range of source lines from picture. Range is from 0 to picture.height-1. if Endline is -1, we use picture.height-1 internally. Yield specifies how much CPU time is given to other threads. If yield = 0, we give no CPU time away. If yield is > 0, we yield every yield/60th second to other threads. If DestRowBytes is not zero, it specifies the bytes per row in the target memoryblock for each line.

Feedback, Comments & Corrections

Picture.CopyGtoMemoryblockMBS(destination as memoryblock, offset as Integer, PixelByteSize as Integer, StartLine as Integer = 0, EndLine as Integer = -1, Yield as Integer = 0, DestRowBytes as Integer = 0) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Graphics & Pictures MBS Picture Plugin 5.3 Yes Yes Yes Yes No
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 green channel from mask image into Memoryblock
if p.mask.CopyGtoMemoryblockMBS(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 green 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.

StartLine and Endline define the range of source lines from picture. Range is from 0 to picture.height-1. if Endline is -1, we use picture.height-1 internally. Yield specifies how much CPU time is given to other threads. If yield = 0, we give no CPU time away. If yield is > 0, we yield every yield/60th second to other threads. If DestRowBytes is not zero, it specifies the bytes per row in the target memoryblock for each line.

Feedback, Comments & Corrections

Picture.CopyMaskMBS as picture
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Graphics & Pictures MBS Picture Plugin 8.6 Yes Yes Yes Yes No
Function: Copies the mask of the picture into a new and independend picture object.
Example:
dim p as Picture

p=NewPicture(300,300,32)

p.Graphics.ForeColor=&cFF0000
p.Graphics.FillRect 0,0,300,300

p.mask.Graphics.ForeColor=&cFFFFFF
p.mask.Graphics.Fillrect 0,0,300,300

p.mask.Graphics.ForeColor=&c000000
p.mask.Graphics.Filloval 0,0,300,300

Backdrop=p.CopyMaskMBS
Notes: Returns nil on low memory.

Some examples which use this method:

Feedback, Comments & Corrections

Picture.CopyPictureMBS as picture
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Graphics & Pictures MBS Picture Plugin 16.2 Yes Yes Yes Yes No
Function: Creates a clone of picture.
Notes: Can duplicate mask and alpha channel.

Feedback, Comments & Corrections

Picture.CopyPictureWithMaskMBS as picture
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Graphics & Pictures MBS Picture Plugin 8.6 Yes Yes Yes Yes No
Function: Copies the the picture into a new and independend picture object with mask.
Example:
dim p as Picture

p=NewPicture(300,300,32)

p.Graphics.ForeColor=&cFF0000
p.Graphics.FillRect 0,0,300,300

p.mask.Graphics.ForeColor=&cFFFFFF
p.mask.Graphics.Fillrect 0,0,300,300

p.mask.Graphics.ForeColor=&c000000
p.mask.Graphics.Filloval 0,0,300,300

Backdrop=p.CopyPictureWithMaskMBS
Notes: Returns nil on low memory.

Some examples which use this method:

Feedback, Comments & Corrections

Picture.CopyPictureWithoutMaskMBS as picture
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Graphics & Pictures MBS Picture Plugin 8.6 Yes Yes Yes Yes No
Function: Copies the the picture into a new and independend picture object without the mask.
Example:
dim p as Picture

p=NewPicture(300,300,32)

p.Graphics.ForeColor=&cFF0000
p.Graphics.FillRect 0,0,300,300

p.mask.Graphics.ForeColor=&cFFFFFF
p.mask.Graphics.Fillrect 0,0,300,300

p.mask.Graphics.ForeColor=&c000000
p.mask.Graphics.Filloval 0,0,300,300

Backdrop=p.CopyPictureWithoutMaskMBS
Notes: Returns nil on low memory.

Some examples which use this method:

Feedback, Comments & Corrections

Picture.CopyPixelFastMBS(Source As Picture, DestX as Integer, DestY as Integer, SourceX as Integer, SourceY as Integer, Width as Integer, Height as Integer) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Graphics & Pictures MBS Picture Plugin 8.7 Yes Yes No Yes No
Function: Copies pixels from one picture into another picture with some options.
Example:
const x=100 // mouse coordinates for example
const y=100

dim p,logo as picture

logo=LogoMBS(500)

p=NewPicture(800,800,32)

p.Graphics.ForeColor=&cFFFFFF
p.Graphics.FillRect 0,0,p.Width,p.Height

if p.CopyPixelFastMBS(logo, x-logo.Width/2, y-logo.Height/2, 0, 0, logo.Width, logo.Height) then
' ok
else
beep
end if

window1.Backdrop=p
Notes:
Returns true on success and false on failure.

Parameters:
Source: the source picture, must not 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

The destination image (self) can be either 24 bit or 32 bit.
The source image can have any bit depth and may be converted to 24 or 32 bit.

Some examples which use this method:

Feedback, Comments & Corrections

Picture.CopyRGBAtoMemoryblockMBS(destination as memoryblock, offset as Integer, AlphaValue as Integer, StartLine as Integer = 0, EndLine as Integer = -1, Yield as Integer = 0, DestRowBytes as Integer = 0) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Graphics & Pictures MBS Picture Plugin 8.5 Yes Yes Yes Yes No
Function: Copies raw image data into a memoryblock.
Example:
// get some picture
dim pic as Picture = LogoMBS(500)
// and a memoryblock of 1000 by 1000 pixels with 4 bytes per pixel
dim m as new MemoryBlock(1000* 1000 *4)

// calculate some offset for the image with 50 rows from top and 60 pixels from left
dim Offset50Lines as Integer = 1000*4 *50 +60*4

// copy picture to memoryblock
if pic.CopyRGBAtoMemoryblockMBS(m, Offset50Lines, 127, 0, pic.Height-1, 0, 4*1000) then

// show MemoryBlock content
Backdrop = MemoryblockRGBAtoPictureMBS(nil, m, 0, 1000, 1000)
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*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.

StartLine and Endline define the range of source lines from picture. Range is from 0 to picture.height-1. if Endline is -1, we use picture.height-1 internally. Yield specifies how much CPU time is given to other threads. If yield = 0, we give no CPU time away. If yield is > 0, we yield every yield/60th second to other threads. If DestRowBytes is not zero, it specifies the bytes per row in the target memoryblock for each line.

See also:

Feedback, Comments & Corrections

Picture.CopyRGBAtoMemoryblockMBS(destination as memoryblock, offset as Integer, MaskForAlpha as picture, StartLine as Integer = 0, EndLine as Integer = -1, Yield as Integer = 0, DestRowBytes as Integer = 0) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Graphics & Pictures MBS Picture Plugin 13.0 Yes Yes Yes Yes No
Function: Copies raw image data into a memoryblock.
Example:
// Create a picture with mask:
dim p as Picture = LogoMBS(200)
dim g as Graphics = p.mask.Graphics

g.ForeColor = &cFFFFFF
g.FillRect 0,0,g.Width,g.Height

g.ForeColor = &c000000
g.Filloval 0,0,g.Width,g.Height

// convert to memoryblock
dim m as new MemoryBlock(4 * p.Width * p.Height)

if p.CopyRGBAtoMemoryblockMBS(m, 0, p.Mask) then
// convert back
Backdrop = MemoryblockRGBAtoPictureMBS(m, 0, p.Width, p.Height)

break // look into memoryblock with debugger
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.
MaskForAlpha should not be nil and be the mask for this image.

The function will crash if the memoryblock is too small. Needs picture.width*picture.height*4 bytes in the memoryblock. Mask and Picture must have equal size.
The mask is used to fill alpha channel.

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.

StartLine and Endline define the range of source lines from picture. Range is from 0 to picture.height-1. if Endline is -1, we use picture.height-1 internally. Yield specifies how much CPU time is given to other threads. If yield = 0, we give no CPU time away. If yield is > 0, we yield every yield/60th second to other threads. If DestRowBytes is not zero, it specifies the bytes per row in the target memoryblock for each line.

See also:

Feedback, Comments & Corrections

Picture.CopyRGBtoMemoryblockMBS(destination as memoryblock, offset as Integer, StartLine as Integer = 0, EndLine as Integer = -1, Yield as Integer = 0, DestRowBytes as Integer = 0) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Graphics & Pictures MBS Picture Plugin 5.3 Yes Yes Yes Yes No
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.

StartLine and Endline define the range of source lines from picture. Range is from 0 to picture.height-1. if Endline is -1, we use picture.height-1 internally. Yield specifies how much CPU time is given to other threads. If yield = 0, we give no CPU time away. If yield is > 0, we yield every yield/60th second to other threads. If DestRowBytes is not zero, it specifies the bytes per row in the target memoryblock for each line.

Some examples which use this method:

Feedback, Comments & Corrections

Picture.CopyRGBXtoMemoryblockMBS(destination as memoryblock, offset as Integer, StartLine as Integer = 0, EndLine as Integer = -1, Yield as Integer = 0, DestRowBytes as Integer = 0) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Graphics & Pictures MBS Picture Plugin 8.5 Yes Yes Yes Yes No
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.

StartLine and Endline define the range of source lines from picture. Range is from 0 to picture.height-1. if Endline is -1, we use picture.height-1 internally. Yield specifies how much CPU time is given to other threads. If yield = 0, we give no CPU time away. If yield is > 0, we yield every yield/60th second to other threads. If DestRowBytes is not zero, it specifies the bytes per row in the target memoryblock for each line.

Feedback, Comments & Corrections

Picture.CopyRtoMemoryblockMBS(destination as memoryblock, offset as Integer, PixelByteSize as Integer, StartLine as Integer = 0, EndLine as Integer = -1, Yield as Integer = 0, DestRowBytes as Integer = 0) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Graphics & Pictures MBS Picture Plugin 5.3 Yes Yes Yes Yes No
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.

StartLine and Endline define the range of source lines from picture. Range is from 0 to picture.height-1. if Endline is -1, we use picture.height-1 internally. Yield specifies how much CPU time is given to other threads. If yield = 0, we give no CPU time away. If yield is > 0, we yield every yield/60th second to other threads. If DestRowBytes is not zero, it specifies the bytes per row in the target memoryblock for each line.

Feedback, Comments & Corrections

Picture.CopyXBGRtoMemoryblockMBS(destination as memoryblock, offset as Integer, StartLine as Integer = 0, EndLine as Integer = -1, Yield as Integer = 0, DestRowBytes as Integer = 0) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Graphics & Pictures MBS Picture Plugin 8.5 Yes Yes Yes Yes No
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.

StartLine and Endline define the range of source lines from picture. Range is from 0 to picture.height-1. if Endline is -1, we use picture.height-1 internally. Yield specifies how much CPU time is given to other threads. If yield = 0, we give no CPU time away. If yield is > 0, we yield every yield/60th second to other threads. If DestRowBytes is not zero, it specifies the bytes per row in the target memoryblock for each line.

Feedback, Comments & Corrections

Picture.CopyXRGBtoMemoryblockMBS(destination as memoryblock, offset as Integer, StartLine as Integer = 0, EndLine as Integer = -1, Yield as Integer = 0, DestRowBytes as Integer = 0) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Graphics & Pictures MBS Picture Plugin 8.5 Yes Yes Yes Yes No
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.

StartLine and Endline define the range of source lines from picture. Range is from 0 to picture.height-1. if Endline is -1, we use picture.height-1 internally. Yield specifies how much CPU time is given to other threads. If yield = 0, we give no CPU time away. If yield is > 0, we yield every yield/60th second to other threads. If DestRowBytes is not zero, it specifies the bytes per row in the target memoryblock for each line.

Feedback, Comments & Corrections

Previous items Next items

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




Links
MBS FileMaker tutorial videos