iOS Tutorial Bouncing smilay - Drawing with Canvas

Discussion in 'iOS Tutorials' started by Erel, Oct 27, 2014.

  1. Erel

    Erel Administrator Staff Member Licensed User

    A Canvas object allows you to draw over a view.

    Canvas.Initialize expects a single parameter which is the target view.

    You can then use the different drawing methods to draw over the view. The drawings will only be applied when you call Canvas.Refresh.

    If the target view changes its size then you need to initialize the Canvas object again. This usually happens in Page_Resize event.
    In this example we use two different canvas objects. cvsBackground is used to fill the root panel with a gradient.
    Canvas1 draws over Panel1 which is a transparent panel. The smiley is drawn with Canvas1.

    This video also demonstrates the hot code swapping feature.
    Make sure to watch in HD mode (click on the small gear button).


    Note that you should call Canvas.Release if it is no longer required.
    You can create a Bitmap from the canvas layer with Canvas.CreateBitmap.
     

    Attached Files:

    luke2012, Pavka, ilan and 2 others like this.
  2. Ariel

    Ariel New Member Licensed User

    Congratulations on the contribution to the community basic4, you're a genius, I admire you. Can I compile the same project made basic4android? Regards Ariel
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    It should be simple to convert the code to B4A though it is not exactly the same.
     
  4. Tayfur

    Tayfur Well-Known Member Licensed User

    Erel, We waiting your B4i <>B4a convert program ;)
    thanks for your suprize
     
Loading...
  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