Exemple #1
0
        //throws gnu.x11.extension.NotFoundException {
        public Blend(String [] args)
            : base(args, 255, 255)
        {
            about ("0.1", "test blending in RENDER",
              "Stephen Tse <*****@*****.**>",
              "http://escher.sourceforge.net/");

            if (help_option) return;

            render = new Render (display);
            Picture.Format pf0 = new Picture.Format (), pf1;
            Picture.Format.Direct df = pf0.direct_format ();

            alpha_pixmap = new Pixmap (window, window.width, window.height, 8);
            color_pixmap = new Pixmap (window, 1, 1, 24);
            alpha_gc = new GC (alpha_pixmap);
            color_gc = new GC (color_pixmap);

            // window picture (TODO: find visual)
            pf0.clear ();
            pf0.set_depth (display.default_screen.root_depth ());
            pf1 = render.picture_format (pf0, true);

            window_picture = render.create_picture (window, pf1,
              Picture.Attributes.EMPTY);

            // alpha picture
            pf0.clear ();
            pf0.set_depth (8);
            pf0.set_type (Picture.Format.Direct.TYPE);
            df.set_alpha (0);
            df.set_alpha_mask (0xff);
            pf1 = render.picture_format (pf0, true);

            alpha_picture = render.create_picture (alpha_pixmap, pf1,
              Picture.Attributes.EMPTY);

            // color picture
            pf0.clear ();
            pf0.set_depth (24);
            pf0.set_type (Picture.Format.Direct.TYPE);
            df.set_alpha (0);
            df.set_alpha_mask (0);
            df.set_red (16);
            df.set_red_mask (0xff);
            df.set_green (8);
            df.set_green_mask (0xff);
            df.set_blue (0);
            df.set_blue_mask (0xff);
            pf1 = render.picture_format (pf0, true);

            Picture.Attributes attr = new Picture.Attributes ();
            attr.set_repeat (true);
            color_picture = render.create_picture (color_pixmap, pf1, attr);
        }
Exemple #2
0
        // render opcode 17 - create glyph set

        /**
         * @see <a href="XRenderCreateGlyphSet.html">XRenderCreateGlyphSet</a>
         */
        public GlyphSet(Render render, Picture.Format format)
            : base(render.display)
        {
            this.render = render;

            Request request = new Request(display, render.major_opcode, 17, 3);

            request.write4(id);
            request.write4(format.id());
            display.send_request(request);
        }
Exemple #3
0
        /**
         * @see <a href="XRenderFindFormat.html">XRenderFindFormat</a>
         */
        public Picture.Format picture_format(Picture.Format template,
                                             bool must)
        {
            Picture.Format [] pfs = picture_formats();
            for (int i = 0; i < pfs.Length; i++)
            {
                if (pfs [i].match(template))
                {
                    return(pfs [i]);
                }
            }

            if (!must)
            {
                return(null);
            }
            throw new Error("No matching: " + template);
        }
Exemple #4
0
        // render opcode 1 - query picture formats
        public Picture.Format [] picture_formats()
        {
            if (picture_formats_cache != null)
            {
                return(picture_formats_cache);
            }

            Request request = new Request(display, major_opcode, 1, 1);
            Data    reply   = display.read_reply(request);
            int     count   = reply.read4(8);

            Picture.Format [] pfs = new Picture.Format [count];
            for (int i = 0, offset = 32; i < count; i++)
            {
                pfs [i] = new Picture.Format(reply, offset);
                offset += Picture.Format.LENGTH;
            }

            picture_formats_cache = pfs;
            return(pfs);
        }
Exemple #5
0
 /**
  * @see Picture#Picture(Render, Drawable, Picture.Format, Picture.Attributes)
  */
 public Picture create_picture(Drawable drawable, Picture.Format format,
                               Picture.Attributes attr)
 {
     return(new Picture(this, drawable, format, attr));
 }
Exemple #6
0
        // render opcode 1 - query picture formats
        public Picture.Format[] picture_formats()
        {
            if (picture_formats_cache != null)
              return picture_formats_cache;

            Request request = new Request (display, major_opcode, 1, 1);
            Data reply = display.read_reply (request);
            int count = reply.read4 (8);

            Picture.Format [] pfs = new Picture.Format [count];
            for (int i=0, offset=32; i<count; i++) {
              pfs [i] = new Picture.Format (reply, offset);
              offset += Picture.Format.LENGTH;
            }

            picture_formats_cache = pfs;
            return pfs;
        }