Ugh... Qt4 porting

Zack Rusin zrusin at trolltech.com
Mon May 16 20:20:08 BST 2005


On Monday 16 May 2005 12:58, Mosfet wrote:
> > And Lars pointed out, if you convert back and forth anyway then
> > 8bit precision is not enough in the first place.
>
> Which is why it doesn't work and should be unsupported and not
> converted...

Of course it does. What do you think happens when your image gets to the 
X server? Magic? Server magically converts the depth of the display to 
match your image? And guess what XRender uses...

> Tell that to someone using KImageEffect for an image editor.

Well, that would be no one.

> Again, wrong. It's sometimes quite useful to be able to index by row
> and column. For example, interpolation: This uses an inline class
> that takes the pixel at any position and interpolates it with it's
> neighbors. It's faster to use a jump table, taking a one time hit,
> and then a double array index than it is to do pointer arithmetic for
> each pixel.

That's a) not really true and b) you have access to both scanLine() and 
bits() so you can easily do this.

> Your the KImageEffect maintainer - you port it. 

I think I already posted an email to this list explaining what's going 
to happen with it.

> First premultiplying the pixels doesn't matter to graphics
> algorithms. I point out it does. Then it matters but is easy to write
> two versions of everything. Then it's pointed out converting the
> pixels will loose color resolution. Then it's said that's okay but
> your crazy if you think people are going to be okay with their image
> editors truncating colors. On other topics I point out it's useful to
> construct an image then create it later, and I'm told I'm wrong. I
> point out jumptables are useful and I'm told I'm wrong. Stuff that
> total is probably less than 20 lines in QImage,
>
> Screw this crap.

heh, this not a drama class. In case you haven't figured it out by now, 
I don't do drama. If you need emotional support find an appropriate 
group. With me you can either have a technical discussion or stop 
wasting my time. If you don't like premultiplied alpha, don't use it. 
QImage will not revert to anything else because it does not make sense 
to optimize a class for one percent of users (looking at kimageeffect 
uses possibly less). And again create doesn't make any sense, qimage is 
now shared. Besides:
QImage img;....
//img.isNull() == true
img = QImage(320,200, QImage::Format_ARGB32); //created here
// load it
uchar *bits = img.bits();
//offset in whatever way you want
gives you exactly what you want. A null QImage, that is created later, 
doesn't use premultiplied alpha and allows you to jump wherever you 
want. There you have everything you wanted. 

Zack

-- 
Question authority! Yeah, says who?




More information about the kde-core-devel mailing list