Hi!<br><br>I started fixing the grayscale selections problem yesterday. We've discussed the details of it several times already, so I'll try not to write too much. So, the working solution is the following:<br><br>
1) Every paint device has an additional method paintingColorSpace(). This method tells the painting tools which colorspace they should use for their dabs.<br>2) Some KoCompositeOp's have an ability to work cross-colorspace, that is with the source in one colorspace and the destination in the other. The alpha8 colorspace has such compositeOps. The methods are:<br>
<br>    /**<br>     * Returns true if the composite op can write pixels into the parent<br>     * colorspace from a colorspace \p srcSpace. If this function returns<br>     * true, then a special method<br>     * composite(const ParameterInfo&, const KoColorSpace*)<br>
     * becomes available to the user. Otherwise the CS should be<br>     * converted before calling a usual composite() method<br>     *<br>     * \see composite(const ParameterInfo&, const KoColorSpace*)<br>     */<br>
    virtual bool supportsCrossColorspaceComposition(const KoColorSpace* srcSpace) const;<br><br>    /**<br>     * Composes pixels from any arbitrary colorspace \p srcSpace<br>     * to the destination buffer. It is available only in case<br>
     * supportsCrossColorspaceComposition() returns true<br>     */<br>    virtual void composite(const ParameterInfo& params, const KoColorSpace* srcSpace) const;<br><br>3) The selection nodes still keeps the alpha8 colorspace for their paint devices, but return a grayscale8 colorspace as their painting colorspace. In a result, the bitBlt operation for the dabs will convert the pixels right.<br>
<br>The only trouble I see here is that in all the paintOps I'll have to change device()->colorSpace() to device->paintingColorSpace(), which is quite doable.<br><br>So what do you think of it?<br clear="all"><br>
-- <br>Dmitry Kazakov<br>