Android Question draw bitmap transparent ...

Discussion in 'Android Questions' started by ilan, Jun 7, 2015.

  1. ilan

    ilan Expert Licensed User


    i have an image and i would like to draw the image with canvas to my panel and i would like to draw the image but a specific color should be transparent like

    i have in my image a white frame and i would like to draw the image but the white frame should be drawn transparent and the image inside should be draw as is...

    is this possible?

    thanx in advance
  2. NeoTechni

    NeoTechni Well-Known Member Licensed User

    I'd love to know that too.
    However, if you want to do it the other way you can just use a transparent PNG file. Run it through to keep the filesize down.
  3. ilan

    ilan Expert Licensed User

    If i think about it again i think i know how it can be done.

    Just need to get evey pixel with bitmap.getpixel and if is white draw transparent else draw as is...

    will need to make some tests when i get home :)
  4. sorex

    sorex Expert Licensed User

    why don't you make the white area transparent in your source picture?
  5. ilan

    ilan Expert Licensed User

    Because my picture frame is not a square i want to make a puzzle game

    If the draw.path would have also radius and not only lines i would creat a path but you can only add line to the path
  6. klaus

    klaus Expert Licensed User

    You could use the ABExtDrawing library, there you have following methods for paths:
    - addArc
    - arcTo
    - cubicTo
    - quadTo
    ilan likes this.
  7. ilan

    ilan Expert Licensed User

    Thanx klaus will take a look on it :)
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice