Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil

Notices

Reply
 
Thread Tools Search this Thread
Old Yesterday, 05:48 PM   #31
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,849
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by KevinH View Post
So this is a bit of a nasty piece of code that should help improve Sigil!
Why nasty piece of code Kevin? But I have more for you and this time maybe it can help you to find the solution. Open the epub I attach; you'll see two others way to apply svg filters under epub.

The first way is by including the filter in body, as I do for the first image. Now, with the filter included in body, if I change the color there, then the change operates at once. Of course, this is not an economic way to include a svg filter because you need to include in every .xhtml file where you want to apply it.

The second way in by including it in the css stylesheet, inside a class. In this case, I created a class named ".myCustomFilter" and I defined the filter there. But when I apply the class, the filter is not working (watch the second image).

In the third image you see another svg filter, that I defined also in the css stylesheet and that filter works!! I don't know why one filter works and the other doesn't (they should work both). By in this case I think is not a bug of Sigil because I can't see the metal effect filter applied in no place (Chrome, Firefox, Thorium, etc.) when is defined in the css.
Attached Files
File Type: epub SVG_Filter_Test Bis.epub (3.8 KB, 5 views)
RbnJrg is offline   Reply With Quote
Old Yesterday, 05:55 PM   #32
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,849
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by DiapDealer View Post
It's probably not a very satisfying workaround, but this all seems to work (including in an AppImage built with Qt 6.8.2) if you simply embed the svg filter define (from Metal_Filter.svg) in the xhtml of Section0001.xhtml rather than defining it in a separate file.
That is what I said in my previous post to Kevin. If you want to apply the filter to all .xhtml files in an epub, then you need to write the code many times, when in the svg file you only write once. And all programs seem to honor this way to define the filter. The other way to define the filter is including it in the .css stylesheet, but this particular code is not being supported.
RbnJrg is offline   Reply With Quote
Old Yesterday, 06:11 PM   #33
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,906
Karma: 6120478
Join Date: Nov 2009
Device: many
Why not add filter=url(./MetalFilter.svg#metal) as one of the parameters in the Image1.svg file?
KevinH is offline   Reply With Quote
Old Yesterday, 07:45 PM   #34
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,849
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by KevinH View Post
Why not add filter=url(./MetalFilter.svg#metal) as one of the parameters in the Image1.svg file?
When you use the filter attribute directly on an SVG file, the rendering engine attempts to apply the filter as part of the rendering process.

The filter's SourceGraphic and SourceAlpha refer to the contents of the file where the filter is defined. Since the Metal_Filter.svg file only contains the filter definition and no shapes (such as a <path>), the SourceGraphic is empty. It's a "blind" filter that doesn't have a source image to operate on. Therefore, it doesn't generate any results.

For it to work, the filter and the shape must be in the same SVG file. You should need something like:

Spoiler:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
    width="188"
    height="188.00005"
    viewBox="0 0 188 188.00005"
    version="1.1"
    id="svg135"
    xml:space="preserve"
    xmlns="http://www.w3.org/2000/svg"
    xmlns:svg="http://www.w3.org/2000/svg">

    <defs id="defs132">
        <filter id="metal">
            <feGaussianBlur stdDeviation="3" result="blur"/>
            <feSpecularLighting result="spec" in="blur" specularExponent="35" lighting-color="#ccc">
                <fePointLight x="75" y="100" z="200"/>
            </feSpecularLighting>
            <feComposite in="SourceGraphic" in2="spec" operator="arithmetic" k1="0" k2="1" k3="1" k4="0" result="3d_efect"/>
            <feFlood flood-color="#ffff00" result="solid_color"/>
            <feComposite in="solid_color" in2="SourceAlpha" operator="in" result="clipped_color"/>
            <feBlend in="clipped_color" in2="3d_efect" mode="overlay"/>
        </filter>
    </defs>

    <g
        id="layer1"
        transform="translate(-324.31148,-460.62293)">
        <path
            fill="#333" 
            filter="url(#metal)"
            d="m 412.96619,646.87295 c -0.26404,-0.9625 -0.76642,-3.55 -1.1164,-5.75 -0.86094,-5.41195 -3.17588,-12.59078 -6.77181,-21 -10.64158,-24.88573 -36.7796,-48.35304 -63.2665,-56.80213 -3.89031,-1.24098 -15.30727,-3.69787 -17.18366,-3.69787 -0.17399,0 -0.31634,-2.25 -0.31634,-5 0,-2.75 0.14235,-5 0.31634,-5 1.87639,0 13.29335,-2.45689 17.18366,-3.69787 26.4869,-8.44909 52.62492,-31.9164 63.2665,-56.80213 3.59593,-8.40922 5.91087,-15.58805 6.77181,-21 1.19712,-7.52515 1.17545,-7.5 6.46169,-7.5 5.27947,0 5.22223,-0.066 6.5019,7.5 0.92965,5.49656 5.6437,18.87463 8.98865,25.50907 11.38498,22.58113 34.15014,42.636 58.27731,51.33916 3.93185,1.41829 10.09256,3.09135 13.69048,3.7179 l 6.54166,1.13918 v 4.89734 c 0,2.69354 -0.18541,4.89735 -0.41203,4.89735 -0.22662,0 -3.74385,0.63748 -7.81606,1.41662 -27.84018,5.32671 -56.78273,27.80094 -70.28136,54.57431 -3.34495,6.63444 -8.059,20.01251 -8.98865,25.50907 -1.27967,7.56603 -1.22243,7.5 -6.5019,7.5 -3.784,0 -4.97191,-0.38891 -5.34529,-1.75 z"
            id="path1" />
    </g>
</svg>


On the other hand, with the <img> tag, the rendering engine FIRST loads Image1.svg and renders it (so, at this point, the engine already knows the shape and alpha channel of the image). Then, the css filter property tells the engine to take this already rendered image and apply the filter. The filter's SourceGraphic refers to this rendered image and now it works because the filter has a "canvas" to work on.
RbnJrg is offline   Reply With Quote
Old Yesterday, 09:30 PM   #35
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,906
Karma: 6120478
Join Date: Nov 2009
Device: many
This is so strange. I can not see why the .myCustomFilter class version fails and the other one works.

Your original example when unpacked from the epub will not work straight up in Safari either.

So my guess this style attribute filter approach will only work with a limited number of web browsers as well as limited epub3 ebook e-readers.
KevinH is offline   Reply With Quote
Old Yesterday, 10:13 PM   #36
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 8,906
Karma: 6120478
Join Date: Nov 2009
Device: many
Okay, by sheer trial and error, after clearing the web cache, if I use setUrl(QUrl("")); on the QWebEngineView it seems to finally force a full reload of everything.

I need to clean this up a bit and I will commit it to master tomorrow. With these changes your original demo epub will work properly with Qt 6.9.1 and later.

FYI - we still have no plans to update our Windows, AppImage, and MacOS builds to Qt 6.9.1 for the next release as there are still too many outstanding bugs in Qt 6.9.1.
KevinH is offline   Reply With Quote
Old Yesterday, 11:13 PM   #37
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,849
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by KevinH View Post
This is so strange. I can not see why the .myCustomFilter class version fails and the other one works.
I also haven't been able to find the reason why one filter works and the other doesn't. I tried applying it to .png images (filters work on any type of image: SVG, PNG, JPG, etc.) and got the same result: one filter is applied and the other isn't when the filter is defined in a .css sheet.

Quote:
Your original example when unpacked from the epub will not work straight up in Safari either.
Yes, Safari since always has had serious issues with rendering SVG filters. So I'm not surprised this filter doesn't work there.

Quote:
So my guess this style attribute filter approach will only work with a limited number of web browsers as well as limited epub3 ebook e-readers.
Fortunately, the vast majority of epub3 e-readers are based on Readium/Webkit and so far seem to support this kind of complex SVG filters quite well.

Last edited by RbnJrg; Yesterday at 11:20 PM.
RbnJrg is offline   Reply With Quote
Old Yesterday, 11:15 PM   #38
RbnJrg
Wizard
RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.RbnJrg ought to be getting tired of karma fortunes by now.
 
Posts: 1,849
Karma: 8700631
Join Date: Mar 2013
Location: Rosario - Santa Fe - Argentina
Device: Kindle 4 NT
Quote:
Originally Posted by KevinH View Post
Okay, by sheer trial and error, after clearing the web cache, if I use setUrl(QUrl("")); on the QWebEngineView it seems to finally force a full reload of everything.

I need to clean this up a bit and I will commit it to master tomorrow. With these changes your original demo epub will work properly with Qt 6.9.1 and later.
Great, thank you!!

Quote:
FYI - we still have no plans to update our Windows, AppImage, and MacOS builds to Qt 6.9.1 for the next release as there are still too many outstanding bugs in Qt 6.9.1.
No problem That is ok for me.
RbnJrg is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Kindle 4 Cant reach certain buttons issue and opening keyboard issue Thefirebeast KOReader 6 06-26-2021 12:46 AM
issue converting from azw3 to mobi (ccs and font issue) fatkinglet Conversion 3 10-15-2020 10:13 PM
preview vs print preview isalherbo Sigil 7 04-23-2013 03:52 PM
Nook Simple Touch Glowlight - technological issue or quality-control issue? Dr. Drib Barnes & Noble NOOK 1 12-04-2012 01:32 PM
Hyperlinks Issue in NLT Bible (ebook or software issue)? myet01 Kobo Reader 5 07-29-2011 08:47 AM


All times are GMT -4. The time now is 04:39 AM.


MobileRead.com is a privately owned, operated and funded community.