Jump to content

MJW

Members
  • Posts

    2,853
  • Joined

  • Last visited

  • Days Won

    70

Everything posted by MJW

  1. I was experimenting with some things related to the Copy Selection feature and wrote a test plugin to read the selection from the clipboard. Before trying to read the selection, I called Clipboard.ContainsText() to verify there was text on the clipboard. Even when there was a selection on the clipboard, it returned "false". Since I could retrieve the text just fine by calling Services.GetService<IClipboardService>().TryGetText(), it isn't important that Clipboard.ContainsText() work the way I expect it to work, but I'm still curious as to why it didn't, and whether I'm making some mistake it how I'm using it. The call is simply: public bool ClipboardContainsText() { return Clipboard.ContainsText(); } Called by: public bool GetClipboardText() { //if (!ClipboardContainsText()) // Commented out, since it doesn't seem to work. // return false; // If we tried and succeded, don't try again. Use the text we got. if (clipboardText != null) return true; else if (triedToGetCbText) // Don't retry if we failed once. return false; triedToGetCbText = true; clipboardText = Services.GetService<IClipboardService>().TryGetText(); if (clipboardText == null) return false; return true; } I used Clipboard.ContainsImage() in a plugin, and it worked exactly as I expected it to.
  2. Excellent work by @Pixey @Manc, @Ladybug, and @ardneh! (Hope I got everyone.) Quite a fun, though somewhat difficult, theme, I think. I really wanted to to make a cumulus or cumulonimbus type cloud, but none my several attempts produced an acceptable result. Pixey came very close to what I was trying for in the image with the sunbeam. I thought it would and should have won. (Though, if I may say so, I think it would have been improved by having less of a yellow tone.) I looked at a number of Photoshop cloud tutorial, hoping to adapt them to PDN, but they all (or at least all the decent ones) simply amounted to painting the clouds with brushes: something better suited to a more integrated brush capability, and to pressure-sensitive tablets. (Or perhaps to greater artistic ability.)
  3. in case @Alerbusdoesn't already know, Paste Alpha is part of BoltBait's plugin pack. Make sure you select "Alpha channel on clipboard" as the alpha source (the default is Shades of gray).
  4. Sorry, but I don't believe there's any way to do that. It'd probably be quicker to use the Tool menu, which only requires one mouse click.
  5. My favorite halftone plugin is Ed Harvey's Halftone (in the Stylize menu).
  6. I appreciate your asking, but no credit needed.
  7. Split Color and Brightness allows the user to create a Color layer and a Brightness layer that produce the original image when blended using the selected blending mode. It's in the Color menu. The DLL: SplitColorAndBrightness.zip The Help menu: The user interface: This was somewhat inspired (if I can use so grand a term) by a method of painting -- sometimes referred to as grisaille -- in which a grayscale underpainting is glazed with color to produce a colored image. Though this effect may not be especially useful, I think there are interesting possibilities of splitting the color and brightness, then applying separate modifications.
  8. Many (most) of my recent plugins have been VS projects, but this is just a quickie. It's convenient not to have anything but the CodeLab text file. If I could make it work with the OK button, I'd do what you suggest in a second, but just to link the controls for a bit more elegance doesn't seem worth it. (That is in no way intended to denigrate the CodeLab Export option, which is a wonderful feature.)
  9. I didn't know that could be done in an IndirectUI plugin. I not aware of any control the plugin has over the OK button. What I'd much rather do is to make clicking the OK button initiate the copy to the clipboard, but there seems there's no IndirectUI mechanism to do that. Perhaps someday I'll rewrite the plugin to not use IndirectUI, but this was just sort of a quick CodeLab hack I wrote on a whim. (I wish CodeLab allowed sliders to be linked, since that would have been more elegant than two sets of controls.)
  10. If you have the area to recolor in an upper layer, you can also try using different Opacity and different Blending Modes to combine the recolored section with the original image.
  11. Another advantage to putting the area to recolor in a separate layer is that if after recoloring you realize you initially had too much, you can erase the part you don't want; and if you initially had too little, you can put the missing region in a layer between the two original layers, and recolor it, also. In some cases it's probably better to put slightly more than you need in the new layer, recolor, then erase around the edges to get the best look. Undo can be used for fix any over-erasures, so you get plenty of chances to get it right.
  12. I don't know if this will help, but one method I've used is to duplicate the image into another layer, and in the upper layer, erase everything except what you wish to recolor. Then you can use various Adjustments, Effects, and hand coloring to recolor the part of image in the upper layer. I find it a lot easier to accurately erase around a region than to try to get an accurate Lasso tool selection. (You also don't have to deal with that distracting crawling-ants border when recoloring -- wish it could be temporarily turned off.) It often helps to feather the edge of the upper-layer region, so it blends more smoothly with the original image. Feathering can also be achieved by using an Eraser with a soft edge. If you're doing eye color, you can always use the Ellipse select to select the iris. I also find BoltBait's Hue/Saturation+ very useful for recoloring. You can isolate the general area with a selection, then apply Hue/Saturation+ with a color range to limit it to certain colors.
  13. I think I've figured out why Additive mode gives the results it does. And while the method for blending is in a sense logical, I don't think it's ideal. I believe the semi-transparent pixel in the upper layer is Additive blended with the opaque pixel in the lower layer, then combined with the lower-layer pixels using normal alpha blending. The problem (if I may call it that) is that the result of the Additive blending is clamped to 255 before the pixels are alpha blended. rather than after. Perhaps that's necessary to be consistent for all the blending modes. For the example I gave in my original comment, where the lower layer color is (20, 20, 20) and the upper layer color is (255, 255, 255) with an alpha of 85: The Additive blended color component is 275, which is clamped to 255. Then, 0.667 * 20 + 0.333 * 255 => 98 I'm still slightly confused, because I believe Screen mode behaves in a similar fashion, and Screen mode should never overflow in the first step, before the alpha blending. (I think I was mistaken about that.)
  14. That's how two opaque pixels are blended, but what if one of the pixels is semi-transparent? How does alpha affect the blending? That's what my question is about. Of course, both pixels could be semi-transparent, but I'm mostly concerned with the case where the upper layer is semi-transparent and the lower layer is opaque. Off hand, I believe the full equation should be more or less: Cimage = (Alower * Clower + Aupper * Cupper) / 255 (The part that makes me say "off hand" is that if the layers are merged, I think the colors need to be adjusted to account for the combined alpha.)
  15. I don't know if this is a bug or not, but the way alpha is used in the Additive blending mode seems odd to me. If I have an opaque lower layer and an upper layer with partially-transparent pixels and the Additive blending mode, I would expect (or at least hope) the blending equation would be something like: Cimage = Clower + (Aupper * Cupper) / 255 Where C is a color component (R, G, or B ) and A is alpha. For many color combinations it is, but in other cases it's quite different. For instance if the lower layer color is (20, 20, 20) and the upper layer color is (255, 255, 255) with an alpha of 85, the image color is (98, 98, 98) whereas the above equation gives (105, 105, 105). If the Additive blending mode is working as intended, I would very much appreciate knowing the actual blending equation it uses. (I hate that smiley-face-with-sunglasses that happens automatically on the forum when a right paren follows a B. Useless and annoying!)
  16. 7. Plugins must not modify the Paint.NET user interface. Plugins are not allowed to modify Paint.NET's UI in any way such as by adding menu commands, etc.
  17. One thing worth trying, just to help figure out what's going on, is to read the .tga file back into Paint.NET, then use the Color Picker tool to sample the transparent area. I'm wondering if perhaps even though the transparent pixels are changed to transparent black in PDN (or Gimp), they're changed back to transparent white when they're saved in the file. Does the program accept any other file formats you could try instead of .tga?
  18. I suspect it's the same problem as on this thread: You might try running the plugin Transparent to Transparent Black before saving the file, to see if that fixes the problem. If it's the same issue as the previous thread, it's actually a bug in the game, which is mishandling transparency
  19. There's now a plugin to help do this: Of course, if all you want to do is to paste the selected region into a new image, @ardneh's method is easier.
  20. I should have done it that way, but didn't think of it. Instead, I used Ceiling() and Floor(). If I update it, I'll change to your method.
  21. Copy Selection Bounding Box copies the bounding box of the current selection to the clipboard. Paste Selection can then be used to activate the bounding-box selection. The bounding box can be expanded by adding margins to each side. It's a little confusing, since you have to press the Copy to Clipboard button to save to the clipboard. There was no easy way to make the save occur automatically when the plugin exits. I didn't mention this in the Help menu, but if there's no selection, or the selection would not produce a proper selection when clipped to the canvas (such as when the selection is entirely outside the canvas) , a selection covering entire canvas is copied to the clipboard. These are uninteresting cases, so I decided it would be simpler and better to produce valid selections rather than displaying error messages in MessageBoxes (which is the only other simple alternative). The DLL: Copy Selection Bounding Box.zip The Help Menu: The User Interface:
  22. That's a good point; though I think way my rather silly little plugin works, it would be hard to fix it to work correctly in that circumstance anyway, and probably not worth the effort.
×
×
  • Create New...