![]() However, during some testing, I figured out that other values are also supported on the latest android versions (or devices). Note: If you support zooming, you might want to show a full-size image without any scaling.Īccording to the documentation, inSampleSize value should be a power of 2 and any other value will be rounded down to the nearest power of 2. You are to use BitmapFactory API with a special option called inSampleSize which can be used to scale your bitmap on the decoding step. Therefore, scaling is the first option to consider while optimizing your code. In this way, you provide the best quality possible with minimal resources required. In the perfect world, your bitmap has to be the same size as your preview canvas. On the other hand, if you happen to manipulate bitmaps manually, you are on your own to implement them. ![]() Luckily, you are safe if you use some image libraries like Picasso or Glide since they take care of all the optimizations out of the box. That’s the most fundamental rule you should always keep in mind. Imports Leadtools Imports Leadtools.Controls Imports Leadtools.Codecs Imports Leadtools.Drawing Imports Leadtools.ImageProcessing Imports Imports Public Sub ImageViewer_Example() ' Create the form that holds the ImageViewer CType( New MyForm(), MyForm).ShowDialog() End Sub Private Class MyForm : Inherits Form Public Sub New() Me.Size = New Size(800, 800) End Sub ' LEADTOOLS ImageViewer to be used with this example Private _imageViewer As ImageViewer ' Information label Private _label As Label ' Generic state value used by the examples Private _firstCall As Boolean = True Protected Overrides Sub OnLoad( ByVal e As EventArgs) ' Create a panel to the top Dim panel As New Panel() panel.Dock = DockStyle.Top panel.BorderStyle = BorderStyle.FixedSingle Me.Controls.Add(panel) ' Add an "Example" button to the panel Dim button As New Button() button.Text = "&Example" AddHandler button.Click, Sub(sender, e1) Example() (button) ' Add a label to the panel _label = New Label() _label.Top = button.Bottom _label.Width = 800 _label.Text = "Example." (_label) ' Create the image viewer taking the rest of the form _imageViewer = New ImageViewer() _imageViewer.Dock = DockStyle.Fill _imageViewer.BackColor = Color.Bisque Me.Controls.Add(_imageViewer) _imageViewer.BringToFront() ' Add Pan/Zoom interactive mode ' Click and drag to pan, CTRL-Click and drag to zoom in and out _imageViewer.DefaultInteractiveMode = New ImageViewerPanZoomInteractiveMode() ' Load an image Using codecs As New RasterCodecs() _imageViewer.Image = codecs.Load(Path.Combine(ImagesPath.Path, "image1.cmp")) End Using _firstCall = True MyBase.Never keep in memory more than you actually need Using Leadtools using Leadtools.Controls using Leadtools.Codecs using Leadtools.Drawing using Leadtools.ImageProcessing using public void ImageViewer_Example() Refer to the following topics for in-depth information on each group of functionalities: Virtualization mode for handling large number of images High level items operations for hit-testing and automatically going to a certain item or pageĭrag and drop between the image viewer and external sources such as the file system or other image viewer instances Viewing options including infinite zooming with size modes (fit, fit page, etc.), rotation at any angle, flip, reverse, color inversion, and low level transformation Support for both mouse and touch inputįully customizable appearance and position Rich built-in and fully customizable and extensible user-interface interaction support for panning, zooming, magnifying glass, rubber banding and many more. Single or multiple items each with its own image data, size, and optional additional transformationsīuilt-in support for raster and SVG images and documents including loading directly from disk file or URLsĮxtensible layout system with built-in support for single, vertical, and horizontal layouts ImageViewer supports the following features LEADTOOLS Document Viewer uses an Image Viewer instance in vertical layout to view thumbnails of pagesĪnd another Image Viewer instance with in double layout to view the main content LEADTOOLS Main Demo uses an Image Viewer instance in single layout mode to view the main image
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |