Beispiel #1
0
        /// <summary>
        /// Prints an image.
        /// </summary>
        /// <param name="image">Image to be printed</param>
        /// <param name="jobName">Name of the printing job</param>
        /// <param name="onFinishCallback">
        /// Action to perform after printing is finished.
        /// Is performed even if the printing was cancelled.
        /// </param>
        /// <param name="colorMode">Color mode of printing</param>
        /// <param name="orientation">Sheet orientation of printing</param>
        /// <param name="scaleMode">Scale mode of printing</param>
        /// <exception cref="ArgumentNullException"></exception>
        public static void PrintImage([NotNull] Texture2D image, [NotNull] string jobName, Action onFinishCallback = null,
                                      ColorModes colorMode = ColorModes.Color, Orientations orientation = Orientations.Portrait, ScaleModes scaleMode = ScaleModes.Fit)
        {
            if (AGUtils.IsNotAndroid())
            {
                return;
            }

            if (image == null)
            {
                throw new ArgumentNullException("image");
            }

            if (jobName == null)
            {
                throw new ArgumentNullException("jobName");
            }

            _printHelper = new AndroidJavaObject(C.AndroidPrintHelper, AGUtils.Activity);
            _printHelper.Call("setColorMode", (int)colorMode);
            _printHelper.Call("setOrientation", (int)orientation);
            _printHelper.Call("setScaleMode", (int)scaleMode);

            _onPrintSuccess = onFinishCallback;

            var helperClass = new AndroidJavaClass(C.PrintHelperUtilsClass);

            helperClass.CallStatic("printBitmap", jobName, AGUtils.Texture2DToAndroidBitmap(image), _printHelper);
        }
            public Builder SetIcon(Texture2D tex)
            {
                var bitmap = AGUtils.Texture2DToAndroidBitmap(tex);

                Debug.Log("Person builder: bitmap was created.");
                var iconAjo = C.AndroidGraphicsDrawableIcon.AJCCallStaticOnceAJO("createWithBitmap", bitmap);

                Debug.Log("Person builder: icon was created.");
                _ajo.CallAJO("setIcon", iconAjo);
                Debug.Log("Person builder: method was performed.");
                return(this);
            }