Ejemplo n.º 1
0
    private static bool TryFindColorIndex(PixelFormatChannelMask mask, out int index)
    {
        var maskList = mask.Mask;

        for (int i = 0, count = maskList.Count; i < count; i++)
        {
            if (maskList[i] == 255)
            {
                index = i;
                return(true);
            }
        }
        index = -1;
        return(false);
    }
Ejemplo n.º 2
0
        private void ChannelMaskView_CurrentChanged(object sender, System.EventArgs e)
        {
            _maskCollection.Clear();
            if (_channelMaskView.CurrentItem != null)
            {
                try
                {
                    PixelFormatChannelMask current = (PixelFormatChannelMask)_channelMaskView.CurrentItem;

                    if (current.Mask != null && current.Mask.Any())
                    {
                        _maskCollection.AddRange(current.Mask);
                        _maskView.MoveCurrentToFirst();
                    }
                }
                catch
                {
                }
            }
        }