[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-kimageshop
Subject:    Re: Patch: Many composite/blend modes mostly compatible to Adobe
From:       Sven Langkamp <sven.langkamp () gmail ! com>
Date:       2011-01-28 21:52:19
Message-ID: AANLkTimV1y2uESivXC-PBHcX_9+zpSpC=w2wBYKe1Z8Z () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Wed, Jan 12, 2011 at 11:17 PM, Silvio Heinrich <plassy@web.de> wrote:

>  Phew... I think I've gone a bit mad with the blending modes :D.
> I added a few. When counting everything together there should be nearly 40
> compositing modes now.
> All modes should trait partly transparent layers as Photoshop is doing it
> and all modes should
> respect the channel flags.
> But there are two problems with this patch:
>
> 1. I used a pretty generic approach. So it relies on the compiler to do
> proper inlining. And i didn't use the optimized multiply functions. I had a
> few problems with those functions, because it seems the give no correct
> results but approximations. So I still need to check out which composite
> modes will work with the optimized functions. I just want to say that it
> could be that this is a bit/much slower then the current implementation (i
> don't know how much time you spend in optimizing this).
> I personally haven't noticed any speed impact but I've got a 3GHz quad
> core, so i think i will be the last
> who will notice this.
>
> 2. The "Hue" and "Saturation" modes are not working correctly but the
> "Luminosity" and "Color" modes work exactly as in Photoshop. I coded the
> algorithms after the ISO 3200-1 spec. Adobe released the texts they gave to
> the ISO committee for specification. You can find them here:
> http://www.adobe.com/devnet/pdf.html
>
> http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf
> (direct link)
>
> go to the category "Transparency" -> "Basic Composition Computations". This
> spec is of course for PDFs but it seems that Photoshop uses the same
> formulas.
> Since "Luminosity" and "Color" modes are working i think i made some
> mistake in implementing the
> "setSat" function (on page 327). Maybe someone else has an enlightenment,
> because I'm working in the dark right now :D.
>
>  But apart from this two problems everything else should work fine
> (hopefully).
>
>
>
I tried to build the branch but I get this error:
Linking CXX shared library
../../lib/libpigmentcms.so

CMakeFiles/pigmentcms.dir/colorspaces/KoLabColorSpace.o: In function
`unsigned short cfVividLight<unsigned short>(unsigned short, unsigned
short)':
KoLabColorSpace.cpp:(.text._Z12cfVividLightItET_S0_S0_[unsigned short
cfVividLight<unsigned short>(unsigned short, unsigned short)]+0x31):
undefined reference to `KoColorSpaceMathsTraits<unsigned short>::unitValue'
KoLabColorSpace.cpp:(.text._Z12cfVividLightItET_S0_S0_[unsigned short
cfVividLight<unsigned short>(unsigned short, unsigned short)]+0x3d):
undefined reference to `KoColorSpaceMathsTraits<unsigned short>::zeroValue'
KoLabColorSpace.cpp:(.text._Z12cfVividLightItET_S0_S0_[unsigned short
cfVividLight<unsigned short>(unsigned short, unsigned short)]+0xb3):
undefined reference to `KoColorSpaceMathsTraits<unsigned short>::zeroValue'
KoLabColorSpace.cpp:(.text._Z12cfVividLightItET_S0_S0_[unsigned short
cfVividLight<unsigned short>(unsigned short, unsigned short)]+0xbf):
undefined reference to `KoColorSpaceMathsTraits<unsigned short>::unitValue'
CMakeFiles/pigmentcms.dir/colorspaces/KoLabColorSpace.o: In function
`unsigned short cfDivide<unsigned short>(unsigned short, unsigned short)':
KoLabColorSpace.cpp:(.text._Z8cfDivideItET_S0_S0_[unsigned short
cfDivide<unsigned short>(unsigned short, unsigned short)]+0x25): undefined
reference to `KoColorSpaceMathsTraits<unsigned short>::zeroValue'
KoLabColorSpace.cpp:(.text._Z8cfDivideItET_S0_S0_[unsigned short
cfDivide<unsigned short>(unsigned short, unsigned short)]+0x31): undefined
reference to `KoColorSpaceMathsTraits<unsigned short>::unitValue'
CMakeFiles/pigmentcms.dir/colorspaces/KoLabColorSpace.o: In function
`unsigned short cfArcTangent<unsigned short>(unsigned short, unsigned
short)':
KoLabColorSpace.cpp:(.text._Z12cfArcTangentItET_S0_S0_[unsigned short
cfArcTangent<unsigned short>(unsigned short, unsigned short)]+0x25):
undefined reference to `KoColorSpaceMathsTraits<unsigned short>::zeroValue'
KoLabColorSpace.cpp:(.text._Z12cfArcTangentItET_S0_S0_[unsigned short
cfArcTangent<unsigned short>(unsigned short, unsigned short)]+0x31):
undefined reference to `KoColorSpaceMathsTraits<unsigned short>::unitValue'
CMakeFiles/pigmentcms.dir/colorspaces/KoRgbU8ColorSpace.o: In function
`unsigned char cfVividLight<unsigned char>(unsigned char, unsigned char)':
KoRgbU8ColorSpace.cpp:(.text._Z12cfVividLightIhET_S0_S0_[unsigned char
cfVividLight<unsigned char>(unsigned char, unsigned char)]+0x27): undefined
reference to `KoColorSpaceMathsTraits<unsigned char>::unitValue'
KoRgbU8ColorSpace.cpp:(.text._Z12cfVividLightIhET_S0_S0_[unsigned char
cfVividLight<unsigned char>(unsigned char, unsigned char)]+0x33): undefined
reference to `KoColorSpaceMathsTraits<unsigned char>::zeroValue'
KoRgbU8ColorSpace.cpp:(.text._Z12cfVividLightIhET_S0_S0_[unsigned char
cfVividLight<unsigned char>(unsigned char, unsigned char)]+0x97): undefined
reference to `KoColorSpaceMathsTraits<unsigned char>::zeroValue'
KoRgbU8ColorSpace.cpp:(.text._Z12cfVividLightIhET_S0_S0_[unsigned char
cfVividLight<unsigned char>(unsigned char, unsigned char)]+0xa3): undefined
reference to `KoColorSpaceMathsTraits<unsigned char>::unitValue'
CMakeFiles/pigmentcms.dir/colorspaces/KoRgbU8ColorSpace.o: In function
`unsigned char cfDivide<unsigned char>(unsigned char, unsigned char)':
KoRgbU8ColorSpace.cpp:(.text._Z8cfDivideIhET_S0_S0_[unsigned char
cfDivide<unsigned char>(unsigned char, unsigned char)]+0x21): undefined
reference to `KoColorSpaceMathsTraits<unsigned char>::zeroValue'
KoRgbU8ColorSpace.cpp:(.text._Z8cfDivideIhET_S0_S0_[unsigned char
cfDivide<unsigned char>(unsigned char, unsigned char)]+0x2d): undefined
reference to `KoColorSpaceMathsTraits<unsigned char>::unitValue'
CMakeFiles/pigmentcms.dir/colorspaces/KoRgbU8ColorSpace.o: In function
`unsigned char cfArcTangent<unsigned char>(unsigned char, unsigned char)':
KoRgbU8ColorSpace.cpp:(.text._Z12cfArcTangentIhET_S0_S0_[unsigned char
cfArcTangent<unsigned char>(unsigned char, unsigned char)]+0x21): undefined
reference to `KoColorSpaceMathsTraits<unsigned char>::zeroValue'
KoRgbU8ColorSpace.cpp:(.text._Z12cfArcTangentIhET_S0_S0_[unsigned char
cfArcTangent<unsigned char>(unsigned char, unsigned char)]+0x2d): undefined
reference to `KoColorSpaceMathsTraits<unsigned char>::unitValue'
collect2: ld returned 1 exit status
make[2]: *** [lib/libpigmentcms.so.8.0.0] Fehler 1
make[1]: *** [libs/pigment/CMakeFiles/pigmentcms.dir/all] Fehler 2
make: *** [all] Fehler 2

[Attachment #5 (text/html)]

<div class="gmail_quote">On Wed, Jan 12, 2011 at 11:17 PM, Silvio Heinrich <span \
dir="ltr">&lt;<a href="mailto:plassy@web.de">plassy@web.de</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 bgcolor="#ffffff" text="#000000">
    Phew... I think I&#39;ve gone a bit mad with the blending modes :D.<br>
    I added a few. When counting everything together there should be
    nearly 40 compositing modes now.<br>
    All modes should trait partly transparent layers as Photoshop is
    doing it and all modes should<br>
    respect the channel flags.<br>
    But there are two problems with this patch:<br>
    <br>
    1. I used a pretty generic approach. So it relies on the compiler to
    do proper inlining. And i didn&#39;t use the optimized multiply
    functions. I had a few problems with those functions, because it
    seems the give no correct results but approximations. So I still
    need to check out which composite modes will work with the optimized
    functions. I just want to say that it could be that this is a
    bit/much slower then the current implementation (i don&#39;t know how
    much time you spend in optimizing this).<br>
    I personally haven&#39;t noticed any speed impact but I&#39;ve got a 3GHz
    quad core, so i think i will be the last<br>
    who will notice this.<br>
    <br>
    2. The &quot;Hue&quot; and &quot;Saturation&quot; modes are not working correctly \
but  the &quot;Luminosity&quot; and &quot;Color&quot; modes work exactly as in \
Photoshop. I  coded the algorithms after the ISO 3200-1 spec. Adobe released the
    texts they gave to the ISO committee for specification. You can find
    them here:<br>
    <a href="http://www.adobe.com/devnet/pdf.html" \
target="_blank">http://www.adobe.com/devnet/pdf.html</a><br>  <a \
href="http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf" \
target="_blank">http://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf</a> \
  (direct link)<br>
    <br>
    go to the category &quot;Transparency&quot; -&gt; &quot;Basic Composition
    Computations&quot;. This spec is of course for PDFs but it seems that
    Photoshop uses the same formulas.<br>
    Since &quot;Luminosity&quot; and &quot;Color&quot; modes are working i think i \
made some  mistake in implementing the<br>
    &quot;setSat&quot; function (on page 327). Maybe someone else has an
    enlightenment, because I&#39;m working in the dark right now :D.<br>
    <br>
     But apart from this two problems everything else should work fine
    (hopefully).<span style="border-collapse: separate; color: rgb(0, 0, 0); \
font-family: Ubuntu; font-size: 16px; font-style: normal; font-variant: normal; \
font-weight: normal; letter-spacing: normal; line-height: normal; text-indent: 0px; \
text-transform: none; white-space: normal; word-spacing: 0px;"><span style="color: \
rgb(51, 51, 51); font-family: myriad-pro-1,myriad-pro-2,Helvetica,Arial,sans-serif; \
font-size: 12px; line-height: 16px;"></span></span>  </div>

<br>
<br></blockquote></div><br>I tried to build the branch but I get this \
error:<br>Linking CXX shared library ../../lib/libpigmentcms.so                       \
                <br>
CMakeFiles/pigmentcms.dir/colorspaces/KoLabColorSpace.o: In function `unsigned short \
cfVividLight&lt;unsigned short&gt;(unsigned short, unsigned short)&#39;:              \
<br>KoLabColorSpace.cpp:(.text._Z12cfVividLightItET_S0_S0_[unsigned short \
cfVividLight&lt;unsigned short&gt;(unsigned short, unsigned short)]+0x31): undefined \
reference to `KoColorSpaceMathsTraits&lt;unsigned short&gt;::unitValue&#39;<br> \
KoLabColorSpace.cpp:(.text._Z12cfVividLightItET_S0_S0_[unsigned short \
cfVividLight&lt;unsigned short&gt;(unsigned short, unsigned short)]+0x3d): undefined \
reference to `KoColorSpaceMathsTraits&lt;unsigned short&gt;::zeroValue&#39;<br> \
KoLabColorSpace.cpp:(.text._Z12cfVividLightItET_S0_S0_[unsigned short \
cfVividLight&lt;unsigned short&gt;(unsigned short, unsigned short)]+0xb3): undefined \
reference to `KoColorSpaceMathsTraits&lt;unsigned short&gt;::zeroValue&#39;<br> \
KoLabColorSpace.cpp:(.text._Z12cfVividLightItET_S0_S0_[unsigned short \
cfVividLight&lt;unsigned short&gt;(unsigned short, unsigned short)]+0xbf): undefined \
                reference to `KoColorSpaceMathsTraits&lt;unsigned \
                short&gt;::unitValue&#39;<br>
CMakeFiles/pigmentcms.dir/colorspaces/KoLabColorSpace.o: In function `unsigned short \
cfDivide&lt;unsigned short&gt;(unsigned short, unsigned \
short)&#39;:<br>KoLabColorSpace.cpp:(.text._Z8cfDivideItET_S0_S0_[unsigned short \
cfDivide&lt;unsigned short&gt;(unsigned short, unsigned short)]+0x25): undefined \
reference to `KoColorSpaceMathsTraits&lt;unsigned short&gt;::zeroValue&#39;<br> \
KoLabColorSpace.cpp:(.text._Z8cfDivideItET_S0_S0_[unsigned short cfDivide&lt;unsigned \
short&gt;(unsigned short, unsigned short)]+0x31): undefined reference to \
                `KoColorSpaceMathsTraits&lt;unsigned short&gt;::unitValue&#39;<br>
CMakeFiles/pigmentcms.dir/colorspaces/KoLabColorSpace.o: In function `unsigned short \
cfArcTangent&lt;unsigned short&gt;(unsigned short, unsigned \
short)&#39;:<br>KoLabColorSpace.cpp:(.text._Z12cfArcTangentItET_S0_S0_[unsigned short \
cfArcTangent&lt;unsigned short&gt;(unsigned short, unsigned short)]+0x25): undefined \
reference to `KoColorSpaceMathsTraits&lt;unsigned short&gt;::zeroValue&#39;<br> \
KoLabColorSpace.cpp:(.text._Z12cfArcTangentItET_S0_S0_[unsigned short \
cfArcTangent&lt;unsigned short&gt;(unsigned short, unsigned short)]+0x31): undefined \
                reference to `KoColorSpaceMathsTraits&lt;unsigned \
                short&gt;::unitValue&#39;<br>
CMakeFiles/pigmentcms.dir/colorspaces/KoRgbU8ColorSpace.o: In function `unsigned char \
cfVividLight&lt;unsigned char&gt;(unsigned char, unsigned \
char)&#39;:<br>KoRgbU8ColorSpace.cpp:(.text._Z12cfVividLightIhET_S0_S0_[unsigned char \
cfVividLight&lt;unsigned char&gt;(unsigned char, unsigned char)]+0x27): undefined \
reference to `KoColorSpaceMathsTraits&lt;unsigned char&gt;::unitValue&#39;<br> \
KoRgbU8ColorSpace.cpp:(.text._Z12cfVividLightIhET_S0_S0_[unsigned char \
cfVividLight&lt;unsigned char&gt;(unsigned char, unsigned char)]+0x33): undefined \
reference to `KoColorSpaceMathsTraits&lt;unsigned char&gt;::zeroValue&#39;<br> \
KoRgbU8ColorSpace.cpp:(.text._Z12cfVividLightIhET_S0_S0_[unsigned char \
cfVividLight&lt;unsigned char&gt;(unsigned char, unsigned char)]+0x97): undefined \
reference to `KoColorSpaceMathsTraits&lt;unsigned char&gt;::zeroValue&#39;<br> \
KoRgbU8ColorSpace.cpp:(.text._Z12cfVividLightIhET_S0_S0_[unsigned char \
cfVividLight&lt;unsigned char&gt;(unsigned char, unsigned char)]+0xa3): undefined \
                reference to `KoColorSpaceMathsTraits&lt;unsigned \
                char&gt;::unitValue&#39;<br>
