Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » Draw, Display, Images, Bitmaps, Icons » Bug: ImageBuffer::alpha not initialised on X11
Re: Bug: ImageBuffer::alpha not initialised on X11 [message #15589 is a reply to message #15575] Tue, 29 April 2008 19:33 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 14267
Registered: November 2005
Ultimate Member
mrjt wrote on Tue, 29 April 2008 08:34

The alpha channel is not correctly initialised on X11. This causes corruption (second image is what it should look like):
index.php?t=getfile&id=1177&private=0
Everything works correctly for Win32. The code below exibits the problem:
class ImageDrawTest : public TopWindow {
public:
	typedef ImageDrawTest CLASSNAME;
	Image img;
	
	ImageDrawTest() {
		Sizeable();
		GenerateImage();
	}
	
	void GenerateImage() {
		Size sz(100, 100);
		ImageDraw w(sz);
//		w.Alpha().DrawRect(sz, Black());
		w.Alpha().DrawRect(30, 30, 40, 40, White());
		w.DrawRect(sz, Red);
		img = w;
	}
	
	virtual void Paint(Draw &w) {
		w.DrawRect(GetSize(), SColorFace());
		w.DrawImage(0, 0, img);	
	}
	
	virtual void LeftUp(Point p, dword keyflags) {
		GenerateImage();	
		Refresh();
	}
};

If you uncomment the line above, the channel is initialised and everything works correctly.

Edit: Looking at the manual for XCreatePixmap, it says the pixmap contents are undefined, which I guess is fair enough. My main issue here is the inconsistency between Win32/Linux, both should be either defined or undefined.


Well, this is rather missing docs... It was intended to have both "body" and "alpha" uninitialized, the same situation as with e.g. Paint. After all, you never know whether for specific use it is better to have alpha =0 or 255 (or even something else).

OTOH, if you believe it should be initialized, we can do that too.

Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: bug in ImageBuffer::Line() and operator[]
Next Topic: .pcx images [FEATURE REQUEST]
Goto Forum:
  


Current Time: Thu Sep 04 05:37:08 CEST 2025

Total time taken to generate the page: 0.03552 seconds