iOS Question Merging a canvas to imageview before saving to gallery

Discussion in 'iOS Questions' started by Mark Turney, Feb 23, 2015.

  1. Mark Turney

    Mark Turney Active Member Licensed User

    I'm drawing freehand (Less Note app) on a canvas which is initialized to a panel. After drawing, it's easy to save the drawing to the photo gallery using:
    Code:
    Dim svBmp As Bitmap
        svBmp = cvsDrawPad.CreateBitmap
        
    Phone.AddImageToAlbum(svBmp)
        tm.ToastMessageShow(
    "Current image saved to Photo Album"False)
    However, there is an underlying imageview with various paper types (lined, graph, parchment). I would like to somehow merge the canvas onto the paper type before saving ... so it looks like I drew on the paper (which is just a png).

    Any thoughts?

    Thanks in advance!
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    You will need to first draw the ImageView to the canvas with DrawBitmap or DrawView.
     
    Mark Turney likes this.
  3. MotoMusher

    MotoMusher Active Member Licensed User

    Yes, it's pretty easy. You do need to pass the background. This below isn't complete, but just add a second bitmap and assign it to an imageview and add it to photopanel. Add the background first, then the drawing on top.

    Code:
    Sub Watermark (Image As Bitmap, background as bitmapAs Bitmap
        
    Dim PhotoCanvas As Canvas
        
    Dim PhotoPanel As Panel
        
    Dim PhotoView As ImageView
        
    Dim NewImage As Bitmap
       
    Dim bView As Bitmap
        PhotoPanel.Initialize(
    "")
        PhotoPanel.Width = 
    Image.Width
        PhotoPanel.Height = 
    Image.Height
        PhotoView.Initialize(
    "")
        PhotoView.Bitmap = 
    Image
        PhotoPanel.AddView(PhotoView, 
    00Image.Width ,Image.Height)
        PhotoCanvas.Initialize(PhotoPanel)
        NewImage = PhotoCanvas.CreateBitmap
        
    Return NewImage
    End Sub
     
    Mark Turney likes this.
  4. Mark Turney

    Mark Turney Active Member Licensed User

    Thanks guys. Will try it out when back in front of my PC.
     
  5. Mark Turney

    Mark Turney Active Member Licensed User

    Works perfectly guys and makes sense ... thanks so much!
     
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