No, test.png was created by Cairo, and then pixel data (which is premultiplied, as I am aware of) was copied to a GDI+ Bitmap and saved. I did this to get an idea of what Cairo was doing internally.<br><br>What I did with this output was tested this out in GIMP to see what effect this &quot;brush&quot; had; this output produced the same streaking in GIMP as it did in my test program, which leads me to believe that Cairo is using these premultiplied values during painting, which it should not be doing, as the white transparency is turning into black.<br>

<br>I don&#39;t have the time at the moment to put together a test app, all I have is my C# painting program, but all it is doing is using some of the basic stuff from Mono.Cairo to draw images onto the form. Here&#39;s what I am doing, in order:<br>

<br>1) Brush is selected from list; an empty Cairo ImageSurface is made to hold the brush image.<br>2) All of the pixels in the bitmap (acquired from DevIL) are iterated though.<br>3) The color values are multiplied by the color selected in the color picker. The alpha from color picker is discarded, and only used later on.<br>

4) Since I am setting pixel data directly, I am multiplying the r, g and b values by the alpha value.<br>5) Data is set to the ARGB integer from said color.<br>6) Drawing, by clicking on the form, is done by getting this brush image, creating a SurfacePattern on the brush, setting its filter to Gaussian, creating a Matrix (for the Scale operation) and scaling it, setting the pattern&#39;s scale, creating context, translating to x/y of mouse, setting source to pattern, PaintWithAlpha on alpha set in the color picker.<br>

<br>I can wrap up my current C# work and put it online if that will work - I don&#39;t know if you can look at that at all, otherwise I&#39;ll put together a C application for it.<br><br>-P<br><br><div class="gmail_quote">

On Fri, Nov 12, 2010 at 4:07 AM, Andrea Canciani <span dir="ltr">&lt;<a href="mailto:ranma42@gmail.com">ranma42@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<div class="im">On Fri, Nov 12, 2010 at 7:24 AM, Paril &lt;<a href="mailto:paril@alteredsoftworks.com">paril@alteredsoftworks.com</a>&gt; wrote:<br>
&gt; Hi there.<br>
&gt;<br>
&gt; I&#39;m writing a small app kind of like Paint, and using images as brushes;<br>
&gt; these images are transparent PNGs with white as the brush color, and the<br>
&gt; color is multiplied in the code to the color selected in a color picker,<br>
&gt; with transparency being applied in PaintWithAlpha.<br>
&gt;<br>
&gt; This problem is generic to cairo and not the API I&#39;m using, hence why I&#39;m<br>
&gt; posting here.<br>
<br>
</div>Could you provide a small C program reproducing the problem?<br>
(The one using circle.png to generate test.png would be good)<br>
<div class="im"><br>
&gt;<br>
&gt; Because cairo pre-multiplies the colors, it is obvious to expect that any<br>
&gt; transparency would be multiplied into black; this makes sense to me,<br>
&gt; however, with my understanding of pre-multiplied alpha, it is un-multiplied<br>
&gt; by the rendering API so that it renders alpha properly. This appears not to<br>
&gt; be the case, as all of my images render with an ugly black outline which<br>
&gt; destroys alpha blending and creates &quot;streaks&quot; across the program.<br>
&gt;<br>
&gt; Here is the image being used as a brush, and the image that is outputted by<br>
&gt; Cairo after loading:<br>
&gt; <a href="http://alteredsoftworks.com/cairo/circle.png" target="_blank">http://alteredsoftworks.com/cairo/circle.png</a><br>
&gt; <a href="http://alteredsoftworks.com/cairo/test.png" target="_blank">http://alteredsoftworks.com/cairo/test.png</a><br>
&gt;<br>
&gt; Does anyone have any experience with this sort of issue that they can tell<br>
&gt; me what the problem is or how to combat it?<br>
<br>
</div>If you are accessing the image data directly, you have to handle it as<br>
premultiplied.<br>
<br>
In particular from the images you provided, my guess is that test.png was<br>
not generated using cairo png API (which unpremultiplies the data before<br>
storing it in the png file).<br>
<font color="#888888"><br>
Andrea<br>
</font></blockquote></div><br>