From: cjg@sps.com (Christopher J. Graham)
Subject: help display some bitmaps on X.
Date: 21 May 91 15:28:52 GMT [thread overview]
Message-ID: <300@sps.com> (raw)
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;
reply other threads:[~1991-05-21 15:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox