Jump to content

goatie

Newbies
  • Posts

    9
  • Joined

  • Last visited

goatie's Achievements

Rookie

Rookie (2/14)

  • First Post
  • Conversation Starter
  • Week One Done
  • One Month Later
  • One Year In

Recent Badges

0

Reputation

  1. The reboot did the trick, but I'm just curious that it seems to head off in two directions at once! Is it perhaps just looking for the 'latest' .NET version and finds 4.6.1 by accident?
  2. On Windows 8.1, installing PDN 4.0.9 advises that its going to install .NET 4.6.1 and then PDN. Fine.... Then, with 4.6.1 in, SetupFrontEnd.exe dies, insisting it requires .NET 4.6 ?
  3. Looks more like embossed to me! Letterpress (raised) type is used to emboss leather, card etc, which I'm guessing is what you mean? Sorry - could bore you silly with the types of printing...
  4. I started from the VS template, updated it to work with the current PDN, and am using Stuart Radforth's Rotate plugin to understand how everything fits together. I've moved part of the code to another class file. This is EffectPlugin.cs using System; using System.Collections; using System.Drawing; using System.Drawing.Text; using System.Collections.Generic; using System.Reflection; using System.Windows; using System.Windows.Forms; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using PaintDotNet; using PaintDotNet.Effects; using PaintDotNet.IndirectUI; using PaintDotNet.PropertySystem; //using PaintDotNet.Rendering; //using BlankEffect.pixelInterpolate; namespace BlankEffect { public class PictureRotatePlugin : PaintDotNet.Effects.Effect { public static string StaticName { get { return "Effect Plugin"; } } public double Amount1 = 45; // [-180,180] Rotation public bool Amount3 = false; // [0,1] Disable Interpolation public byte Amount2 = 0; // [1] Limit Type|Clamp|Wrap|Mirror|Primary Colour|Secondary Colour|Untouch public static Bitmap StaticIcon { get { return new Bitmap(typeof(PictureRotatePlugin), "EffectPluginIcon.png"); } } public static string StaticSubMenuName { get { return null; // Use for no submenu // return "My SubMenu"; // Use for custom submenu } } public PictureRotatePlugin() : base(PictureRotatePlugin.StaticName, PictureRotatePlugin.StaticIcon, PictureRotatePlugin.StaticSubMenuName, EffectFlags.Configurable) { } public enum PropertyNames { Amount1, Amount2, Amount3 } public enum Amount2Options { Amount2Option1, Amount2Option2, Amount2Option3, Amount2Option4, Amount2Option5, Amount2Option6 } protected override PropertyCollection OnCreatePropertyCollection() { List<Property> props = new List<Property>(); props.Add(new DoubleProperty(PropertyNames.Amount1, 45, -180, +180)); props.Add(StaticListChoiceProperty.CreateForEnum<Amount2Options>(PropertyNames.Amount2, 0, false)); props.Add(new BooleanProperty(PropertyNames.Amount3, false)); return new PropertyCollection(props); } protected override ControlInfo OnCreateConfigUI(PropertyCollection props) { ControlInfo configUI = CreateDefaultConfigUI(props); configUI.SetPropertyControlValue(PropertyNames.Amount1, ControlInfoPropertyNames.DisplayName, "Rotation"); configUI.SetPropertyControlType(PropertyNames.Amount1, PropertyControlType.AngleChooser); configUI.SetPropertyControlValue(PropertyNames.Amount2, ControlInfoPropertyNames.DisplayName, "Limit Type"); configUI.SetPropertyControlType(PropertyNames.Amount2, PropertyControlType.RadioButton); PropertyControlInfo Amount2Control = configUI.FindControlForPropertyName(PropertyNames.Amount2); Amount2Control.SetValueDisplayName(Amount2Options.Amount2Option1, "Clamp"); Amount2Control.SetValueDisplayName(Amount2Options.Amount2Option2, "Wrap"); Amount2Control.SetValueDisplayName(Amount2Options.Amount2Option3, "Mirror"); Amount2Control.SetValueDisplayName(Amount2Options.Amount2Option4, "Primary Colour"); Amount2Control.SetValueDisplayName(Amount2Options.Amount2Option5, "Secondary Colour"); Amount2Control.SetValueDisplayName(Amount2Options.Amount2Option6, "Untouch"); configUI.SetPropertyControlValue(PropertyNames.Amount3, ControlInfoPropertyNames.DisplayName, string.Empty); configUI.SetPropertyControlValue(PropertyNames.Amount3, ControlInfoPropertyNames.Description, "Disable Interpolation"); return configUI; } protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) { this.Amount1 = newToken.GetProperty<DoubleProperty>(PropertyNames.Amount1).Value; this.Amount2 = (byte)((int)newToken.GetProperty<StaticListChoiceProperty>(PropertyNames.Amount2).Value); this.Amount3 = newToken.GetProperty<BooleanProperty>(PropertyNames.Amount3).Value; base.OnSetRenderInfo(newToken, dstArgs, srcArgs); } public override EffectConfigDialog CreateConfigDialog() { return new EffectPluginConfigDialog(); } /// <summary> /// /// </summary> /// <param name="parameters"></param> /// <param name="dstArgs">Destination canvas</param> /// <param name="srcArgs">Source canvas</param> /// <param name="rois">Region of Interest</param> /// <param name="startIndex"></param> /// <param name="length"></param> public override void Render(EffectConfigToken parameters, RenderArgs dstArgs, RenderArgs srcArgs, Rectangle[] rois, int startIndex, int length) { Surface src = srcArgs.Surface; Surface dst = dstArgs.Surface; PdnRegion selectionRegion = EnvironmentParameters.GetSelection(srcArgs.Bounds); // Delete any of these lines you don't need Rectangle selection = this.EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt(); long CenterX = (long)(((selection.Right - selection.Left) / 2) + selection.Left); long CenterY = (long)(((selection.Bottom - selection.Top) / 2) + selection.Top); ColorBgra PrimaryColor = (ColorBgra)EnvironmentParameters.PrimaryColor; ColorBgra SecondaryColor = (ColorBgra)EnvironmentParameters.SecondaryColor; int BrushWidth = (int)EnvironmentParameters.BrushWidth; ColorBgra CurrentPixel; double tempX; double tempY; bool bError; double dAngle; double dCos, dSin; dAngle = Amount1 * 6.283 / 360.0; dCos = Math.Cos(dAngle); dSin = Math.Sin(dAngle); pixelInterpolate Interpolate = new pixelInterpolate(); for (int i = startIndex; i < startIndex + length; ++i) { Rectangle rect = rois[i]; for (int y = rect.Top; y < rect.Bottom; ++y) { for (int x = rect.Left; x < rect.Right; ++x) { // Render Code Here //CurrentPixel = src[x, y]; tempX = ((double)(x - CenterX)) * dCos + (((double)(y - CenterY)) * dSin) + CenterX; tempY = ((double)(y - CenterY)) * dCos + (((double)(x - CenterX)) * -1 * dSin) + CenterY; CurrentPixel = src[x, y]; bError = false; XCompareTo(ref selection, tempX, ref bError); YCompareTo(ref selection, tempY, ref bError); // Copy the background colour if an error is encountered if (bError) { CopyBackgroundColour(src, ref selection, ref PrimaryColor, ref SecondaryColor, ref CurrentPixel, ref tempX, ref tempY, Amount2, Interpolate); } else { CurrentPixel = Interpolate.Interpolate(src, selection, tempX, tempY); } dst[x, y] = CurrentPixel; } } } } private static void CopyBackgroundColour(Surface src, ref Rectangle selection, ref ColorBgra PrimaryColor, ref ColorBgra SecondaryColor, ref ColorBgra CurrentPixel, ref double tempX, ref double tempY, byte Amount2, pixelInterpolate Interpolate) { switch (Amount2) { // Clamp case 0: if (tempX >= selection.Right) { tempX = selection.Right - 1; } else if (tempX < selection.Left) { tempX = selection.Left; } if (tempY >= selection.Bottom) { tempY = selection.Bottom - 1; } else if (tempY < selection.Top) { tempY = selection.Top; } CurrentPixel = Interpolate.Interpolate(src, selection, tempX, tempY); break; // Wrap case 1: tempX = (((int)tempX + (selection.Right - selection.Left)) % (selection.Right - selection.Left)) + selection.Left; tempY = (((int)tempY + (selection.Bottom - selection.Top)) % (selection.Bottom - selection.Top)) + selection.Top; tempX = ((int)tempX) % selection.Right; tempY = ((int)tempY) % selection.Bottom; CurrentPixel = Interpolate.Interpolate(src, selection, tempX, tempY); break; // Mirror case 2: double dSelectionWidth; double dSelectionHeight; dSelectionWidth = (selection.Right - selection.Left); dSelectionHeight = (selection.Bottom - selection.Top); double dOffsetX = (tempX - selection.Left) + (dSelectionWidth * 10000.0); double dOffsetY = (tempY - selection.Top) + (dSelectionHeight * 10000.0); dOffsetX %= (2.0 * dSelectionWidth); dOffsetY %= (2.0 * dSelectionHeight); if (dOffsetX > (dSelectionWidth)) { dOffsetX = (dSelectionWidth * 2.0) - dOffsetX; } if (dOffsetY > (dSelectionHeight)) { dOffsetY = (dSelectionHeight * 2.0) - dOffsetY; } tempX = dOffsetX + selection.Left; tempY = dOffsetY + selection.Top; CurrentPixel = Interpolate.Interpolate(src, selection, tempX, tempY); break; // Set with primary colour case 3: CurrentPixel.R = (byte)PrimaryColor.R; CurrentPixel.G = (byte)PrimaryColor.G; CurrentPixel.B = (byte)PrimaryColor.B; CurrentPixel.A = (byte)PrimaryColor.A; break; // Set with secondary colour case 4: CurrentPixel.R = (byte)SecondaryColor.R; CurrentPixel.G = (byte)SecondaryColor.G; CurrentPixel.B = (byte)SecondaryColor.B; CurrentPixel.A = (byte)SecondaryColor.A; break; // Untouch Leave src pixels case 5: default: break; }; } private static void YCompareTo(ref Rectangle selection, double tempY, ref bool bError) { if (tempY >= selection.Bottom) { bError = true; } else if (tempY < selection.Top) { bError = true; } } private static void XCompareTo(ref Rectangle selection, double tempX, ref bool bError) { if (tempX >= selection.Right) { bError = true; } else if (tempX < selection.Left) { bError = true; } } } }
  5. Sorry. Of course they are..... brainf##t..... What I should have said was: references: PaintDotNet.base/Core/Data/Effects System/Drawing/windows.Forms Namespaces as above.
  6. (using VS C# 2010 express) Having cleaned up the VS c# template and got it building successfully, I suddenly hit 'no suitable method to override' with protected override PropertyCollection OnCreatePropertyCollection() protected override ControlInfo OnCreateConfigUI(PropertyCollection props) protected override void OnSetRenderInfo(PropertyBasedEffectConfigToken newToken, RenderArgs dstArgs, RenderArgs srcArgs) and 'the name 'CreateDefaultConfigUI' does not exist in the current context' with ControlInfo configUI = CreateDefaultConfigUI(props); using System; using System.Collections; using System.Drawing; using System.Drawing.Text; using System.Collections.Generic; using System.Reflection; using System.Windows; using System.Windows.Forms; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using PaintDotNet; using PaintDotNet.Effects; using PaintDotNet.IndirectUI; using PaintDotNet.PropertySystem; are the dlls I'm including. any ideas?
  7. Is this an option somewhere that I can't find?
  8. When I hit the build button, I get a system.io error about the .out file already existing? Running windows vista
  9. Seems odd that I can't see any options for doing screengrabs? Doing a normal shift/print screen is not what I'm looking for, since my dual monitor setup produces negative images. What I'm looking for is more like the excellent Paint Shop Pro's grab of area/window/screen etc. Is this something that can be done via an effect plugin, or is this simply beyond the realms of PDN?
×
×
  • Create New...