-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
81 changed files
with
16,509 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 11.00 | ||
# Visual C# Express 2010 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ABSpriteEditor", "ABSpriteEditor\ABSpriteEditor.csproj", "{110C6CE2-2264-4037-9BD4-C2143246D849}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|x86 = Debug|x86 | ||
Release|x86 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{110C6CE2-2264-4037-9BD4-C2143246D849}.Debug|x86.ActiveCfg = Debug|x86 | ||
{110C6CE2-2264-4037-9BD4-C2143246D849}.Debug|x86.Build.0 = Debug|x86 | ||
{110C6CE2-2264-4037-9BD4-C2143246D849}.Release|x86.ActiveCfg = Release|x86 | ||
{110C6CE2-2264-4037-9BD4-C2143246D849}.Release|x86.Build.0 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
EndGlobal |
Large diffs are not rendered by default.
Oops, something went wrong.
112 changes: 112 additions & 0 deletions
112
ABSpriteEditor/ABSpriteEditor/Controls/ActionPanel.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
using System; | ||
using System.Drawing; | ||
using System.Windows.Forms; | ||
using ABSpriteEditor.Utilities; | ||
|
||
// | ||
// Copyright (C) 2022 Pharap (@Pharap) | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
namespace ABSpriteEditor.Controls | ||
{ | ||
public partial class ActionPanel : UserControl | ||
{ | ||
private Bitmap image; | ||
|
||
public event EventHandler ImageChanged; | ||
public event EventHandler BeforeAction; | ||
public event EventHandler AfterAction; | ||
|
||
public ActionPanel() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
public Bitmap Image | ||
{ | ||
get { return this.image; } | ||
set | ||
{ | ||
// If the assigned image is not the current image | ||
if (this.image != value) | ||
{ | ||
// Change the image | ||
this.image = value; | ||
|
||
// Raise ImageChanged event | ||
this.OnImageChanged(EventArgs.Empty); | ||
} | ||
} | ||
} | ||
|
||
#region Methods | ||
|
||
private void OnImageChanged(EventArgs e) | ||
{ | ||
// Cache the handler | ||
var handler = this.ImageChanged; | ||
|
||
// If the handler isn't null | ||
if (handler != null) | ||
// Call the handler | ||
handler(this, e); | ||
} | ||
|
||
private void OnAfterAction(EventArgs e) | ||
{ | ||
// Cache the handler | ||
var handler = this.AfterAction; | ||
|
||
// If the handler isn't null | ||
if (handler != null) | ||
// Call the handler | ||
handler(this, e); | ||
} | ||
|
||
private void OnBeforeAction(EventArgs e) | ||
{ | ||
// Cache the handler | ||
var handler = this.BeforeAction; | ||
|
||
// If the handler isn't null | ||
if (handler != null) | ||
// Call the handler | ||
handler(this, e); | ||
} | ||
|
||
#endregion | ||
|
||
private void flipHorizontallyToolStripButton_Click(object sender, EventArgs e) | ||
{ | ||
// If there is no image | ||
if (this.Image == null) | ||
// Exit early | ||
return; | ||
|
||
// Raise before action event | ||
this.OnBeforeAction(EventArgs.Empty); | ||
|
||
// Defer to a helper class to horizontally flip the image | ||
BitmapHelper.FlipHorizontally(this.Image); | ||
|
||
// Raise after action event | ||
this.OnAfterAction(EventArgs.Empty); | ||
} | ||
|
||
private void flipVerticallyToolStripButton_Click(object sender, EventArgs e) | ||
{ | ||
// If there is no image | ||
if (this.Image == null) | ||
// Exit early | ||
return; | ||
|
||
// Raise before action event | ||
this.OnBeforeAction(EventArgs.Empty); | ||
|
||
// Defer to a helper class to vertically flip the image | ||
BitmapHelper.FlipVertically(this.Image); | ||
|
||
// Raise after action event | ||
this.OnAfterAction(EventArgs.Empty); | ||
} | ||
|
||
private void toolStripButton1_Click(object sender, EventArgs e) | ||
{ | ||
// If there is no image | ||
if (this.Image == null) | ||
// Exit early | ||
return; | ||
|
||
// Raise before action event | ||
this.OnBeforeAction(EventArgs.Empty); | ||
|
||
// Defer to a helper class to vertically flip the image | ||
BitmapHelper.RollLeft(this.Image, 2); | ||
|
||
// Raise after action event | ||
this.OnAfterAction(EventArgs.Empty); | ||
} | ||
} | ||
} |
Oops, something went wrong.