Sign in to follow this  

UserBlendOp versus BinaryPixelOp

Recommended Posts

In the CodeLap 2.0 release, one of the changes is: BlendOps have been changed from UserBlendOp to BinaryPixelOp.


What is the distinction between them? I believe UserBlendOp is a subclass of BinaryPixelOp, but what is the significance of the change?


I notice UserBlendOp has an associated class called UserBlendOps that provides a number of helpful methods, while PixelBlendOps is labeled as obsolete.




Share this post

Link to post
Share on other sites

The following works in Paint.NET 3.5.11 and below

// Darken
private UserBlendOp darkenOp = new UserBlendOps.DarkenBlendOp(); 




The following works in 4.0+

// Setup for using Darken blend op
private BinaryPixelOp darkenOp = LayerBlendModeUtil.CreateCompositionOp(LayerBlendMode.Darken);


The change was made by Rick when developing 4.0.  I think the change was made to match the naming convention of Unary pixel ops.




Binary pixel operations take two pixels for input.  Unary pixel ops take one pixel for input:


// Setup for using pixel op
private UnaryPixelOps.Desaturate desaturateOp = new UnaryPixelOps.Desaturate();


  • Upvote 1

Share this post

Link to post
Share on other sites

Thanks, BoltBait.


(I kind  of like the old way better, but I suppose there was a good reason for the change.)

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this