コード例 #1
0
        private void addAllReusablePinImages()
        {
            if (xMap.pins == null)
            {
                return;
            }

            foreach (var pin in xMap.pins)
            {
                var bitmap = nMap.GetImage(pin.image);

                // If any existing item does not yet exist
                if (bitmap == null)
                {
                    if (_keyValues.ContainsKey(pin.image))
                    {
                        var imageBitmap = _keyValues.FirstOrDefault(x => x.Key.Equals(pin.image)).Value;
                        nMap.AddImage(pin.image, imageBitmap);
                    }
                    else
                    {
                        throw new Exception("Image not found. Please add it in Init.");
                    }

                    //using (var stream = pin.icon.getRawStremFromEmbeddedResource(xMap.callerAssembly, pin.icon.Width, pin.icon.Height))
                    //{
                    //    var newBitmap = BitmapFactory.DecodeStream(stream);
                    //    nMap.AddImage(pin.icon, newBitmap);
                    //}
                }
            }
        }
コード例 #2
0
        private byte[] GetStyleImage(string imageName)
        {
            var img = map.GetImage(imageName);

            if (img != null)
            {
                var stream = new MemoryStream();
                img.Compress(Bitmap.CompressFormat.Png, 100, stream);
                return(stream.ToArray());
            }
            return(null);
        }