From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT autolearn=no autolearn_force=no version=3.4.4 Xref: utzoo comp.windows.x:36642 comp.lang.ada:5482 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!zaphod.mps.ohio-state.edu!wuarchive!uunet!sps!cjg From: cjg@sps.com (Christopher J. Graham) Newsgroups: comp.windows.x,comp.lang.ada Subject: help display some bitmaps on X. Keywords: bitmap Message-ID: <300@sps.com> Date: 21 May 91 15:28:52 GMT Followup-To: poster Organization: SPS - Indialantic, FL List-Id: Using Ada bindings, how do I display a bitmap in X. I am using the SAIC Ada-X binding. The bindngs fall map well to the C-Xlib, so Non-Ada readers should understand the code. I cannot set the pixmap to be the bitmap_id in the following code. I get the BadMatch or BadPixmap errors. Any C or Ada example would be helpful. I think it is a simple task, but It isn't working for me. Note there is a real event to exit this program, just the bare bones of the X-Stuff. Thanks, Christopher J. Graham EMail : cjg@sps.com ......Ada Source Code Follows...... WITH x_windows; PROCEDURE hello_world IS display_id : x_windows.display; -- Identifies the physical display; size_hints : x_windows.size_hint_record; -- Identifies the window size hints. parent_window_id : x_windows.window; -- Identifies the Root Window. window_id : x_windows.window; -- Identifies the window's main backdrop. set_window_attributes_id : x_windows.set_window_attributes_record; -- Identifies the window's attributes. wa_mask_type_id : x_windows.wa_mask_type; -- Identifies the window's attributes. user_specified_size_hint_mask_type : CONSTANT x_windows.size_hint_mask_type := x_windows.size_hint_mask_type'( 0 => true, 1 => true, OTHERS => false); -- Size_Hint_Mask_Type for the user window. user_specified_wa_mask_type_for_bitmap : CONSTANT x_windows.wa_mask_type := x_windows.wa_mask_type'( 0 => true, OTHERS => false); -- Wa_Mask_Type for the user bitmap. width : x_windows.pixels := 1; -- Identifies the Pixmap Width. height : x_windows.pixels := 1; -- Identifies the Pixmap Width. depth : x_windows.depth_type := 1; -- Identifies the Pixmap Depth. hot_spot : x_windows.point; -- Identifies the Pixmap Hot_Spot. bitmap_id : x_windows.pixmap; -- Identifies the Identifies the Bitmap. BEGIN -- Get the Display ID. display_id := x_windows.open_display(name => "aviion:0.0"); -- Get the Parent Window ID in order to open the new window. parent_window_id := x_windows.default_root_window(display_id => display_id); -- Set the Bounds and Mask for the New Window. size_hints.bounds.x := 400; size_hints.bounds.y := 400; size_hints.bounds.height := 400; size_hints.bounds.width := 400; size_hints.flags := user_specified_size_hint_mask_type; -- Create The new Window. window_id := x_windows.create_window( display_id => display_id, parent => parent_window_id, bounds => size_hints.bounds, border_width => 4, depth => 0, class => x_windows.input_output, visuals => x_windows.Copy_Visual_From_Parent, value_mask => wa_mask_type_id, attributes => set_window_attributes_id); -- Create the Pixamp used as a Bitmap. bitmap_id := x_windows.create_pixmap( display_id => display_id, drawable_id => window_id, width => width, height => height, depth => 1); -- Read from a file the bitmap to be displayed. x_windows.graphic_output.read_bitmap_file( display_id => display_id, drawable_id => window_id, filename => "test.bm", width => width, height => height, hot_spot => hot_spot, bitmap => bitmap_id, status => status); -- Map the window that was just created. x_windows.map_window( display_id => display_id, window_id => window_id); -- Mark the new window as a Window to be displayed. x_windows.map_raised( display_id => display_id, window_id => window_id); -- Set the Window Attributes User Defined. set_window_attributes_id.background_pixmap := bitmap_id; wa_mask_type_id := user_specified_wa_mask_type_for_bitmap; -- Clear the New Window. x_windows.graphic_output.clear_window( display_id => display_id, window_id => window_id); END hello_world;