Пример #1
0
 public void Init(InputMeta meta)
 {
     style    = meta.ReadWord();
     penWidth = meta.ReadShort();
     meta.ReadWord();
     color = meta.ReadColor();
 }
Пример #2
0
        public void Init(InputMeta meta)
        {
            height = Math.Abs(meta.ReadShort());
            meta.Skip(2);
            angle = (float)(meta.ReadShort() / 1800.0 * Math.PI);
            meta.Skip(2);
            bold      = (meta.ReadShort() >= BOLDTHRESHOLD ? MARKER_BOLD : 0);
            italic    = (meta.ReadByte() != 0 ? MARKER_ITALIC : 0);
            underline = (meta.ReadByte() != 0);
            strikeout = (meta.ReadByte() != 0);
            charset   = meta.ReadByte();
            meta.Skip(3);
            pitchAndFamily = meta.ReadByte();
            byte[] name = new byte[nameSize];
            int    k;

            for (k = 0; k < nameSize; ++k)
            {
                int c = meta.ReadByte();
                if (c == 0)
                {
                    break;
                }
                name[k] = (byte)c;
            }
            try {
                faceName = System.Text.Encoding.GetEncoding(1252).GetString(name, 0, k);
            }
            catch {
                faceName = System.Text.ASCIIEncoding.ASCII.GetString(name, 0, k);
            }
            faceName = faceName.ToLower(System.Globalization.CultureInfo.InvariantCulture);
        }
        public void Init(InputMeta meta)
        {
            _height = Math.Abs(meta.ReadShort());
            meta.Skip(2);
            Angle = (float)(meta.ReadShort() / 1800.0 * Math.PI);
            meta.Skip(2);
            _bold      = (meta.ReadShort() >= BOLDTHRESHOLD ? MARKER_BOLD : 0);
            _italic    = (meta.ReadByte() != 0 ? MARKER_ITALIC : 0);
            _underline = (meta.ReadByte() != 0);
            _strikeout = (meta.ReadByte() != 0);
            var charset = meta.ReadByte();

            meta.Skip(3);
            _pitchAndFamily = meta.ReadByte();
            var name = new byte[nameSize];
            int k;

            for (k = 0; k < nameSize; ++k)
            {
                var c = meta.ReadByte();
                if (c == 0)
                {
                    break;
                }
                name[k] = (byte)c;
            }
            try
            {
                _faceName = EncodingsRegistry.Instance.GetEncoding(1252).GetString(name, 0, k);
            }
            catch
            {
                _faceName = System.Text.Encoding.ASCII.GetString(name, 0, k);
            }
            _faceName = _faceName.ToLowerInvariant();
        }
Пример #4
0
 public void Init(InputMeta meta) {
     style = meta.ReadWord();
     color = meta.ReadColor();
     hatch = meta.ReadWord();
 }
Пример #5
0
 public MetaDo(Stream meta, PdfContentByte cb)
 {
     this.cb   = cb;
     this.meta = new InputMeta(meta);
 }
Пример #6
0
 public MetaDo(Stream meta, PdfContentByte cb)
 {
     this.cb = cb;
     this.meta = new InputMeta(meta);
 }
Пример #7
0
 public MetaDo(Stream meta, PdfContentByte cb)
 {
     Cb   = cb;
     Meta = new InputMeta(meta);
 }
Пример #8
0
 public void Init(InputMeta meta) {
     height = Math.Abs(meta.ReadShort());
     meta.Skip(2);
     angle = (float)(meta.ReadShort() / 1800.0 * Math.PI);
     meta.Skip(2);
     bold = (meta.ReadShort() >= BOLDTHRESHOLD ? MARKER_BOLD : 0);
     italic = (meta.ReadByte() != 0 ? MARKER_ITALIC : 0);
     underline = (meta.ReadByte() != 0);
     strikeout = (meta.ReadByte() != 0);
     charset = meta.ReadByte();
     meta.Skip(3);
     pitchAndFamily = meta.ReadByte();
     byte[] name = new byte[nameSize];
     int k;
     for (k = 0; k < nameSize; ++k) {
         int c = meta.ReadByte();
         if (c == 0) {
             break;
         }
         name[k] = (byte)c;
     }
     try {
         faceName = System.Text.Encoding.GetEncoding(1252).GetString(name, 0, k);
     }
     catch {
         faceName = System.Text.ASCIIEncoding.ASCII.GetString(name, 0, k);
     }
     faceName = faceName.ToLower(System.Globalization.CultureInfo.InvariantCulture);
 }
