예제 #1
0
        /// <summary>
        /// 获取图片数据流
        /// </summary>
        /// <param name="drawable"></param>
        /// <returns></returns>
        public List <byte[]> GetImageByte(Android.Graphics.Drawables.Drawable drawable)
        {
            int    maxWidth = GetDrawableMaxWidth();
            Bitmap image    = ScalingDrawable(drawable, maxWidth);

            if (image == null)
            {
                return(null);
            }
            List <byte[]> data = PrinterUtils.DecodeBitmapToDataList(image, heightParting);

            image.Recycle();
            return(data);
        }
예제 #2
0
        /// <summary>
        /// 获取图片数据流
        /// </summary>
        /// <param name="image"></param>
        /// <returns></returns>
        public List <byte[]> GetImageByte(Bitmap image)
        {
            int    maxWidth     = GetDrawableMaxWidth();
            Bitmap scalingImage = ScalingBitmap(image, maxWidth);

            if (scalingImage == null)
            {
                return(null);
            }
            List <byte[]> data = PrinterUtils.DecodeBitmapToDataList(image, heightParting);

            image.Recycle();
            return(data);
        }
예제 #3
0
        /// <summary>
        /// 获取图片数据流
        /// </summary>
        /// <param name="res"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public List <byte[]> GetImageByte(Android.Content.Res.Resources res, int id)
        {
            int    maxWidth = GetDrawableMaxWidth();
            Bitmap image    = ScalingBitmap(res, id, maxWidth);

            if (image == null)
            {
                return(null);
            }

            List <byte[]> data = PrinterUtils.DecodeBitmapToDataList(image, heightParting);

            image.Recycle();
            return(data);
        }