# Add Support for Perspective Ellipse in Krita for SoK

Halla Rempt halla at valdyas.org
Wed Jan 19 10:13:51 GMT 2022

```Hi,

Sorry, I've been pretty sick, so I'm now trying to slowly catch up... I've applied as a mentor for your project, so that's settled.

On woensdag 12 januari 2022 12:28:41 CET Srirupa Datta wrote:
> Hey all,
>
> Since Dmitry is on vacation, I am writing here because I needed to clarify
> a few things. I wanted to add support for Perspective Ellipse in Krita as a
> part of Season of KDE.
> The link for the feature request: Circle in a Square
> <https://bugs.kde.org/show_bug.cgi?id=405643>
>
> Now, I wanted to clarify if this is roughly what I would be doing.
>
>
> 1. Create a seperate button on Tools Option Docker for Ellipse Tool.
>

Ah, we need to be careful here: do you mean a new button in the toolbox, or a toggle in the option widget?

> 2. When the perspective ellipse button is clicked, a circle in a square
> figure appears on the canvas, the corners of the squares being adjustable.
> The circle in a square can be moved to the desired location and corners can
> be adjusted. 3. Now when the corners are adjusted, I need to use the
> KisPerspectiveTransformStrategy::continuePrimaryAction() function to get
> the transformation matrix from the four points and use that to transform
> the circle to the corresponding ellipse.

Yes.

> 4. As Halla suggested, this transformation should not transform the pixels,
> so I probably need to look into what other methods are there for
> transforming.

Yes, the stroke should be drawn using the current brush following the (qpainter)path created by the user when manipulating the perspective box.

> 5. As for the mathematical part, I can use the transformation matrix on the
> old circle/ellipse to convert it to the new ellipse, but the KisAlgebra2d::
> transformEllipse() function uses the semimajor and semiminor axes lengths,
> so would it possible to reuse that function by finding the major and minor
> axes?

I don't know -- maths is not my forte.

>
> 6. Also, just to be clear, I am extending the Ellipse Tool, not creating
> another Assistant Tool(there is one Ellipse option in the Assistant Tool as
> well), right?

Yes, that is correct.

>
>
> I have created a draft proposal which was reviewed by Halla earlier. The
> details have been mentioned there. Link: Draft Proposal
>
>
> With regards,
>
> Srirupa Datta
>
> IRC: sriru:matrix.org
>

```