Пример #9
0
 virtual public void Init(InputMeta meta)
 {
     style = meta.ReadWord();
     color = meta.ReadColor();
     hatch = meta.ReadWord();
 }
Пример #10
0
 public void Init(InputMeta meta)
 {
     style = meta.ReadWord();
     penWidth = meta.ReadShort();
     meta.ReadWord();
     color = meta.ReadColor();
 }
Пример #11
0
 /// <summary>
 /// This method checks if the image is a valid WMF and processes some parameters.
 /// </summary>
 private void ProcessParameters()
 {
     type = Element.IMGTEMPLATE;
     originalType = ORIGINAL_WMF;
     Stream istr = null;
     try {
         string errorID;
         if (rawData == null){
             WebRequest w = WebRequest.Create(url);
             w.Credentials = CredentialCache.DefaultCredentials;
             istr = w.GetResponse().GetResponseStream();
             errorID = url.ToString();
         }
         else{
             istr = new MemoryStream(rawData);
             errorID = "Byte array";
         }
         InputMeta im = new InputMeta(istr);
         if (im.ReadInt() != unchecked((int)0x9AC6CDD7))    {
             throw new BadElementException(MessageLocalization.GetComposedMessage("1.is.not.a.valid.placeable.windows.metafile", errorID));
         }
         im.ReadWord();
         int left = im.ReadShort();
         int top = im.ReadShort();
         int right = im.ReadShort();
         int bottom = im.ReadShort();
         int inch = im.ReadWord();
         dpiX = 72;
         dpiY = 72;
         scaledHeight = (float)(bottom - top) / inch * 72f;
         this.Top =scaledHeight;
         scaledWidth = (float)(right - left) / inch * 72f;
         this.Right = scaledWidth;
     }
     finally {
         if (istr != null) {
             istr.Close();
         }
         plainWidth = this.Width;
         plainHeight = this.Height;
     }
 }
Пример #12
0
 /// <summary>
 /// This method checks if the image is a valid WMF and processes some parameters.
 /// </summary>
 private void ProcessParameters()
 {
     type = Element.IMGTEMPLATE;
     originalType = ORIGINAL_WMF;
     Stream istr = null;
     try {
         string errorID;
         if (rawData == null){
     #if !NETCF
             WebRequest w = WebRequest.Create(url);
             istr = w.GetResponse().GetResponseStream();
             errorID = url.ToString();
     #else
             istr = new FileStream(url.LocalPath, FileMode.Open);
             errorID="NETCF filestream";
     #endif
         }
         else{
             istr = new MemoryStream(rawData);
             errorID = "Byte array";
         }
         InputMeta im = new InputMeta(istr);
         if (im.ReadInt() != unchecked((int)0x9AC6CDD7))    {
             throw new BadElementException(errorID + " is not a valid placeable windows metafile.");
         }
         im.ReadWord();
         int left = im.ReadShort();
         int top = im.ReadShort();
         int right = im.ReadShort();
         int bottom = im.ReadShort();
         int inch = im.ReadWord();
         dpiX = 72;
         dpiY = 72;
         scaledHeight = (float)(bottom - top) / inch * 72f;
         this.Top =scaledHeight;
         scaledWidth = (float)(right - left) / inch * 72f;
         this.Right = scaledWidth;
     }
     finally {
         if (istr != null) {
             istr.Close();
         }
         plainWidth = this.Width;
         plainHeight = this.Height;
     }
 }