I have only tried it on OSX. Maybe it wasn't a platform independent solution. 
Did it not work, even when using your original QImage approach?



On Sep 9, 2012, at 9:06 PM, Manuel Macha <[email protected]> wrote:

> Hi Justen,
> thanks for your reply.
> I've tested your code at work on a CentOS 5 box and unfortunately it doesn't 
> work as expected.
> The artifacts are gone, however the icon is coloured black where I'd expect 
> it to be transparent.
> Not sure if it's worth to further pursue this for what I was planning to do 
> with it.
> Thanks for your help,
> Manuel
> 
> On Mon, Sep 10, 2012 at 5:04 AM, Justin Israel <[email protected]> wrote:
> I think the one line that may fix it would be this:
> 
> painter.setCompositionMode(painter.CompositionMode_Source)
> 
> It tells the painter to just copy the new pixel, without considering the 
> destination pixels alpha. It may related to how the drawEllipse handles the 
> area outside the shape, over the previously drawn transparent pixels
> 
> I didn't need to do it with a pixmap or image first, but then again I am not 
> sure what you will be doing in this paint method beyond this test example:
> 
>       def paint(self, painter, rect, mode, state):
> 
>               painter.setRenderHint(painter.Antialiasing)
>               painter.setCompositionMode(painter.CompositionMode_Source)
> 
>               painter.fillRect(rect, QtCore.Qt.transparent)
> 
>               painter.setPen(QtGui.QPen(QtCore.Qt.red))
>               painter.setBrush(QtGui.QBrush(QtCore.Qt.red))        
>               painter.drawEllipse(rect)  
> 
> 
> 
> On Sep 8, 2012, at 7:35 PM, Manuel Macha wrote:
> 
>> I'm having a hard time figuring out how to best deal with transparencies 
>> using QPainter (PyQt 4.7 on Mac OSX)
>> I'm getting noisy artifacts in transparent areas of my icon which is painted 
>> using a custom QIconEngine class 
>> http://pastebin.com/ES55EeQj
>> 
>> I'm trying to follow the advice in these articles where I explicitly set the 
>> pixelFormat in a pixmap and then fill it with transparency, however I can't 
>> get rid of the artifacts.
>> http://techbase.kde.org/Development/Tutorials/Graphics/Performance
>> http://www.informit.com/articles/article.aspx?p=1174421&seqNum=3
>> 
>> Any help would be greatly appreciated.
>> 
>> 
>> -- 
>> view archives: http://groups.google.com/group/python_inside_maya
>> change your subscription settings: 
>> http://groups.google.com/group/python_inside_maya/subscribe
> 
> -- 
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings: 
> http://groups.google.com/group/python_inside_maya/subscribe
> 
> -- 
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings: 
> http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to