当前位置: 首页>>代码示例>>C#>>正文


C# Bitmap.Column方法代码示例

本文整理汇总了C#中Bitmap.Column方法的典型用法代码示例。如果您正苦于以下问题:C# Bitmap.Column方法的具体用法?C# Bitmap.Column怎么用?C# Bitmap.Column使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Bitmap的用法示例。


在下文中一共展示了Bitmap.Column方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: findStartOfStaffs

 private static int findStartOfStaffs(Bitmap bitmap)
 {
     var x = 0;
     while (!bitmap.Column(x).Any(pixel => pixel == true))
     {
         x++;
     }
     log("Staffs found at {0}.", x);
     return x;
 }
开发者ID:aquamoth,项目名称:CodeinGame,代码行数:10,代码来源:Program.cs

示例2: noteBoundsAt

    private static Rectangle noteBoundsAt(Bitmap bitmap, int x, int staffDistance)
    {
        int? minY = null, maxY = null;
        var endX = x;
        do
        {
            var yMinMax = noteTopBottomAt(bitmap.Column(endX).ToArray(), staffDistance);
            if (yMinMax == null)
                break;

            if (!minY.HasValue || minY > yMinMax.Item1) minY = yMinMax.Item1;
            if (!maxY.HasValue || maxY < yMinMax.Item2) maxY = yMinMax.Item2;

            endX++;
        } while (true);

        if (!minY.HasValue)
            return null;

        return new Rectangle { X1 = x, Y1 = minY.Value, X2 = endX, Y2 = maxY.Value };
    }
开发者ID:aquamoth,项目名称:CodeinGame,代码行数:21,代码来源:Program.cs

示例3: enumerate

    public static IEnumerable<Note> enumerate(Bitmap bitmap)
    {
        //log("Skipping to start of staffs");
        var x = findStartOfStaffs(bitmap);

        var outsideStaffIndexes = staffPositions(bitmap.Column(x).ToArray());
        log("Staff indexes: {0}", string.Join(", ", outsideStaffIndexes));
        eraseStaffs(bitmap, outsideStaffIndexes);

        var staffThickness = outsideStaffIndexes[1] - outsideStaffIndexes[0];
        var staffDistance = outsideStaffIndexes[2] - outsideStaffIndexes[0];
        log("Staff heights: {0}", staffDistance);
        var notePositions = getNotePositions(outsideStaffIndexes).ToArray();
        while (x < bitmap.Width)
        {
            //log("x={0}", x);
            var noteBounds = noteBoundsAt(bitmap, x, staffDistance);
            if (noteBounds != null)
            {
                var centerX = (noteBounds.X1 + noteBounds.X2) / 2;
                var centerY = (noteBounds.Y1 + noteBounds.Y2) / 2;
                log("At {2}-{3}; Found note at: ({0}, {1})", centerX, centerY, noteBounds.X1, noteBounds.X2);

                var duration = durationAt(bitmap, centerX, centerY + staffThickness);
                var pitch = pitchAt(centerY, notePositions);
                yield return new Note { Pitch = pitch, Duration = duration };

                x = noteBounds.X2;
                log("Skipping to end of note at {0}", x);
            }

            x++;
        }
    }
开发者ID:aquamoth,项目名称:CodeinGame,代码行数:34,代码来源:Program.cs


注:本文中的Bitmap.Column方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。