←Select platform

Order Property

Summary

Gets or sets the color order of this RasterImage.

Syntax
C#
VB
Java
Objective-C
C++
public RasterByteOrder Order { get; set; } 
Public Property Order As RasterByteOrder 
@property (nonatomic, assign) LTRasterByteOrder order 
public RasterByteOrder getOrder() 
public: 
property RasterByteOrder Order { 
   RasterByteOrder get(); 
   void set (    RasterByteOrder ); 
} 

Property Value

The color order of this RasterImage.

Remarks

The RasterImage object supports storing the image data in one of the following color orders:

Order Notes
RasterByteOrder.Rgb The image data contains the color in the RGB order. For example, for 24-bits per pixel images the data is stored as the 3 bytes representing the red, green and blue component respectively. Palettized images (with bits per pixel less than or equal to 8) will also report a byte order of RGB although the image data stored is really indices into the palette.

16-bit bitmaps use 5 bits for R, G and B components and one bit for alpha

RasterByteOrder.Bgr The image data contains the color in the BGR order. For example, for 24-bits per pixel images the data is stored as the 3 bytes representing the blue, green and red component respectively.
RasterByteOrder.Rgb565 The image data contains the color in RGB color order with 5 bits for red and blue component and 6 bits for green component (16 bits per pixel). There is no alpha information.
RasterByteOrder.Gray The image data contains the grayscale colors. For 12 and 16-bits per pixel images, the image data contains the grayscale values of the pixel, for 8-bits per pixel gray scale images, the image data contains an index into the grayscale palette.
RasterByteOrder.Romm The image data is compressed in memory using ROMM. Only valid for 24-bits per pixel images.

Example
C#
VB
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Core; 
using Leadtools.ImageProcessing.Color; 
using Leadtools.Dicom; 
using Leadtools.Drawing; 
using Leadtools.Controls; 
using LeadtoolsExamples.Common; 
using Leadtools.Svg; 
 
public void OrderExample() 
{ 
   RasterCodecs codecs = new RasterCodecs(); 
 
   string srcFileName = Path.Combine(ImagesPath.Path, "Image1.cmp"); 
 
   // Load the image as BGR (default) and get the first pixel value 
   RasterImage image = codecs.Load(srcFileName, 24, CodecsLoadByteOrder.Bgr, 1, 1); 
   Console.WriteLine("Order is {0}", image.Order); 
   image.Dispose(); 
 
   // Load the image as RGB and get the first pixel value 
   image = codecs.Load(srcFileName, 24, CodecsLoadByteOrder.Rgb, 1, 1); 
   Console.WriteLine("Order is {0}", image.Order); 
   image.Dispose(); 
 
   codecs.Dispose(); 
} 
Imports Leadtools 
Imports Leadtools.Codecs 
Imports Leadtools.ImageProcessing 
Imports Leadtools.ImageProcessing.Core 
Imports Leadtools.ImageProcessing.Color 
Imports Leadtools.Controls 
Imports Leadtools.Dicom 
Imports Leadtools.Drawing 
Imports Leadtools.Svg 
 
Public Sub OrderExample() 
   Dim codecs As RasterCodecs = New RasterCodecs() 
 
   Dim srcFileName As String = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp") 
 
   ' Load the image as BGR (default) and get the first pixel value 
   Dim image As RasterImage = codecs.Load(srcFileName, 24, CodecsLoadByteOrder.Bgr, 1, 1) 
   Console.WriteLine("Order is {0}", image.Order) 
   image.Dispose() 
 
   ' Load the image as RGB and get the first pixel value 
   image = codecs.Load(srcFileName, 24, CodecsLoadByteOrder.Rgb, 1, 1) 
   Console.WriteLine("Order is {0}", image.Order) 
   image.Dispose() 
 
   codecs.Dispose() 
End Sub 
 
Public NotInheritable Class LEAD_VARS 
   Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images" 
End Class 
c#[Silverlight C# Example] 
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Dicom; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Core; 
using Leadtools.ImageProcessing.Color; 
using Leadtools.Examples; 
using Leadtools.Windows.Media; 
 
public void OrderExample() 
{ 
   // Create an image as BGR 
   RasterImage srcImage = new RasterImage(RasterMemoryFlags.Conventional, 300, 300, 24, RasterByteOrder.Bgr, RasterViewPerspective.TopLeft, null, null, 0); 
   Debug.WriteLine("Order is {0}", srcImage.Order); 
   Debug.Assert(srcImage.Order == RasterByteOrder.Bgr); 
   srcImage.Dispose(); 
 
   // Create an image as RGB 
   srcImage = new RasterImage(RasterMemoryFlags.Conventional, 300, 300, 24, RasterByteOrder.Rgb, RasterViewPerspective.TopLeft, null, null, 0); 
   Debug.WriteLine("Order is {0}", srcImage.Order); 
   Debug.Assert(srcImage.Order == RasterByteOrder.Rgb); 
   srcImage.Dispose(); 
} 
vb[Silverlight VB Example] 
Imports Leadtools 
Imports Leadtools.Codecs 
Imports Leadtools.Dicom 
Imports Leadtools.ImageProcessing 
Imports Leadtools.ImageProcessing.Core 
Imports Leadtools.ImageProcessing.Color 
Imports Leadtools.Windows.Media 
 
Public Sub OrderExample() 
   ' Create an image as BGR 
   Dim srcImage As RasterImage = New RasterImage(RasterMemoryFlags.Conventional, 300, 300, 24, RasterByteOrder.Bgr, RasterViewPerspective.TopLeft, Nothing, Nothing, 0) 
   Debug.WriteLine("Order is {0}", srcImage.Order) 
   Debug.Assert(srcImage.Order = RasterByteOrder.Bgr) 
   srcImage.Dispose() 
 
   ' Create an image as RGB 
   srcImage = New RasterImage(RasterMemoryFlags.Conventional, 300, 300, 24, RasterByteOrder.Rgb, RasterViewPerspective.TopLeft, Nothing, Nothing, 0) 
   Debug.WriteLine("Order is {0}", srcImage.Order) 
   Debug.Assert(srcImage.Order = RasterByteOrder.Rgb) 
   srcImage.Dispose() 
End Sub 

Requirements

Target Platforms

Help Version 20.0.2019.3.11
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2019 LEAD Technologies, Inc. All Rights Reserved.

Leadtools Assembly