Bug 129595 - View image with transparent area not clipped correctly
Summary: View image with transparent area not clipped correctly
Status: RESOLVED FIXED
Alias: None
Product: kst
Classification: Applications
Component: general (show other bugs)
Version: 1.x
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kst
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-21 20:30 UTC by Andrew Walker
Modified: 2006-07-06 01:57 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Walker 2006-06-21 20:30:14 UTC
Version:           1.2.1 (using KDE KDE 3.5.0)
Installed from:    Compiled From Sources
OS:                Linux

PROBLEM:
An image object with a transparent area will not always paint correctly

STEPS TO REPRODUCE:
Start Kst
Create a plot with a curve
Add an image object with a transparent region (e.g. kst_advance.png)
Size the image such that individual pixels are clearly visible
Switch to layout mode
Double click on the image
Move the Edit Picture dialog so that it lies over 
     some of the transparent trgion of the image
Hit OK

RESULTS:
The transparent region of the image still shows the dialog

EXPECTED RESULTS:
The transparent region of the image should show the underlying plot
Comment 1 Andrew Walker 2006-07-06 01:49:08 UTC
The problem is that the clipRegion() for the image is being incorrectly returned, because _clipMask is being incorrectly calculated.

In turn _clipMask is incorrectly calculated as KstViewPicture::transparent() is returning false and so the KstViewObject::paintSelf() code is filling in the entire geometry of the image. This results in a clipRegion() which is the entire area of the image, instead of only its non-transparent area.

And finally, this occurs because _iCache is not valid immediately after hitting the Ok button in the edit dialog, so _iCache.hasAlphaBuffer() will return false in such conditions.
Comment 2 Andrew Walker 2006-07-06 01:57:40 UTC
SVN commit 558770 by arwalker:

BUG:129595 Correctly handle transparency of images with alpha buffers

 M  +5 -1      kstviewpicture.cpp  


--- trunk/extragear/graphics/kst/src/libkstapp/kstviewpicture.cpp #558769:558770
@@ -272,7 +272,11 @@
 
 
 bool KstViewPicture::transparent() const {
-  return _iCache.hasAlphaBuffer();
+  if (!_iCache.isNull()) {
+    return _iCache.hasAlphaBuffer();
+  }
+  
+  return _image.hasAlphaBuffer();
 }