ChartDirector MBS: setBgImage

  1. 3 years ago

    Sascha S

    24 May 2015 Pre-Release Testers, Xojo Pro Germany/W'haven
    Edited 3 years ago

    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:

      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)

    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:

      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)
      
  2. Sascha S

    24 May 2015 Pre-Release Testers, Xojo Pro Answer Germany/W'haven

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

      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)
      
  3. 2 years ago

    Christian S

    25 May 2015 Pre-Release Testers, Xojo Pro Germany

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

  4. Mike C

    25 May 2015 Pre-Release Testers, Xojo Pro North Carolina (USA)

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

    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)

    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!!! :)

  5. Sascha S

    25 May 2015 Pre-Release Testers, Xojo Pro Germany/W'haven
    Edited 2 years ago

    -image-

    :)

  6. Christian S

    25 May 2015 Pre-Release Testers, Xojo Pro Germany

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

  7. Sascha S

    25 May 2015 Pre-Release Testers, Xojo Pro Germany/W'haven

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

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

  8. Mike C

    25 May 2015 Pre-Release Testers, Xojo Pro North Carolina (USA)
    Edited 2 years ago

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

or Sign Up to reply!