Beispiel #1
0
        public Image(int width, int height, int format, Pixmap.Format pixmap_format)
        {
            this.width = width;
            this.height = height;
            this.format = format;
            this.pixmap_format = pixmap_format;

            init ();
        }
Beispiel #2
0
        public void init_server_info(Data reply)
        {
            connected     = true;
            release_no    = reply.read4(8);
            resource_base = reply.read4(12);
            resource_mask = reply.read4(16);
            int vendor_length = reply.read2(24);

            extended_maximum_request_length
                = maximum_request_length = reply.read2(26);
            int screen_count        = reply.read1(28);
            int pixmap_format_count = reply.read1(29);

            image_byte_order            = reply.read1(30);
            bitmap_format_bit_order     = reply.read1(31);
            bitmap_format_scanline_unit = reply.read1(32);
            bitmap_format_scanline_pad  = reply.read1(33);

            int min_keycode = reply.read1(34);
            int max_keycode = reply.read1(35);

            input = new Input(this, min_keycode, max_keycode);
            input.keyboard_mapping();

            vendor = reply.read_string(40, vendor_length);

            // pixmap formats
            pixmap_formats = new Pixmap.Format [pixmap_format_count];
            int pixmap_formats_offset = 40 + Data.len(vendor_length);

            for (int i = 0; i < pixmap_format_count; i++)
            {
                pixmap_formats [i] = new Pixmap.Format(
                    reply, pixmap_formats_offset + i * 8);
            }

            // screens

            if (default_screen_no < 0 || default_screen_no >= screen_count)
            {
                throw new Exception("Invalid screen number (screen-count "
                                    + screen_count + "): " + default_screen_no);
            }

            screens = new Screen [screen_count];
            int screen_offset = pixmap_formats_offset + 8 * pixmap_format_count;

            for (int i = 0; i < screen_count; i++)
            {
                screens [i]    = new Screen(this, reply, screen_offset);
                screen_offset += screens [i].Length;
            }
        }
Beispiel #3
0
        public void init_defaults()
        {
            default_screen   = screens [default_screen_no];
            default_root     = default_screen.root(); // before init default_gc
            default_depth    = default_screen.root_depth();
            default_colormap = default_screen.default_colormap();
            default_gc       = default_screen.default_gc();
            default_black    = new Color(default_screen.black_pixel());
            default_white    = new Color(default_screen.white_pixel());

            for (int i = pixmap_formats.Length - 1; i >= 0; i--)
            {
                if (pixmap_formats [i].depth() == default_depth)
                {
                    default_pixmap_format = pixmap_formats [i];
                    break;
                }
            }
        }
Beispiel #4
0
        public void init_server_info(Data reply)
        {
            connected = true;
            release_no = reply.read4 (8);
            resource_base = reply.read4 (12);
            resource_mask = reply.read4 (16);
            int vendor_length = reply.read2 (24);
            extended_maximum_request_length
              = maximum_request_length = reply.read2 (26);
            int screen_count = reply.read1 (28);
            int pixmap_format_count = reply.read1 (29);

            image_byte_order = reply.read1 (30);
            bitmap_format_bit_order = reply.read1 (31);
            bitmap_format_scanline_unit = reply.read1 (32);
            bitmap_format_scanline_pad = reply.read1 (33);

            int min_keycode = reply.read1 (34);
            int max_keycode = reply.read1 (35);
            input = new Input (this, min_keycode, max_keycode);
            input.keyboard_mapping ();

            vendor = reply.read_string (40, vendor_length);

            // pixmap formats
            pixmap_formats = new Pixmap.Format [pixmap_format_count];
            int pixmap_formats_offset = 40 + Data.len (vendor_length);
            for (int i=0; i<pixmap_format_count; i++)
              pixmap_formats [i] = new Pixmap.Format (
            reply, pixmap_formats_offset + i*8);

            // screens

            if (default_screen_no < 0 || default_screen_no >= screen_count)
              throw new Exception ("Invalid screen number (screen-count "
            + screen_count + "): " + default_screen_no);

            screens = new Screen [screen_count];
            int screen_offset = pixmap_formats_offset + 8*pixmap_format_count;
            for (int i=0; i<screen_count; i++) {
              screens [i] = new Screen (this, reply, screen_offset);
              screen_offset += screens [i].Length;
            }
        }
Beispiel #5
0
        public void init_defaults()
        {
            default_screen = screens [default_screen_no];
            default_root = default_screen.root (); // before init default_gc
            default_depth = default_screen.root_depth ();
            default_colormap = default_screen.default_colormap ();
            default_gc = default_screen.default_gc ();
            default_black = new Color (default_screen.black_pixel ());
            default_white = new Color (default_screen.white_pixel ());

            for (int i=pixmap_formats.Length-1; i>=0; i--)
              if (pixmap_formats [i].depth () == default_depth) {
            default_pixmap_format = pixmap_formats [i];
            break;
              }
        }