ChartDirector MBS: setBgImage

I am trying to set a Background Image for a Angular Meter but all my attempts failed so far.
The Image is a 1024x1024px PNG with Transparency, located in the Resources Folder of the OS X App Bundle.

I am using the following code to create the Meter with an Image Mask:

[code] dim m as new CDAngularMeterMBS(1024, 1024, CDBaseChartMBS.kTransparent, CDBaseChartMBS.kTransparent, 0)
m.setMeter(512, 512, 502, -135, 135)
m.setScale(0, 100, 10)
m.setLineWidth(0, 3, 0)

call m.addPointer(value, &c19191900, &c19191900)

Dim CPUChartPicture As New Picture(1024, 1024, 32)
CPUChartPicture=m.makeChartPicture

Dim CPUChartMask As New Picture(1024, 1024, 32)
CPUChartMask.Graphics.ForeColor = &c00000000
CPUChartMask.Graphics.FillOval(10, 10, 1004, 1004)
CPUChartPicture.ApplyMask(CPUChartMask)[/code]

I tried to add a BgImage like this:

Dim f As FolderItem f = App.ExecutableFile.Parent.Parent.Child("Resources").Child("speed_1.png") MeterBackground = MeterBackground.Open(f) // MeterBackground is a Property of the Window m.setBgImage(MeterBackground.GetData(Picture.FormatPNG))
But the result is just a black filled circle including the Pointer drawed by Chart Director.

Where and how can i load and add the image as a BgImage to this Meter please?

I’ve made it by using a Wallpaper instead. But i am not sure if this is the best/fastest method:

[code] Dim f As FolderItem
f = App.ExecutableFile.Parent.Parent.Child(“Resources”).Child(“speed_1.png”)

dim m as new CDAngularMeterMBS(1024, 1024, CDBaseChartMBS.kTransparent, CDBaseChartMBS.kTransparent, 0)
m.setMeter(512, 512, 502, -135, 135)
m.setScale(0, 100, 10)
m.setLineWidth(0, 3, 0)

m.setWallpaper(f)
[/code]

setBgImage received a file path, not the image data.
But good you got it working.

[quote=189504:@Sascha S]I’ve made it by using a Wallpaper instead. But i am not sure if this is the best/fastest method:

[code] Dim f As FolderItem
f = App.ExecutableFile.Parent.Parent.Child(“Resources”).Child(“speed_1.png”)

dim m as new CDAngularMeterMBS(1024, 1024, CDBaseChartMBS.kTransparent, CDBaseChartMBS.kTransparent, 0)
m.setMeter(512, 512, 502, -135, 135)
m.setScale(0, 100, 10)
m.setLineWidth(0, 3, 0)

m.setWallpaper(f)
[/code][/quote]
Sasha if you have the time and don’t mind posting your meter id be interested to see how it looks with your image.

Thanks!!! :slight_smile:

:slight_smile:

cool. I would appreciate a little example for including with our plugin.

Sure. I will send it later tonight per Email. :slight_smile:

Sasha that is awesome! I never thought of doing that… You opened up a whole new world of ideas! Thank you!!!