Stream Loading For Native Image Sample for WinForms
Description
As an alternative to loading an Image with the image file from the file system, you can choose to pass your own stream. This project shows you how to use the event StreamLoading of GdiPlusRasterSource for this purpose. In this project, we show how to do this using a Tiff image but you can also use that event for ShapeFileFeatureSource as we show in a previous project “Shapefile Encryption”. Keep in mind that this technique only works with images besides MrSid, ECW and Jpeg2000. These types of images do not work because the providers do not support streams in their decoding SDKs.
Please refer to Wiki for the details.
Requirements
This sample makes use of the following NuGet Packages
About the Code
NativeImageRasterLayer worldImageLayer = new NativeImageRasterLayer(@"world.tif");
((NativeImageRasterSource)(worldImageLayer.ImageSource)).StreamLoading += new EventHandler<StreamLoadingEventArgs>(MainForm_StreamLoading);
worldImageLayer.UpperThreshold = double.MaxValue;
worldImageLayer.LowerThreshold = 0;
worldImageLayer.IsGrayscale = false;
Getting Help
Map Suite Desktop for Winforms Wiki Resources
Map Suite Desktop for Winforms Product Description
Key APIs
This example makes use of the following APIs:
About Map Suite
Map Suite is a set of powerful development components and services for the .Net Framework.
About ThinkGeo
ThinkGeo is a GIS (Geographic Information Systems) company founded in 2004 and located in Frisco, TX. Our clients are in more than 40 industries including agriculture, energy, transportation, government, engineering, software development, and defense.