Platforms to show: All Mac Windows Linux Cross-Platform

Back to Picture class.

Picture.ThreadedTransformMBS(Threaded as Integer, Map() as color, dest as picture = nil) as picture

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Graphics & Pictures MBS Picture Plugin 10.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
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 parameter 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.

You can pass destination picture. If dest is not nil and size matches, the plugin reuses the picture object which increases performance as no new picture is created.

See also:

Some examples using this method:

Picture.ThreadedTransformMBS(Threaded as Integer, Map() as Integer, dest as picture = nil) as picture

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Graphics & Pictures MBS Picture Plugin 10.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
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 parameter 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.

You can pass destination picture. If dest is not nil and size matches, the plugin reuses the picture object which increases performance as no new picture is created.

See also:

Some examples using this method:

Picture.ThreadedTransformMBS(Threaded as Integer, RedMap as memoryblock, GreenMap as memoryblock, BlueMap as memoryblock, dest as picture = nil) as picture

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Graphics & Pictures MBS Picture Plugin 10.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
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 parameter 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.

You can pass destination picture. If dest is not nil and size matches, the plugin reuses the picture object which increases performance as no new picture is created.

See also:

Some examples using this method:

Picture.ThreadedTransformMBS(Threaded as Integer, RedMap() as Integer, GreenMap() as Integer, BlueMap() as Integer, dest as picture = nil) as picture

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Graphics & Pictures MBS Picture Plugin 10.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
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 parameter 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.

You can pass destination picture. If dest is not nil and size matches, the plugin reuses the picture object which increases performance as no new picture is created.

See also:

Some examples using this method:

Blog Entries

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


The biggest plugin in space...