Ejemplo n.º 1
0
    //InAppBrpwser Upload
    public void UploadToInAppBrowser(string base64Image, int id)
    {
        MyBrowserOpener browserOpener = GameObject.Find("InAppBrowserBridge").GetComponent <MyBrowserOpener>();

        javaScriptString = "window.addImage(\"data:image/png;base64," + base64Image + "\" , " + id + ")";
        browserOpener.OpenBrowser();
    }
Ejemplo n.º 2
0
    //Match features from canvas, wrap image if match and post to inAppBrowser
    public IEnumerator MatchWarpAndPost()
    {
        ImageObject image;
        GameObject  instantiatedWait = Instantiate(wait, screenshotPreview.transform);

        //Pick the pixels inside the square
        ImagePartToByteArray();

        //Get imageList
        yield return(imageList.GetTextFromURL());

        Debug.Log("Image list count: " + imageList.getImageList().Count);

        //Don't match features if no images is on the canvas
        if (imageList.getImageList().Count == 0)
        {
            image = new ImageObject(Convert.ToBase64String(imagePart), -1);
        }
        // Match feature from images on canvas.
        else
        {
            image = featureMatcher.MatchAndWarp(Convert.ToBase64String(imagePart), imageList.getImageList());
        }
        Destroy(instantiatedWait);

        //Upload to inAppBrowser
        MyBrowserOpener browserOpener = GameObject.Find("InAppBrowserBridge").GetComponent <MyBrowserOpener>();

        javaScriptString = "window.addImage(\"data:image/png;base64," + image.image + "\" , " + image.index + ")";
        browserOpener.OpenBrowser();
    }
Ejemplo n.º 3
0
    //Match features from canvas, wrap image if match and post to inAppBrowser
    public IEnumerator MatchAndOpenControls()
    {
        int        index;
        GameObject instantiatedWait = Instantiate(wait, screenshotPreview.transform);

        //Pick the pixels inside the square
        ImagePartToByteArray();

        //Get imageList
        yield return(imageList.GetTextFromURL());

        Debug.Log("Image list count: " + imageList.getImageList().Count);

        //Don't match features if no images is on the canvas
        if (imageList.getImageList().Count == 0)
        {
            index = -1;
        }
        // Match feature from images on canvas.
        else
        {
            index = featureMatcher.FindBestMatchIndex(Convert.ToBase64String(imagePart), imageList.getImageList());
        }
        Destroy(instantiatedWait);

        if (index == -1)
        {
            Debug.Log("No match");
            yield break;
        }

        //Upload to inAppBrowser
        MyBrowserOpener browserOpener = GameObject.Find("InAppBrowserBridge").GetComponent <MyBrowserOpener>();

        javaScriptString = "window.selectImage(" + index + ")";
        browserOpener.OpenBrowser();
    }
 // Use this for initialization
 void Start()
 {
     screenshot    = FindObjectOfType <Screenshot>();
     uiMethods     = FindObjectOfType <UIMethods>();
     browserOpener = FindObjectOfType <MyBrowserOpener>();
 }