[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference bulova::decw_jan-89_to_nov-90

Title:DECWINDOWS 26-JAN-89 to 29-NOV-90
Notice:See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit
Moderator:STAR::VATNE
Created:Mon Oct 30 1989
Last Modified:Mon Dec 31 1990
Last Successful Update:Fri Jun 06 1997
Number of topics:3726
Total number of notes:19516

2592.0. "reading color bitmap files from fortran ? " by BLKPUD::THOMASA (Wow I,ve got a colour ....) Tue Apr 10 1990 10:17

Hi all,   
	Being new to this Xlib party I wonder if anyone can help with a problem
 I'm having	
	What I,m trying to do is:- create a pixmap draw a complex color image to
the pixmap map it to a window and then save the picture in a bitmap file. 
	Then some time later read the bitmap file recreate a window and fill it
with the orriginal color picture.
(vms 5.3-1 decwindows v2.0 fortran 5.4)


	The first bit it easy

	X$create_window
	play with color map
	X$set_window_color_map
	X$copy_area
	x$write_bitmap_file(display,file,pixmap)
	

( bitmap file is created with the "c" statements in it )

later on I try to do

        type *,'reading ...'
        status=x$read_bitmap_file(dpy,win,%descr('bitmap.dat'),wr,hr,
        2       ret_id,xh,yh)
        if (status.ne.x$c_bitmap_success) then
                type *,status
                if (status.eq.x$c_bitmap_open_failed)  type *,'open failed'
                if (status.eq.x$c_bitmap_file_invalid) type *,'file invalid'
                if (status.eq.x$c_bitmap_no_memory)    type *,'no memory'
	        if (status.ne.0) call lib$stop(%val(status))
        end if
        type *,ret_id
        type *,'copy ...'
        call x$copy_area(dpy,ret_id,win,gc,0,0,wr,hr,0,0)
        type *,'map ...'
        call x$map_window(dpy,win)

on running I get .......

 copy ...
X error event received from server:  BadMatch - parameter mismatch
  Failed request major op code 62 (X_CopyArea)
  Failed request minor op code 0 (if applicable)
  ResourceID 0xe00001 in failed request (if applicable)
  Serial number of failed request 37
  Current serial number in output stream 38
%XLIB-E-ERROREVENT, error event received from server
%TRACE-E-TRACEBACK, symbolic stack dump follows
module name     routine name                     line       rel PC    abs PC
     
why is this happening ?

Is it possible to save a color image using x$write_bitmap_file and then 
retrieve it fully later using x$read_bitmap_file ?????


		Thanks all

				Andy				

ps: can anyone suggest a better way to handle the possible read_bitmap_file 
error conditions ?
T.RTitleUserPersonal
Name
DateLines
2592.1almost the same but differentGSRC::WESTVariables don't, Constants aren'tTue Apr 10 1990 11:5837
RE:      <<< Note 2592.0 by BLKPUD::THOMASA "Wow  I,ve got a colour ...." >>>
                   -< reading color bitmap files from fortran ?
 >-


  First...some basic definitions.

  A PIXMAP, like a window is a rectangular raster area on an X workstation
into which apps can draw.  The major characteristics are:

  Width and Height
  Screen
  Depth

  The DEPTH of a pixmap can be of 1 or *more* planes.

  A BITMAP is a lot like a PIXMAP except that its depth is *always* one.  With
a bitmap you can only specify a foreground color and a background color.  They
cannot contain multiple colors.  When you wish to deal with pixmaps then you
have a variety of options to pursue when saving and retrieving them.

  For instance, if you really want to deal with bitmaps then with clever use
of XCopyPlane you could copy each plane of the pixmap to a bitmap and write
out that bitmap.

  You could look into converting the pixmap image to some other data type
such as DDIF, SIXEL, IFF, or even OFF.

  Mind you that this is not trivial but can be done.

  I book that I highly recommend is "Introduction to the X Window System" by
Oliver Jones.  (ISBN 0-13-499997-5  Prentice-Hall).  There is a real good
chapter on Pixmaps, Bitmaps, and Images.

  Hope this provides the necessary insight.

						-=> Jim <=-