Exemplo n.º 1
0
// --------------------------------------------------------------------------- 
    public void Write(Stream stream) {    
      using (ZipFile zip = new ZipFile()) {
        byte[] circledata = { 
          (byte) 0x3c, (byte) 0x7e, (byte) 0xff, (byte) 0xff, 
          (byte) 0xff, (byte) 0xff, (byte) 0x7e, (byte) 0x3c 
        };
        Image mask = Image.GetInstance(8, 8, 1, 1, circledata);
        mask.MakeMask();
        mask.Inverted = true;
        
        ImageMask im = new ImageMask();
        zip.AddEntry(RESULT1, im.CreatePdf(mask));
        
        byte[] gradient = new byte[256];
        for (int i = 0; i < 256; i++) {
          gradient[i] = (byte) i;
        }
        mask = Image.GetInstance(256, 1, 1, 8, gradient);
        mask.MakeMask();
        im = new ImageMask();
        zip.AddEntry(RESULT2, im.CreatePdf(mask));

        zip.AddFile(RESOURCE, "");
        zip.Save(stream);             
      }
    }
Exemplo n.º 2
0
// ---------------------------------------------------------------------------
        public void Write(Stream stream)
        {
            using (ZipFile zip = new ZipFile()) {
                byte[] circledata =
                {
                    (byte)0x3c, (byte)0x7e, (byte)0xff, (byte)0xff,
                    (byte)0xff, (byte)0xff, (byte)0x7e, (byte)0x3c
                };
                Image mask = Image.GetInstance(8, 8, 1, 1, circledata);
                mask.MakeMask();
                mask.Inverted = true;

                ImageMask im = new ImageMask();
                zip.AddEntry(RESULT1, im.CreatePdf(mask));

                byte[] gradient = new byte[256];
                for (int i = 0; i < 256; i++)
                {
                    gradient[i] = (byte)i;
                }
                mask = Image.GetInstance(256, 1, 1, 8, gradient);
                mask.MakeMask();
                im = new ImageMask();
                zip.AddEntry(RESULT2, im.CreatePdf(mask));

                zip.AddFile(RESOURCE, "");
                zip.Save(stream);
            }
        }