本文整理汇总了C#中PaintDotNet.ColorBgra类的典型用法代码示例。如果您正苦于以下问题:C# ColorBgra类的具体用法?C# ColorBgra怎么用?C# ColorBgra使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ColorBgra类属于PaintDotNet命名空间,在下文中一共展示了ColorBgra类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BitmapLayer
public BitmapLayer(int width, int height, ColorBgra fillColor)
: base(width, height)
{
this.surface = new Surface(width, height);
// clear to see-through white, 0x00ffffff
this.Surface.Clear(fillColor);
this.properties = new BitmapLayerProperties(UserBlendOps.CreateDefaultBlendOp());
}
示例2: Apply
public unsafe override void Apply(ColorBgra* ptr, int length)
{
while (length > 0)
{
*ptr = setColor;
++ptr;
--length;
}
}
示例3: HistogramRgb
public HistogramRgb()
: base(3, 256)
{
visualColors = new ColorBgra[]{
ColorBgra.Blue,
ColorBgra.Green,
ColorBgra.Red
};
}
示例4: Blend
public static ColorBgra Blend(this ColorBgra a, ColorBgra b, double strength = 0.5d)
{
var bstr = Math.Min(1d, Math.Max(0d, strength));
var astr = 1 - bstr;
return ColorBgra.FromBgra(
(byte)(a.B * astr + b.B * bstr),
(byte)(a.G * astr + b.G * bstr),
(byte)(a.R * astr + b.R * bstr),
(byte)(a.A * astr + b.A * bstr));
}
示例5: CurveControlLuminosity
public CurveControlLuminosity()
: base(1, 256)
{
this.mask = new bool[1]{true};
visualColors = new ColorBgra[]{
ColorBgra.Black
};
channelNames = new string[]{
PdnResources.GetString("CurveControlLuminosity.Luminosity")
};
ResetControlPoints();
}
示例6: Apply
public override ColorBgra Apply(ColorBgra color)
{
int a = blendColor.A;
int invA = 255 - a;
int r = ((color.R * invA) + (blendColor.R * a)) / 256;
int g = ((color.G * invA) + (blendColor.G * a)) / 256;
int b = ((color.B * invA) + (blendColor.B * a)) / 256;
byte a2 = ComputeAlpha(color.A, blendColor.A);
return ColorBgra.FromBgra((byte)b, (byte)g, (byte)r, a2);
}
示例7: Render
protected override ColorBgra Render(int x, int y, ColorBgra initial, Surface source)
{
var targetA = source[Offset(Bounds.Left, x, Bounds.Right), y];
initial = initial.Blend(targetA, GetBorderBlendValue(Bounds.Left, x, Bounds.Right));
var targetC = source[Offset(Bounds.Left, x, Bounds.Right), Offset(Bounds.Top, y, Bounds.Bottom)];
var targetB = source[x, Offset(Bounds.Top, y, Bounds.Bottom)];
targetB = targetB.Blend(targetC, GetBorderBlendValue(Bounds.Left, x, Bounds.Right));
initial = initial.Blend(targetB, GetBorderBlendValue(Bounds.Top, y, Bounds.Bottom));
return initial;
}
示例8: Apply
public unsafe virtual void Apply(ColorBgra* ptr, int length)
{
unsafe
{
while (length > 0)
{
*ptr = Apply(*ptr);
++ptr;
--length;
}
}
}
示例9: Apply
public unsafe virtual void Apply(ColorBgra *dst, ColorBgra *lhs, ColorBgra *rhs, int length)
{
unsafe
{
while (length > 0)
{
*dst = Apply(*lhs, *rhs);
++dst;
++lhs;
++rhs;
--length;
}
}
}
示例10: QuantizePixel
/// <summary>
/// Override this to process the pixel in the second pass of the algorithm
/// </summary>
/// <param name="pixel">The pixel to quantize</param>
/// <returns>The quantized value</returns>
protected override byte QuantizePixel(ColorBgra *pixel)
{
byte paletteIndex = 0;
if (!this.enableTransparency || pixel->A == 255)
{
paletteIndex = (byte)this.octree.GetPaletteIndex(pixel);
}
else
{
paletteIndex = (byte)this.maxColors; // maxColors will have a maximum value of 255 is enableTransparency is true
}
return paletteIndex;
}
示例11: CurveControlRgb
public CurveControlRgb()
: base(3, 256)
{
this.mask = new bool[3] { true, true, true };
visualColors = new ColorBgra[] {
ColorBgra.Red,
ColorBgra.Green,
ColorBgra.Blue
};
channelNames = new string[]{
PdnResources.GetString("CurveControlRgb.Red"),
PdnResources.GetString("CurveControlRgb.Green"),
PdnResources.GetString("CurveControlRgb.Blue")
};
ResetControlPoints();
}
示例12: AddColor
public static ColorBgra AddColor(ColorBgra original, ColorBgra addition)
{
if (original.A == 255)
{
return original;
}
if (original.A == 0)
{
return addition;
}
byte addition_alpha = Math.Min(addition.A, (byte) (255 - original.A));
int total_alpha = original.A + addition_alpha;
double orig_frac = original.A / (double) total_alpha;
double add_frac = addition_alpha / (double) total_alpha;
return ColorBgra.FromBgra(Int32Util.ClampToByte((int)(original.B * orig_frac + addition.B * add_frac)),
Int32Util.ClampToByte((int)(original.G * orig_frac + addition.G * add_frac)),
Int32Util.ClampToByte((int)(original.R * orig_frac + addition.R * add_frac)),
Int32Util.ClampToByte(total_alpha));
}
示例13: Create
public BarcodeSurface Create(Rectangle rect, Surface source, String text, ColorBgra primaryColor, ColorBgra secondaryColor)
{
BarcodeSurface barcode = new BarcodeSurface(rect);
String encodedText = this.Encode(text);
int barWidth = (int)System.Math.Floor((double)barcode.Width / encodedText.Length);
int halfBarHeight = (int)System.Math.Floor((double)barcode.Height / 2.0);
int currentHeight = 0;
for (int y = rect.Top; y < rect.Bottom; y++)
{
int loc = 0;
int step = 0;
for (int x = rect.Left; x < rect.Right; x++)
{
if (loc < encodedText.Length && barWidth > 0 && halfBarHeight > 0)
{
if (encodedText[loc] == 'w' || (encodedText[loc] == 'b' && currentHeight <= halfBarHeight))
{
barcode[x, y] = secondaryColor;
}
else if (encodedText[loc] == 'B' || (encodedText[loc] == 'b' && currentHeight > halfBarHeight))
{
barcode[x, y] = primaryColor;
}
else
{
barcode[x,y] = source[x,y];
}
step++;
if (step % barWidth == 0) loc++;
}
else
{
barcode[x, y] = source[x, y];
}
}
currentHeight++;
}
return barcode;
}
示例14: InitialQuantizePixel
/// <summary>
/// Process the pixel in the first pass of the algorithm
/// </summary>
/// <param name="pixel">The pixel to quantize</param>
/// <remarks>
/// This function need only be overridden if your quantize algorithm needs two passes,
/// such as an Octree quantizer.
/// </remarks>
protected override void InitialQuantizePixel(ColorBgra *pixel)
{
this.octree.AddColor(pixel);
}
示例15: Increment
/// <summary>
/// Increment the pixel count and add to the color information
/// </summary>
public void Increment(ColorBgra *pixel)
{
++_pixelCount;
_red += pixel->R;
_green += pixel->G;
_blue += pixel->B;
}