Android Code Snippet Draw round bitmap

Discussion in 'Code Snippets' started by Erel, May 21, 2014.

  1. Erel

    Erel Administrator Staff Member Licensed User

    Sub Name: DrawRoundBitmap

    Description: This code uses Path object to draw a round bitmap at the center of a transparent mutable bitmap.

    Sub Activity_Create(FirstTime As Boolean)
    Dim cvs As Canvas = CreateBitmap
    LoadBitmap(File.DirAssets, "1.jpg"))
    End Sub

    Sub CreateBitmap As Canvas
    Dim bmp As Bitmap
    Dim cvs As Canvas
    Dim r As Rect
    00, bmp.Width, bmp.Height)
    Colors.Transparent, True0)
    Dim p As Path
    Dim jo As JavaObject = p
    Dim x = 100dip, y = 100dip, radius = 100dip As Float
    "addCircle"Array As Object(x, y, radius, "CW"))
    Return cvs
    End Sub

    Sub DrawRoundBitmap (cvs As Canvas, bmp As Bitmap)
    Dim r As Rect
    00, cvs.Bitmap.Width, cvs.Bitmap.Height)
    Null, r)
    End Sub

    Dependencies: JavaObject

    Tags: round bitmap, ClipPath
    Last edited: Sep 4, 2016
  2. LucaMs

    LucaMs Expert Licensed User

    I know that you do not need the Likes, but I love the Snippets.

    My "like" has the value of "thank you"
  3. Erel

    Erel Administrator Staff Member Licensed User

    Actually I do like the Likes :)
    Beja, eps and LucaMs like this.
  4. anOparator

    anOparator Active Member Licensed User

    I thought the round/oval button was a great option , this eclipses that :cool:
  5. deyvitavara

    deyvitavara New Member Licensed User


    How could I do if I want to add color and size to the edge?

    Thank you!
  6. asales

    asales Well-Known Member Licensed User

  7. deyvitavara

    deyvitavara New Member Licensed User

    konradwalsh likes this.
  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