mirror of
https://github.com/greenshot/greenshot
synced 2025-07-14 00:53:51 -07:00
Added settings forms for DropShadowEffect & TornEdgeEffect
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2380 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
6579d49d49
commit
38de4875e0
10 changed files with 696 additions and 31 deletions
|
@ -372,24 +372,24 @@ namespace GreenshotPlugin.Core {
|
|||
/// Make the picture look like it's torn
|
||||
/// </summary>
|
||||
/// <param name="sourceBitmap">Bitmap to make torn edge off</param>
|
||||
/// <param name="toothHeight">How large (height) is each tooth</param>
|
||||
/// <param name="horizontalToothRange">How wide is a horizontal tooth</param>
|
||||
/// <param name="verticalToothRange">How wide is a vertical tooth</param>
|
||||
/// <returns>Changed bitmap</returns>
|
||||
public static Bitmap CreateTornEdge(Bitmap sourceBitmap) {
|
||||
public static Bitmap CreateTornEdge(Bitmap sourceBitmap, int toothHeight, int horizontalToothRange, int verticalToothRange) {
|
||||
Bitmap returnImage = CreateEmpty(sourceBitmap.Width, sourceBitmap.Height, PixelFormat.Format32bppArgb, Color.Empty, sourceBitmap.HorizontalResolution, sourceBitmap.VerticalResolution);
|
||||
using (GraphicsPath path = new GraphicsPath()) {
|
||||
Random random = new Random();
|
||||
int regionWidth = 20;
|
||||
int regionHeight = 20;
|
||||
int HorizontalRegions = (int)(sourceBitmap.Width / regionWidth);
|
||||
int VerticalRegions = (int)(sourceBitmap.Height / regionHeight);
|
||||
int distance = 12;
|
||||
int HorizontalRegions = (int)(sourceBitmap.Width / horizontalToothRange);
|
||||
int VerticalRegions = (int)(sourceBitmap.Height / verticalToothRange);
|
||||
|
||||
// Start
|
||||
Point previousEndingPoint = new Point(regionWidth, random.Next(1, distance));
|
||||
Point previousEndingPoint = new Point(horizontalToothRange, random.Next(1, toothHeight));
|
||||
Point newEndingPoint;
|
||||
// Top
|
||||
for (int i = 0; i < HorizontalRegions; i++) {
|
||||
int x = (int)previousEndingPoint.X + regionWidth;
|
||||
int y = random.Next(1, distance);
|
||||
int x = (int)previousEndingPoint.X + horizontalToothRange;
|
||||
int y = random.Next(1, toothHeight);
|
||||
newEndingPoint = new Point(x, y);
|
||||
path.AddLine(previousEndingPoint, newEndingPoint);
|
||||
previousEndingPoint = newEndingPoint;
|
||||
|
@ -397,8 +397,8 @@ namespace GreenshotPlugin.Core {
|
|||
|
||||
// Right
|
||||
for (int i = 0; i < VerticalRegions; i++) {
|
||||
int x = sourceBitmap.Width - random.Next(1, distance);
|
||||
int y = (int)previousEndingPoint.Y + regionHeight;
|
||||
int x = sourceBitmap.Width - random.Next(1, toothHeight);
|
||||
int y = (int)previousEndingPoint.Y + verticalToothRange;
|
||||
newEndingPoint = new Point(x, y);
|
||||
path.AddLine(previousEndingPoint, newEndingPoint);
|
||||
previousEndingPoint = newEndingPoint;
|
||||
|
@ -406,8 +406,8 @@ namespace GreenshotPlugin.Core {
|
|||
|
||||
// Bottom
|
||||
for (int i = 0; i < HorizontalRegions; i++) {
|
||||
int x = (int)previousEndingPoint.X - regionWidth;
|
||||
int y = sourceBitmap.Height - random.Next(1, distance);
|
||||
int x = (int)previousEndingPoint.X - horizontalToothRange;
|
||||
int y = sourceBitmap.Height - random.Next(1, toothHeight);
|
||||
newEndingPoint = new Point(x, y);
|
||||
path.AddLine(previousEndingPoint, newEndingPoint);
|
||||
previousEndingPoint = newEndingPoint;
|
||||
|
@ -415,8 +415,8 @@ namespace GreenshotPlugin.Core {
|
|||
|
||||
// Left
|
||||
for (int i = 0; i < VerticalRegions; i++) {
|
||||
int x = random.Next(1, distance);
|
||||
int y = (int)previousEndingPoint.Y - regionHeight;
|
||||
int x = random.Next(1, toothHeight);
|
||||
int y = (int)previousEndingPoint.Y - verticalToothRange;
|
||||
newEndingPoint = new Point(x, y);
|
||||
path.AddLine(previousEndingPoint, newEndingPoint);
|
||||
previousEndingPoint = newEndingPoint;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue