Re: Enhancement - Diagonal line crop guide

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Martin Nordholts wrote:
> Tim Jedlicka wrote:
>>
>> I stumbled upon this link describing the use of the Diagonal (45 degree
>> diagonal from each corner of an image) as the optimum crop guide ("better"
>> than rule-of-thirds or golden rule).
...
> Oops, it of course depends on portrait or landscape which line you hit
> first. I think you will have to throw in an if there.
I figured out a way to avoid the "if" statement. However, I don't know which method would be more efficient. i.e. should I try to avoid the "if"? These diagonal crop guides are very dynamic as you change your crop rectangle so I don't want to bog down the rendering. Just need some guidance on which route to take. I'll then have some follow up questions since I am not much of a coder (I'll do this off list unless directed otherwise).

gimpregionselecttool.c has this bit of code when selecting a region:
  /* don't let the events come in too fast, ignore below a delay of 100 ms */
  if (time - last_time < 100)
    return;

  last_time = time;

  diff_x = coords->x - region_sel->x;
  diff_y = coords->y - region_sel->y;

  diff = ((ABS (diff_x) > ABS (diff_y)) ? diff_x : diff_y) / 2.0;

So there "if" doesn't look like it is too costly.

The way I came up with to avoid the "if" is (pseudo code):

X = x2-x1
Y = y2-y1
Z = [(X + Y) - ABS (X - Y)] / 2
So the upper left diagonal would go from x1,y1 to (x1 + Z), (y1 + Z)

Any advice on which way to implement?
--
Tim Jedlicka, Network Entomologist
bonzo@xxxxxxxxxxxx, http://www.galifree.com
_______________________________________________
Gimp-developer mailing list
Gimp-developer@xxxxxxxxxxxxxxxxxxxxxx
https://lists.XCF.Berkeley.EDU/mailman/listinfo/gimp-developer

[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux