PictureMemory: MemoryblockBGRAtoPictureMBS

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

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

Platforms to show: All Mac Windows Linux Cross-Platform

MemoryblockBGRAtoPictureMBS(dest as picture, source as memoryblock, offset as Integer, width as Integer, height as Integer) as picture

Type Topic Plugin Version macOS Windows Linux iOS Targets
global method Graphics & Pictures MBS Picture Plugin 10.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Copies image data from a memoryblock into a picture object.
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(nil, m, 0, p.Width, p.Height)

break // look into memoryblock with debugger
end if

Returns nil on any error.
source 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 width*height*4 bytes in the memoryblock.

In the dest picture parameter you can provide a picture to draw in. If the picture is no big enough or nil, a new one is created.

Does not access the mask inside the image!
Data is copied from memory block to the new picture, not referenced.

See also:

MemoryblockBGRAtoPictureMBS(source as memoryblock, offset as Integer, width as Integer, height as Integer) as picture

Type Topic Plugin Version macOS Windows Linux iOS Targets
global method Graphics & Pictures MBS Picture Plugin 8.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Copies image data from a memoryblock into a picture object.
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

Returns nil on any error.
source 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 width*height*4 bytes in the memoryblock.

Does not access the mask inside the image!
Data is copied from memory block to the new picture, not referenced.

See also:

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


💬 Ask a question or report a problem