Android Question ABMeter: transparent background

me68

Member
Licensed User
Longtime User
Hello!

I embeded the sample ABMeter as class-modul to our app. I'll use it as amperemeter for a cockpit-view of an electric-car (Citroen C-Zero/Peugeot iOn/Mitsubishi i-MiEV).

It outperforms my expections - it's working great!

But i'm, not familiar with all this painting-functions. I'll want to use only the needle on a transparent background. But if i remove the background-painting (in my case adapted drawLogo), i get a lot of needles.

B4X:
Sub drawMe(Canv As Canvas)
    ExDraw.save2(Canv, ExDraw.MATRIX_SAVE_FLAG)
    ExDraw.scale(Canv, scale, scale)
    'drawLogo(Canv)
    drawHand(Canv)
    ExDraw.restore(Canv)
    If handNeedsToMove Then
        MoveHand
    End If
    GetPanel("Pnl_CockpitAmperemeter").Invalidate
End Sub



If i use adapted drawLogo, it looks like following (the orginal needle must be removed from the image, which is used as background):



But this is only a workaround. The "logo" does not fit 100% and on this the speed-value is not visible.

How can i use only the needle on a transparent background?


Martin
 

me68

Member
Licensed User
Longtime User
Solution: I clipped the region of the area, which is used by the needle now. The rest of the image is transparent. So i can use the drawLogo with this special prepared image now:





Martin
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…