CMakeFiles/pigmentcms.dir/colorspaces/KoRgbU8ColorSpace.o: In function `unsigned char \
cfDivide&lt;unsigned char&gt;(unsigned char, unsigned \
char)&#39;:<br>KoRgbU8ColorSpace.cpp:(.text._Z8cfDivideIhET_S0_S0_[unsigned char \
cfDivide&lt;unsigned char&gt;(unsigned char, unsigned char)]+0x21): undefined \
reference to `KoColorSpaceMathsTraits&lt;unsigned char&gt;::zeroValue&#39;<br> \
KoRgbU8ColorSpace.cpp:(.text._Z8cfDivideIhET_S0_S0_[unsigned char \
cfDivide&lt;unsigned char&gt;(unsigned char, unsigned char)]+0x2d): undefined \
                reference to `KoColorSpaceMathsTraits&lt;unsigned \
                char&gt;::unitValue&#39;<br>
CMakeFiles/pigmentcms.dir/colorspaces/KoRgbU8ColorSpace.o: In function `unsigned char \
cfArcTangent&lt;unsigned char&gt;(unsigned char, unsigned \
char)&#39;:<br>KoRgbU8ColorSpace.cpp:(.text._Z12cfArcTangentIhET_S0_S0_[unsigned char \
cfArcTangent&lt;unsigned char&gt;(unsigned char, unsigned char)]+0x21): undefined \
reference to `KoColorSpaceMathsTraits&lt;unsigned char&gt;::zeroValue&#39;<br> \
KoRgbU8ColorSpace.cpp:(.text._Z12cfArcTangentIhET_S0_S0_[unsigned char \
cfArcTangent&lt;unsigned char&gt;(unsigned char, unsigned char)]+0x2d): undefined \
                reference to `KoColorSpaceMathsTraits&lt;unsigned \
                char&gt;::unitValue&#39;<br>
collect2: ld returned 1 exit status<br>make[2]: *** [lib/libpigmentcms.so.8.0.0] \
Fehler 1<br>make[1]: *** [libs/pigment/CMakeFiles/pigmentcms.dir/all] Fehler \
2<br>make: *** [all] Fehler 2<br><br>



_______________________________________________
kimageshop mailing list
kimageshop@kde.org
https://mail.kde.org/mailman/listinfo/kimageshop


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic