Sign in to follow this  
Followers 0
Toli

Mirror / Rotate

52 posts in this topic

I noticed that Paint.NET does not have an option to Mirror or Rotate a Selection, only the whole Image.

You can Rotate a Selection by using the Right Mouse Button with or without Shift, but the operation is done with trigonometric functions and, implicitely, rounding, generating far from perfect results for 90, 180 and 270 degrees, the only values where it is actually possible to get perfect results.

So I decided to implement these functions:

- Horizontal Mirror (Vertical Flip)

- Vertical Mirror (Horizontal Flip)

- 90 Degrees Clockwise Rotate

- 180 Degrees Rotate

- 270 Degrees Clockwise Rotate (90 Degrees Counter Clockwise Rotate)

While coding, I discovered two more interesting Mirrors and I added them too:

- First Diagonal Mirror

- Second Diagonal Mirror

I updated the Plugin!

1. Now it remembers the last choice.

2. The OK and Cancel Buttons are gone. "None" is now Cancel and all the others are OK. The preview is automated on Button_MouseHover and Button_Enter. This way, you save a click!

3. Try to right-click! You'll see the UI change. Use the UI you like from three choices. The plugin will remember it too.

4. It supports Localization.

You can get this and other plugins plus the source code from here

Toli Cuturicu

0

Share this post


Link to post
Share on other sites

This is very similar to Illnab1024's "Flip" plugin. (See also MadJik's fork)

I do like your UI though.

However, I don't see any effect when I select the "First Diagonal Mirror" and "Second Diagonal Mirror" options.

0

Share this post


Link to post
Share on other sites

> This is very similar to Illnab1024's "Flip" plugin. (See also MadJik's fork)

Well, the Flip Plugin has only two options: Horizontal and Vertical Mirrors (Flips)

This one has seven.

> I do like the UI though.

It may be better... Thanks anyway.

> However, I don't see any effect when I select the "First Diagonal Mirror" and "Second Diagonal Mirror" options.

First Diagonal Mirror, Second Diagonal Mirror, Rotate 90 Degrees and Rotate 270 Degrees only work when the Selection is a square. Otherwise the result would "get out" of the Selection.

Give it a try, please and tell me if there is any method to get the Selection outside the Render Method (for example in the Effect Constructor)

0

Share this post


Link to post
Share on other sites
Well, the Flip Plugin has only two options: Horizontal and Vertical Mirrors (Flips)

This one has seven.

Madjik's has 3 options...
First Diagonal Mirror, Second Diagonal Mirror, Rotate 90 Degrees and Rotate 270 Degrees only work when the Selection is a square. Otherwise the result would "get out" of the Selection.

Give it a try, please and tell me if there is any method to get the Selection outside the Render Method (for example in the Effect Constructor)

I see now...

Thanks for the response.

0

Share this post


Link to post
Share on other sites

The examples are on the Buttons of the Plugin itself.

Take a look...

0

Share this post


Link to post
Share on other sites

Instead of doing nothing, the Buttons that work only when the Selection is Square, are disabled otherwise.

I replaced the original with this update. You can find it at the begining of the post.

0

Share this post


Link to post
Share on other sites

The Default and Cancel Buttons were not properly set. This was fixed.

The UI now remembers its position.

I also shrunk the UI a little.

0

Share this post


Link to post
Share on other sites

Great!

I'm going to replace my flip version by this plugin!

Source? I would like to see how to remember the position!

Thanks!

0

Share this post


Link to post
Share on other sites

Nice, and please put it in "Distort".

Thanks.

0

Share this post


Link to post
Share on other sites

> Great!

> I'm going to replace my flip version by this plugin!

Thank you. I will try to make it better.

> Source? I would like to see how to remember the position!

> Thanks!

I feel quite ashamed of releasing the source code, because everybody will then see my mistakes and bad coding practises.

If you think I will not make a fool of myself, probably I will post it after editing it a bit for clarity.

The position is remembered in an *.ini file created in the same directory. Open it with a text editor and look at it.

Form.Left and Form.Top are written there at Form.FormClosing and read from there at Form.Load.

The whole Ini File stuff is wrapped by me in a class IniFile, which I use in many of my projects. It is extremely large, so I stripped all the unnecessary code out of it and added the remaining to this project.

0

Share this post


Link to post
Share on other sites

> Nice, and please put it in "Distort".

> Thanks.

Thank you too.

I am not sure if my plugin performs any distorsion at all. In my point of view, the result is either identical or enantiomorphic with the original, so it is tehnically not distorted.

But I will take it into consideration further.

0

Share this post


Link to post
Share on other sites

Toli,

