public SourceMapLegendFrame(Layer layer, SourceMap sourceMap, List <LegendRecord> legendRecords,
                             ThumbnailDelegate thumbnailDelegate)
 {
     filename = RenderState.ForceValidFilename(string.Format("SourceMap_{0}_{1}.html",
                                                             layer.displayName,
                                                             sourceMap.displayName));
     displayName            = sourceMap.displayName;
     sourceMapInfo          = sourceMap.sourceMapInfo;
     this.legendRecords     = legendRecords;
     this.thumbnailDelegate = thumbnailDelegate;
 }
Beispiel #2
0
			public ThumbnailCreator(ThumbnailDelegate thumbnailDelegate, ListView listView)
			{
				this.thumbnailDelegate = thumbnailDelegate;
				this.control = listView;
			}
Beispiel #3
0
        private IEnumerator GetThumbnail(GCHandle thumbnailHandle, Action <Texture2D> callback, ThumbnailDelegate callbackObject)
        {
            yield return(new WaitUntil(() => Marshal.ReadIntPtr(thumbnailHandle.AddrOfPinnedObject()) != IntPtr.Zero));

            MonoBehaviour.Destroy(callbackObject); // We don't need this anymore
            var pixelBuffer = Marshal.ReadIntPtr(thumbnailHandle.AddrOfPinnedObject());
            var width       = Marshal.ReadInt32(new IntPtr(thumbnailHandle.AddrOfPinnedObject().ToInt32() + sizeof(int)));
            var height      = Marshal.ReadInt32(new IntPtr(thumbnailHandle.AddrOfPinnedObject().ToInt32() + 2 * sizeof(int)));
            var thumbnail   = new Texture2D(width, height, TextureFormat.RGBA32, false);

            thumbnail.LoadRawTextureData(pixelBuffer, width * height * 4);
            thumbnail.Apply();
            NatShareBridge.FreeThumbnail(thumbnailHandle.AddrOfPinnedObject());
            thumbnailHandle.Free();
            callback(thumbnail);
        }