-
Notifications
You must be signed in to change notification settings - Fork 254
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
21 changed files
with
549 additions
and
237 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
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
42 changes: 42 additions & 0 deletions
42
src/Tizen.NUI.PenWave/src/public/Tools/Canvas/CanvasToolActionHandler.cs
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,42 @@ | ||
/* | ||
* Copyright(c) 2024 Samsung Electronics Co., Ltd. | ||
* | ||
* 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. | ||
* | ||
*/ | ||
|
||
using System; | ||
using System.ComponentModel; | ||
using System.Collections.Generic; | ||
using Tizen.NUI; | ||
using Tizen.NUI.BaseComponents; | ||
|
||
namespace Tizen.NUI.PenWave | ||
{ | ||
public class CanvasToolActionHandler : IToolActionHandler | ||
{ | ||
public void Activate() | ||
{ | ||
} | ||
|
||
public void Deactivate() | ||
{ | ||
} | ||
|
||
public void HandleInput(Touch touch) | ||
{ | ||
} | ||
} | ||
} | ||
|
||
|
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
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
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
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
93 changes: 93 additions & 0 deletions
93
src/Tizen.NUI.PenWave/src/public/Tools/Eraser/EraserToolActionHandler.cs
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,93 @@ | ||
/* | ||
* Copyright(c) 2024 Samsung Electronics Co., Ltd. | ||
* | ||
* 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. | ||
* | ||
*/ | ||
|
||
using System; | ||
using System.ComponentModel; | ||
using System.Collections.Generic; | ||
using Tizen.NUI; | ||
using Tizen.NUI.BaseComponents; | ||
|
||
namespace Tizen.NUI.PenWave | ||
{ | ||
public class EraserToolActionHandler : IToolActionHandler | ||
{ | ||
enum Mode | ||
{ | ||
Partial, | ||
Full | ||
} | ||
|
||
private Mode mode = Mode.Partial; | ||
private float radiusEraser = 48; // 지우개 사이즈 설정 가능해야 함 | ||
|
||
public void Activate() | ||
{ | ||
} | ||
|
||
public void Deactivate() | ||
{ | ||
EndDrawing(); | ||
} | ||
|
||
public void HandleInput(Touch touch) | ||
{ | ||
if (touch == null || touch.GetPointCount() == 0) return; | ||
|
||
uint pointStateIndex = 0; | ||
uint touchTime = touch.GetTime(); | ||
|
||
List<Vector2> touchPositionList = new List<Vector2>(); | ||
for (uint i = 0; i < touch.GetPointCount(); ++i) | ||
{ | ||
touchPositionList.Add(touch.GetLocalPosition(i)); | ||
} | ||
|
||
Vector2 position = touchPositionList[(int)pointStateIndex]; | ||
switch (touch.GetState(pointStateIndex)) | ||
{ | ||
case PointStateType.Down: | ||
StartDrawing(position, touchTime); | ||
break; | ||
case PointStateType.Motion: | ||
ContinueDrawing(position, touchTime); | ||
break; | ||
case PointStateType.Up: | ||
case PointStateType.Leave: | ||
EndDrawing(); | ||
break; | ||
} | ||
} | ||
|
||
private void StartDrawing(Vector2 position, uint touchTime) | ||
{ | ||
PWEngine.EraseShape((int)position.X, (int)position.Y, radiusEraser, (mode == Mode.Partial)); | ||
} | ||
|
||
private void ContinueDrawing(Vector2 position, uint touchTime) | ||
{ | ||
PWEngine.EraseShape((int)position.X, (int)position.Y, radiusEraser, (mode == Mode.Partial)); | ||
} | ||
|
||
private void EndDrawing() | ||
{ | ||
PWEngine.StopErasing(); | ||
} | ||
|
||
} | ||
} | ||
|
||
|
34 changes: 34 additions & 0 deletions
34
src/Tizen.NUI.PenWave/src/public/Tools/IToolActionHandler.cs
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,34 @@ | ||
/* | ||
* Copyright(c) 2024 Samsung Electronics Co., Ltd. | ||
* | ||
* 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. | ||
* | ||
*/ | ||
|
||
using System; | ||
using System.ComponentModel; | ||
using System.Collections.Generic; | ||
using Tizen.NUI; | ||
using Tizen.NUI.BaseComponents; | ||
|
||
namespace Tizen.NUI.PenWave | ||
{ | ||
public interface IToolActionHandler | ||
{ | ||
void HandleInput(Touch touch); | ||
void Activate(); | ||
void Deactivate(); | ||
} | ||
} | ||
|
||
|
Oops, something went wrong.