←Select platform

CodecsTransformFlags Enumeration

Summary
Indicates the transform to perform.
Syntax
C#
Objective-C
C++/CLI
Java
Python
[FlagsAttribute()] 
public enum CodecsTransformFlags   
typedef NS_OPTIONS(NSUInteger, LTCodecsTransformFlags) 
public enum CodecsTransformFlags 
[FlagsAttribute()] 
public enum class CodecsTransformFlags   
class CodecsTransformFlags(Enum): 
   None = 0 
   Flip = 1 
   Reverse = 2 
   Rotate90 = 4 
   Rotate180 = 8 
   Rotate270 = 12 
Members
ValueMemberDescription
0x00000000None None.
0x00000001Flip Flip the image vertically.
0x00000002Reverse Flip the image vertically.
0x00000004Rotate90 Rotate the image 90 degrees.
0x00000008Rotate180 Rotate the image 190 degrees.
0x0000000CRotate270 Rotate the image 270 degrees.
Example
C#
Java
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Color; 
using Leadtools.Svg; 
 
 
public void TransformExample() 
{ 
   RasterCodecs codecs = new RasterCodecs(); 
 
   string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp"); 
 
   string destFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1_Transform.cmp"); 
 
 
   // Load the source image with markers 
   Debug.WriteLine("Loading the source image with all markers"); 
   codecs.Options.Load.Markers = true; 
   RasterImage srcImage = codecs.Load(srcFileName); 
 
   // Show the markers loaded, if any 
   Debug.WriteLine("These markers were loaded:"); 
   foreach (RasterMarkerMetadata marker in srcImage.Markers) 
   { 
      byte[] data = marker.GetData(); 
      codecs.WriteMarker(srcFileName, 1, marker); 
      // codecs.WriteMarker(stream, 1, marker); 
      codecs.WriteTransformMarker(marker.Id, data, 0, 1); 
      Debug.WriteLine(" {0}, DataSize:{1}", marker.Id, data.Length); 
   } 
 
   codecs.Transform( 
      srcFileName, 
      destFileName, 
      CodecsTransformFlags.Rotate90, 
      1, 
      CodecsTransformMarkerCallback); 
 
   // Clean up 
   codecs.Dispose(); 
} 
 
CodecsTransformMarkerAction CodecsTransformMarkerCallback(int id, RasterNativeBuffer buffer, CodecsTransformFlags transform) 
{ 
   Debug.WriteLine("Transforming: id: {0}, Data Length: {1}, transform: {2}", id, buffer.Length, transform); 
   return CodecsTransformMarkerAction.Default; 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
 
import java.io.*; 
import java.net.*; 
import java.nio.file.Paths; 
import java.util.*; 
import java.time.Instant; 
import java.time.Duration; 
 
import org.junit.*; 
import org.junit.runner.JUnitCore; 
import org.junit.runner.Result; 
import org.junit.runner.notification.Failure; 
import static org.junit.Assert.*; 
 
import leadtools.*; 
import leadtools.codecs.*; 
import leadtools.codecs.RasterCodecs.FeedCallbackThunk; 
import leadtools.drawing.internal.*; 
import leadtools.imageprocessing.*; 
import leadtools.imageprocessing.color.ChangeIntensityCommand; 
import leadtools.svg.*; 
 
 
RasterCodecs codecs; 
 
public void transformExample() { 
   final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images"; 
   codecs = new RasterCodecs(); 
 
   String srcFileName = combine(LEAD_VARS_IMAGES_DIR, "Image1.cmp"); 
   String destFileName = combine(LEAD_VARS_IMAGES_DIR, "Image1_Transform.cmp"); 
 
   // Load the source image with markers 
   System.out.println("Loading the source image with all markers"); 
   codecs.getOptions().getLoad().setMarkers(true); 
   RasterImage srcImage = codecs.load(srcFileName); 
 
   // Show the markers loaded, if any 
   System.out.println("These markers were loaded:"); 
 
   for (RasterMarkerMetadata marker : srcImage.getMarkers()) { 
      byte[] data = marker.getData(); 
      ILeadStream srcFileStream = LeadStreamFactory.create(srcFileName); 
      codecs.writeMarker(srcFileStream, 1, marker); 
      codecs.transform(srcFileName, destFileName, CodecsTransformFlags.ROTATE_90, 1, CodecsTransformMarkerCallback); 
      System.out.printf(" %s, DataSize:%s%m", marker.getId(), data.length); 
   } 
 
   // Clean up 
   codecs.dispose(); 
} 
 
CodecsTransformMarkerListener CodecsTransformMarkerCallback = new CodecsTransformMarkerListener() { 
 
   @Override 
   public CodecsTransformMarkerAction OnCodecsTransformMarkerCallback(int id, RasterNativeBuffer buffer, 
         CodecsTransformFlags transform) { 
      buffer.getData(); 
      codecs.writeTransformMarker(id, buffer.getData(), 1, 1); 
      System.out.printf("Transforming: id: %s, Data Length: %s, transform: %s%n", id, buffer.getLength(), transform); 
      return CodecsTransformMarkerAction.DEFAULT; 
   } 
 
}; 
Requirements

Target Platforms

See Also

Reference

Leadtools.Codecs Namespace

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

Leadtools.Codecs Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.