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.
This loop could be replaced by CopyTo()
| if (destRow[x].A == 255) | ||
| continue; | ||
|
|
||
| if (Data.FillObjectBackground && destRow[x].A >= Data.Tolerance) |
There was a problem hiding this comment.
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.
Thanks, yeah that seems like a reasonable label then 👍
| /// <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.
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.
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)