Opened 3 years ago

Closed 2 years ago

#54 closed defect (fixed)

GrafX2 unable to draw even width ellipses/circles

Reported by: pixeloutlaw@… Owned by: Thomas Bernard
Priority: major Milestone: 2.5
Component: GrafX2 Version: 2.4
Keywords: ellipse circle Cc:


It seems that GrafX2 is unable to easily draw even width/height ellipses and circles. Traditionally these are handled with defining a rectangle the ellipse is inscribed within. However, since the interface asks for a center point and radius, the width of circles will always be odd. My proposal is to add a modifier button to the circle and ellipse drawing options to define a rectangle should the user want an even width shape then roll that into the help menu documentation so people know about it.

The screen below captures the issue. You can see the two shapes at the top have a single central pixel we define from. However an even size shape would have no central pixel, rather two corner defining points.

Pardon my ignorance if a 2 point ellipse function exists. :)
Keep up the great work. Your work is much appreciated in the world of pixel art!

Attachments (1)

Selection_004.png (11.3 KB) - added by pixeloutlaw@… 3 years ago.

Download all attachments as: .zip

Change History (12)

Changed 3 years ago by pixeloutlaw@…

Attachment: Selection_004.png added

comment:1 Changed 3 years ago by yrizoud@…

You're right, the way a center pixel is chose first, only odd-sized circles and ellipses can be produced.
The idea of a modifier key looks a lot like what Photoshop uses, but Grafx2 hasn't used it so far, so I don't know... I don't having anything better to propose, anyway.

comment:2 Changed 3 years ago by PulkoMandy

An alternative would be to have right click on the button switch between different modes (or show a popup on hold), like for the freehand tool.

I'm fine with either, but I prefer to keep the availability of drawing from the center as an option - it is easier to put the circles and ellipse where you want them this way. Maybe we can allow to draw even-size circles and ellipses from almost-the-center?

There is also this old issue (I think only on the old bugtracker) about drawing rotated ellipses, which we never implemented.

comment:3 Changed 3 years ago by pixeloutlaw@…

I think maybe right clicking to change to rectangle ellipse mode might work pretty well!

As far as rotated ellipses go I've had great luck grabbing an ellipse as a brush then rotating that and cleaning it up a bit manually. You end up with a LOT of rotated ellipses when you do isometric style pixel art. Actually my noticing this limitation on odd ellipse widths stems from making ellipses that needed to be 32 pixels wide for tube shapes in isometric pixel art tiles. It is probably the most common use case for ellipses.

Side Note:
I'm a programmer myself (Mostly Python and Common Lisp) but I'm fairly familiar with the C family of languages. Eventually I'd like to contribute if I can get GrafX2's source compiling on my copy of Loonix (Mint 17). :) Lua scripting is very powerful but some changes just need to take place at the C level I suppose. I love that you've made GrafX2 extensible. I have quite a few ideas for things that could be further exposed to the Lua API.

comment:4 Changed 2 years ago by Thomas Bernard

Owner: changed from pulkomandy to Thomas Bernard
Status: newaccepted

<PulkoMandy?> even ellipses sounds like a nice opportunity to dig into the inner workings of the operation stack (operatio.c), which is one of the actually documented parts of GrafX2 core. It should not be too hard to do, especially as most of the code will be reusing the rectangle drawing operation

comment:5 Changed 2 years ago by Thomas Bernard

huhu I started to dig into the ellipse drawing code...
First I'm doing some cleaning work

comment:6 Changed 2 years ago by Thomas Bernard

Status: acceptedassigned


Questions :

  1. I'm modifying Ellipses, is that worth doing it also for circles ? (anyone can draw a circle using the Ellipse function ;)
  2. Should I add a Configuration option to allow switching between old and new behavious ?

comment:7 Changed 2 years ago by PulkoMandy

I don't think an option is the right thing to do. When drawing, sometimes you will want an even ellipse/circle, and sometimes you will want a centered one. So, if we keep both, they should both be easily accessible. As it was mentionned above, some options are:

  • Having a popup menu on the toolbar button (as is the case for freehand drawing currently) to pick one or the other
  • Using a modifier key to switch between the two modes. Yves says this is not used in GrafX2, but I think we have something similar with the line tool, where IIRC holding shift will force 0/45/90° lines. I think something similar could work here.

In order to keep something that makes sense, I would consider removing "circles" from the toolbar and keeping only ellipses. This frees some space in the toolbar to have rectangle-based or center-based ellipses. And in either case, holding SHIFT while drawing would draw a circle instead of an ellipse.

This way the SHIFT key is more coherent with its use for lines.

comment:8 Changed 2 years ago by Thomas Bernard

your're right. It is even weird that they are circle drawing functions, ellipses ones should be used (with vertical and horizontal radius set to the same value)

comment:9 Changed 2 years ago by Thomas Bernard

@PulkoMandy? : I just tried and SHIFT is already doing something in Ellipse drawing.
It "locks" either the vertical or horizontal axis

it is the "Snap_axis" :

comment:10 Changed 2 years ago by Thomas Bernard

I think it is ok now ! Please test latest version from Merge Request

comment:11 Changed 2 years ago by Thomas Bernard

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.