-
Notifications
You must be signed in to change notification settings - Fork 277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Outline Object Effect #971
Add Outline Object Effect #971
Conversation
// Removing this causes preview to not update to lower radius levels | ||
var srcRow = srcData.Slice (y * srcWidth, srcWidth); | ||
var dstRow = dest.GetPixelData ().Slice (y * srcWidth, srcWidth); | ||
for (int x = left; x <= right; x++) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This loop could be replaced by CopyTo()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
if (destRow[x].A == 255) | ||
continue; | ||
|
||
if (Data.FillObjectBackground && destRow[x].A >= Data.Tolerance) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not entirely sure if I'm understanding the use case for the Fill Object Background toggle, but it might be more clear to label it as making the object opaque since it's not filling with a new colour?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, yeah that seems like a reasonable label then 👍
Pinta.Core/Effects/ColorBgra.cs
Outdated
/// <param name="colorTop">The color layered on top. Color must be in premultiplied form. See <see cref="ToPremultipliedAlpha"/>.</param> | ||
/// <param name="colorBottom">The color layered below. Color must be in premultiplied form. See <see cref="ToPremultipliedAlpha"/>.</param> | ||
/// <returns>Premultiplied form of the alpha-blend between colorTop and colorBottom.</returns> | ||
public static ColorBgra AlphaBlend (ColorBgra colorTop, ColorBgra colorBottom) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should also be possible to do this blending using the NormalBlendOp
class, so I'd suggest giving that a try!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Removed the alphablend method while i was at it
I don't mind the Outline Object name, but the original Outline also could probably be called something like "Outline Edges" since it's more based around edge detection |
Not related to any issue. But it's an effect I use often, so I decided to implement it, especially as the code is similar(ish) to the feather effect.
Located in Object > Outline Object.
It outlines an object on a transparent background.
There already is an outline effect, but this differs. This one does not replace the original image, and is more flexible.
Personally, my usual use case for an effect like this:
Has six options:
Radius modifies outline width.
Tolerance modifies what is defined as the "border" of the object.
Alpha Gradient defines whether the outline's alpha falls off, or remains a constant alpha.
Color Gradient defines whether or not the outline blends between primary color > secondary color or not. Otherwise, remains just the primary color.
Outline Border outlines the border of the image.
Fill Object Background fills the background of the object with the primary color. Only really noticeable on translucent objects, but is on by default for anti-aliased borders of an object.
5 tests added.
Was unsure what to name this, as we already have an Outline effect. But the new category was made, so i decided to name it Outline Object. (Maybe we should rename Feather > Feather Object now, because there's Align Object, Outline Object, and Feather)