LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-31-2004, 07:11 AM   #1
SciYro
Senior Member
 
Registered: Oct 2003
Location: hopefully not here
Distribution: Gentoo
Posts: 2,038

Rep: Reputation: 51
howto get Xlibs to display pixmap?


erm, this ones been killing me for the last few days: does anyone know how to get a pixmap to be displayed as a background to a window? (whenever i try to do it, it just errors out, some BadMatch error in XCreateWindow ), when i try to copy the pixmap to the window (XCopyPlane) it doesn't display anything (at least not a pixmap i told it to draw)

heres the code I'm using to draw the pixmap
Code:
Pixmap exitpic;
switch (XReadBitmapFile (display, win, "/home/ME/pixmap", &rw, &rh, &exitpic, &rhx, &rhy)) {
			case BitmapSuccess:
				fprintf (stderr, "bitmap in place");
				break;
case BitmapOpenFailed:
        fprintf(stderr, "XReadBitmapFile - could not open file 'icon.bmp'.\n");
        break;
    case BitmapFileInvalid:
        fprintf(stderr,
                "XReadBitmapFile - file  doesn't contain a valid bitmap.\n");
        break;
    case BitmapNoMemory:
        fprintf(stderr, "XReadBitmapFile - not enough memory.\n");
        break;
		}
switch (XCopyPlane (display, exitpic, testwin, gc, 0, 0, 20, 20, 0, 0, 1)) {
		case BadDrawable:
			fprintf (stderr, "drawable");
			break;
		case BadGC:
			fprintf (stderr, "gc");
			break;

		case BadMatch:
			fprintf (stderr, "match");
			break;

		case BadValue:
			fprintf (stderr, "value");
			break;
		default: 
			fprintf (stderr, "hi");
			break;
		}
XFlush(display);
anyways.. heres the part i use when i tried to get it to display as a background (just the needed parts, the rest is the same as at top)
Code:
XSetWindowAttributes swmatt;

swmatt.background_pixmap = exitpic;

Window testwin = XCreateWindow (display, parentwin, 3, 72, 20, 20, 1, CopyFromParent, InputOutput, CopyFromParent, CWBorderPixel|CWEventMask|CWBackPixmap, &swmatt);
anyone here know how to get pixmaps to properly display? (i looked thru every tutorial for Xlibs i could find, none i found showed fully how to get a pixmap to display (at least for the background), and nothing in anything i found helped out so far
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
HowTo: HP Pavilion dv1000 Display resolution Ramanan Linux - Laptop and Netbook 3 11-24-2006 01:36 PM
java - howto display an image and find mouse coords on it? titanium_geek Programming 6 06-04-2005 11:41 AM
howto set pixmap background for window with xlibs SciYro Programming 0 07-26-2004 03:43 PM
aterm -pixmap = bad option breadbin Linux - Software 2 09-25-2002 04:46 PM
GTK toggle button to pixmap verigoth Programming 1 07-22-2002 02:32 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:23 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration