LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-01-2015, 01:21 AM   #1
Borneq
Member
 
Registered: Aug 2014
Posts: 36

Rep: Reputation: Disabled
How move bitmaps from memory to screen?


Bitmaps - rather pixmaps, due to X naming. I can request to X11 server CopyArea, but it copy from one screen drawable area to other.
How copy whole memory bitmaps to screen?
For example, I have jpg file or image file of exotic format. I am reading this file to memory and I want display it.
 
Old 12-01-2015, 10:08 AM   #2
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,165

Rep: Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860
You need to get it into a form that X understands ie a Pixmap or Bitmap, have a look at imlib2 as it can import a large number of file types and create a pixmam and mask suitable for use by X, this is a peice of code that does exactly that
Code:
/**
* Set Pixmaps From Path.
* \param display Xlib display.
* \param visual Xlib visual.
* \param cm Xlib colormap.
* \param w Xlib window.
* \param file Path to image file.
* \param image Return address for image pixmap.
* \param mask Return address for image mask.
* \param size Destination size.
* \return true on success or false on fail.
* \note If size=-1 then the size is set from the image file.
*/
bool LFSTK_lib::LFSTK_setPixmapsFromPath(Display *display,Visual *visual,Colormap cm,Window w,const char *file,Pixmap *image,Pixmap *mask,int size)
{
	Imlib_Image	data=NULL;
	int			imagesizew;
	int			imagesizeh;

	if(file==NULL)
		return(false);

	data=imlib_load_image(file);
	if(data!=NULL)
		{
			imlib_context_set_display(display);
			imlib_context_set_visual(visual);
			imlib_context_set_colormap(cm);
			imlib_context_set_drawable(w);
			imlib_context_set_image(data);
			if(size==-1)
				{
					imagesizew=imlib_image_get_width();
					imagesizeh=imlib_image_get_height();
				}
			else
				{
					imagesizew=size;
					imagesizeh=size;
				}
			imlib_render_pixmaps_for_whole_image_at_size(image,mask,imagesizew,imagesizeh);
			imlib_free_image();
			return(true);
		}
	return(false);
}
 
Old 12-01-2015, 10:09 AM   #3
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,165

Rep: Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860Reputation: 860
I think you need to also ask a mod to move this thread to programming.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Remove Alpha Channel from Bitmaps? KillerCode Programming 8 01-01-2011 12:36 AM
How do you change the Novell Bitmaps?? mbjunior99 SUSE / openSUSE 1 10-17-2006 09:54 AM
Problem with X11/bitmaps EAD Linux - Newbie 2 04-28-2006 04:15 AM
LILO Bitmaps Murdock1979 Slackware 3 09-13-2005 04:11 PM
Strange problem reading bitmaps EnigmaX Programming 1 06-25-2005 11:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 09:01 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