Fantastic job! I really like the UI how it shows what the result will be with the buttons. This plugin is essential and will especially be easy to use for newer users.

Keep up the great work.

Dave

0

Share this post


Link to post
Share on other sites

> Toli,

> Fantastic job! I really like the UI how it shows what the result will be with the buttons. This plugin is essential and will

> especially be easy to use for newer users.

> Keep up the great work.

> Dave

Thank you for your compliments. Everybody who knows my programs appreciates especially the UI.

I will keep coding, of course.

0

Share this post


Link to post
Share on other sites

Could you use a thumbnail of the current picture instead of a Paint.NET icon?

Just throwing it here...

0

Share this post


Link to post
Share on other sites

> Could you use a thumbnail of the current picture instead of a Paint.NET icon?

> Just throwing it here...

Sorry, I don't think this would be feasable.

1. Thumbnail of what? The picture? The selection? The Selection Bounds?

2. If it does not have Transparency near the edges it will not look nice on a Button.

3. You see the Effect on the fly on the Canvas anyway.

4. I do not have an algorhythm to save a part of an Image as a *.png / I don't know how to do it.

5. What about the Disabled Buttons. They should display something, shouldn't they?

0

Share this post


Link to post
Share on other sites
Great!

I'm going to replace my flip version by this plugin!

Same here (still keeping Flip installed, though). This rolls up a few functions into one parcel. However, would it be possibly to have all the functions available all of the time? Because virtually all my images are rectangular in shape, yet the need to rotate 90 degrees is still required. I know I could use the built-in one, but I regularly veer to the Effects menu ;).

Perhaps emulate the built-in Rotate when no selection is active - i.e. rotate the entire canvas - and when there is one active still rotate what is in the selection within the selection. What do you think?

Example:

th_rotateexample.jpg

^^Click for larger.

See how it was rotated within the selection? Therefore this would enable all the functions afforded to us available all the time. Is something like my suggestion feasible?

I am not sure if my plugin performs any distorsion at all.

I agree, it suits better in the main Effects menu than any of the submenus.

0

Share this post


Link to post
Share on other sites

> Perhaps emulate the built-in Rotate when no selection is active - i.e. rotate the entire canvas

I am not sure I am able to do that (actually change the Dimensions of the Canvas).

> and when there is one active still rotate what is in the selection within the selection. What do you think?

> See how it was rotated within the selection? Therefore this would enable all the functions afforded to us available

> all the time. Is something like my suggestion feasible?

This would be feasible, but will take some time, because I have some other work to do right now.

0

Share this post


Link to post
Share on other sites

:D

*hides in shame*

1. Thumbnail of what? The picture? The selection? The Selection Bounds?

Yeah, I was thinking about the new bundled effects' dialogs, and in fact they copy the all canvas, disregarding the selection (in the button).

3. You see the Effect on the fly on the Canvas anyway.

True. But you've to click on the buttons to see it.

4.I don't know how to do it.

That's what I've thought. :(

I agree, it suits better in the main Effects menu than any of the submenus.

Agreed.

0

Share this post


Link to post
Share on other sites
I am not sure I am able to do that (actually change the Dimensions of the Canvas).

...

This would be feasible, but will take some time, because I have some other work to do right now.

Not a problem. Like I said, I can always use the built-in one, that is what it's there for.

...

No need to rush, just putting the idea out there.

0

Share this post


Link to post
Share on other sites

I feel it'd fit better in the Adjustments menu, but that's just me, I dunno how anyone else feels about it.

0

Share this post


Link to post
Share on other sites

I added the new version of my plugin and also the source code.

You can find both of them at the beggining of the thread.

Feel free to ask questions about or to criticize the source code (or binary)

Toli Cuturicu

0

Share this post


Link to post
Share on other sites

I updated it again!

Look at the beggining of the thread.

1. Now it remembers the last choice.

2. The OK and Cancel Buttons are gone. "None" is now Cancel and all the others are OK. The preview is automated on Button_MouseHover and Button_Enter. This way, you save a click!

3. Try to right-click! You'll see the UI change. Use the UI you like from three choices. The plugin will remember it too.

Comments?

0

Share this post


Link to post
Share on other sites

Hum... I don't know... I don't think changing the LaF (look and feel) is a good thing even if one has had the cleverest idea ever. It's always a new thing users must learn and be aware of, and this is not a good thing... believe me, I'm software architect for more than 23 years now (geeeeee! :shock:) :lol:

Btw, thanks for this really great plugin!

0

Share this post


Link to post
Share on other sites

Nice!

It's even usable with the keyboard!

Thanks for sharing the source.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0