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

List:       kde-kimageshop
Subject:    Re: Crash while testing brush settings
From:       Francisco Fernandes <francisco.fernandes.j () gmail ! com>
Date:       2012-09-12 12:59:37
Message-ID: CAFeD8wXhbh2XqnB_ufSLVm2fCcpMduepVcjsAj0x1EGKw9JS9w () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hello again!

Just to inform that I fixed the problem. Now it's possible to see the
preview of the "Pouring" operation of
the brush. I just verify if there is a KisImage and if not just don't add
the annotation. This way it's not possible
to see the "Spread" preview, though. There's no way (at least for now) to
get particles information without
the annotations.

About the absence of debug information, I saw that my distro (Archlinux)
doesn't provide debug packages for KDE
so I'll have to compile everything from scratch with the debug flag.

Anyway, thanks for the help everyone.

Cheers


2012/9/10 Francisco Fernandes <francisco.fernandes.j@gmail.com>

> Hi Lukast!
>
> The problem it's like Boud said: I'm using a weak shared pointer to hold a
> KisImage.
> I tried  your solution, but the crash persisted. Problem is the way
> I hold the particles. I add a "Particle" KisAnnotation to the KisImage.
> Previously, I added these annotations at each call of paintAt(), but it
> was making the brush slow.
> So I added in the end of the process, in the destructor :
>
>
> KisSandPaintOp::~KisSandPaintOp()
> {
>     //Serialize the particles added by the pouring and hold them in an
> annotation
>     QList<Particle *> parts;
>
>     //Retrieve the currently added particles
>     getGrains(parts);
>
>     if(parts.size() > 0){
>
>         QByteArray * b_array = new QByteArray();
>         QDataStream stream(b_array, QIODevice::ReadWrite);
>         for(int i = 0; i < parts.size(); i++){
>             stream << *parts.at(i);
>         }
>
>         /*
>         * Add particles to the "Particle" annotation
>         */
>
>          //m_image is a KisImageWSP
>         if(m_image){
>             m_image->addAnnotation(KisAnnotationSP(new KisAnnotation(
> "Particle",
>                                                                     "Set
> of grains created by the paintop",
>
> *b_array)
>                                                 )
>                                     );
>         }
>     }
>
>     delete m_sandBrush;
> }
>
> I tried to hold directly with a KisAnnotation instead of a KisImageWSP,
> but I can't figure how to
> add the annotation to the image without such reference. There's another
> way to do that without
> a KisImage pointer in the class?
>
>
> 2012/9/3 Lukast dev <lukast.dev@gmail.com>
>
>> > Actually it counts as a KisImage. Since this is the case, what can I do
>> to
>> > make the brush work in the settings widget?
>>
>> I solved this problem in one of my brush engines like this:
>>
>> I needed to know the dimension of the image (widht/height) from KisImage.
>> So I decided that if there is KisImage present, I will use KisImage
>> dimension,
>> otherwise I use some dummy dimension like 1000x1000 or something like
>> that :)
>>
>> Cheers
>> LukasT
>> _______________________________________________
>> kimageshop mailing list
>> kimageshop@kde.org
>> https://mail.kde.org/mailman/listinfo/kimageshop
>>
>
>
>
> --
>
> ____________________________________________________________________________
> Francisco Fernandes (AKA: Chicao)
>
> ..........................................................................................
> Blog: http://pedepinico.blogspot.com
> Identi.ca: http://identi.ca/chicao
> Twitter: http://twitter.com/__chicao
>
> ..........................................................................................
> "Quem de boa vontade carrega o difícil, também carrega o menos difícil..."
> Lao Tsé - Tao Te Ching
>



-- 
____________________________________________________________________________
Francisco Fernandes (AKA: Chicao)
..........................................................................................
Blog: http://pedepinico.blogspot.com
Identi.ca: http://identi.ca/chicao
Twitter: http://twitter.com/__chicao
..........................................................................................
"Quem de boa vontade carrega o difícil, também carrega o menos difícil..."
Lao Tsé - Tao Te Ching

