Exemplo n.º 1
0
 /// <summary>Update original image with Raw Image parameters.</summary>
 /// <param name="image">to update its parameters with Raw Image parameters.</param>
 /// <param name="width">the exact width of the image</param>
 /// <param name="height">the exact height of the image</param>
 /// <param name="components">1,3 or 4 for GrayScale, RGB and CMYK</param>
 /// <param name="bpc">bits per component. Must be 1,2,4 or 8</param>
 /// <param name="data">the image data</param>
 protected internal static void UpdateRawImageParameters(RawImageData image, int width, int height, int components
                                                         , int bpc, byte[] data)
 {
     image.SetHeight(height);
     image.SetWidth(width);
     if (components != 1 && components != 3 && components != 4)
     {
         throw new iText.IO.IOException(iText.IO.IOException.ComponentsMustBe1_3Or4);
     }
     if (bpc != 1 && bpc != 2 && bpc != 4 && bpc != 8)
     {
         throw new iText.IO.IOException(iText.IO.IOException.BitsPerComponentMustBe1_2_4or8);
     }
     image.SetColorSpace(components);
     image.SetBpc(bpc);
     image.data = data;
 }
Exemplo n.º 2
0
 protected internal static void UpdateCcittImageParameters(RawImageData image, int width, int height, bool
                                                           reverseBits, int typeCcitt, int parameters, byte[] data)
 {
     if (typeCcitt != RawImageData.CCITTG4 && typeCcitt != RawImageData.CCITTG3_1D && typeCcitt != RawImageData
         .CCITTG3_2D)
     {
         throw new iText.IO.IOException(iText.IO.IOException.CcittCompressionTypeMustBeCcittg4Ccittg3_1dOrCcittg3_2d
                                        );
     }
     if (reverseBits)
     {
         TIFFFaxDecoder.ReverseBits(data);
     }
     image.SetHeight(height);
     image.SetWidth(width);
     image.SetColorSpace(parameters);
     image.SetTypeCcitt(typeCcitt);
     image.data = data;
 }