[Attachment #5 (text/html)]

Hello again!<br><br>Just to inform that I fixed the problem. Now it&#39;s possible to \
see the preview of the &quot;Pouring&quot; operation of <br>the brush. I just verify \
if there is a KisImage and if not just don&#39;t add the annotation. This way \
it&#39;s not possible<br> to see the &quot;Spread&quot; preview, though. There&#39;s \
no way (at least for now) to get particles information without <br>the \
annotations.<br><br>About the absence of debug information, I saw that my distro \
(Archlinux) doesn&#39;t provide debug packages for KDE<br> so I&#39;ll have to \
compile everything from scratch with the debug flag.<br><br>Anyway, thanks for the \
help everyone.<br><br>Cheers<br><br><br><div class="gmail_quote">2012/9/10 Francisco \
Fernandes <span dir="ltr">&lt;<a href="mailto:francisco.fernandes.j@gmail.com" \
target="_blank">francisco.fernandes.j@gmail.com</a>&gt;</span><br> <blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">Hi Lukast!<br><br>The problem it&#39;s like Boud said: \
I&#39;m using a weak shared pointer to hold a KisImage.<br>I tried  your solution, \
but the crash persisted. Problem is the way <br> I hold the particles. I add a \
&quot;Particle&quot; KisAnnotation to the KisImage.<br> Previously, I added these \
annotations at each call of paintAt(), but it was making the brush slow. <br>So I \
added in the end of the process, in the destructor \
:<br><br><br>KisSandPaintOp::~KisSandPaintOp()<br>{<br>    //Serialize the particles \
added by the pouring and hold them in an annotation<br>

    QList&lt;Particle *&gt; parts;<br>    <br>    //Retrieve the currently added \
particles<br>    getGrains(parts);<br><br>    if(parts.size() &gt; 0){<br><br>        \
QByteArray * b_array = new QByteArray();<br>        QDataStream stream(b_array, \
QIODevice::ReadWrite);<br>

        for(int i = 0; i &lt; parts.size(); i++){<br>            stream &lt;&lt; *<a \
href="http://parts.at" target="_blank">parts.at</a>(i);<br>        }<br><br>        \
/*<br>        * Add particles to the &quot;Particle&quot; annotation<br>

        */<br><br>         //m_image is a KisImageWSP<br>        if(m_image){<br>     \
m_image-&gt;addAnnotation(KisAnnotationSP(new KisAnnotation( \
&quot;Particle&quot;,<br>                                                             \
&quot;Set of grains created by the paintop&quot;,<br>

                                                                    *b_array)<br>     \
)<br>                                    );<br>        }<br>    }<br><br>    delete \
m_sandBrush;<br>

}<br><br>I tried to hold directly with a KisAnnotation instead of a KisImageWSP, but \
I can&#39;t figure how to<br>add the annotation to the image without such reference. \
There&#39;s another way to do that without <br>a KisImage pointer in the class?<div \
class="HOEnZb"> <div class="h5"><br>
<br><div class="gmail_quote">2012/9/3 Lukast dev <span dir="ltr">&lt;<a \
href="mailto:lukast.dev@gmail.com" \
target="_blank">lukast.dev@gmail.com</a>&gt;</span><br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">

<div>&gt; Actually it counts as a KisImage. Since this is the case, what can I do \
to<br> &gt; make the brush work in the settings widget?<br>
<br>
</div>I solved this problem in one of my brush engines like this:<br>
<br>
I needed to know the dimension of the image (widht/height) from KisImage.<br>
So I decided that if there is KisImage present, I will use KisImage dimension,<br>
otherwise I use some dummy dimension like 1000x1000 or something like that :)<br>
<br>
Cheers<br>
<span><font color="#888888">LukasT<br>
</font></span><div><div>_______________________________________________<br>
kimageshop mailing list<br>
<a href="mailto:kimageshop@kde.org" target="_blank">kimageshop@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/kimageshop" \
target="_blank">https://mail.kde.org/mailman/listinfo/kimageshop</a><br> \
</div></div></blockquote></div><br><br clear="all"><br></div></div><div \
class="HOEnZb"><div class="h5">-- \
<br>____________________________________________________________________________<br>Francisco \
                Fernandes (AKA: Chicao)<br>
..........................................................................................<br>
                
Blog: <a href="http://pedepinico.blogspot.com" \
target="_blank">http://pedepinico.blogspot.com</a><br>Identi.ca: <a \
href="http://identi.ca/chicao" \
target="_blank">http://identi.ca/chicao</a><br>Twitter: <a \
href="http://twitter.com/__chicao" \
target="_blank">http://twitter.com/__chicao</a><br>

..........................................................................................<br>&quot;Quem \
de boa vontade carrega o difícil, também carrega o menos difícil...&quot; Lao Tsé - \
Tao Te Ching<br> </div></div></blockquote></div><br><br clear="all"><br>-- \
<br>____________________________________________________________________________<br>Francisco \
Fernandes (AKA: Chicao)<br>..........................................................................................<br>
                
Blog: <a href="http://pedepinico.blogspot.com" \
target="_blank">http://pedepinico.blogspot.com</a><br>Identi.ca: <a \
href="http://identi.ca/chicao" \
target="_blank">http://identi.ca/chicao</a><br>Twitter: <a \
href="http://twitter.com/__chicao" \
                target="_blank">http://twitter.com/__chicao</a><br>
..........................................................................................<br>&quot;Quem \
de boa vontade carrega o difícil, também carrega o menos difícil...&quot; Lao Tsé - \
Tao Te Ching<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