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


C# Color.getGreen方法代码示例

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


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

示例1: setPixel

 public void setPixel(int x, int y, Color color)
 {
     /*
       Color is a triple (r,g,b) representing a color for the pixel.
       Sets pixel at (x,y) to the given color.
     */
     unsafe {
     byte *pixels = (byte *)this.pixbuf.Pixels;
     byte *r = &pixels[x * bytesPerPixel + y * pixbuf.Rowstride + 0];
     byte *g = &pixels[x * bytesPerPixel + y * pixbuf.Rowstride + 1];
     byte *b = &pixels[x * bytesPerPixel + y * pixbuf.Rowstride + 2];
     *r = (byte) color.getRed();
     *g = (byte) color.getGreen();
     *b = (byte) color.getBlue();
     }
 }
开发者ID:roboshepherd,项目名称:myro-epuck,代码行数:16,代码来源:Graphics.cs

示例2: setRGB

 public void setRGB(Color color)
 {
     red = color.getRed();
     green = color.getGreen();
     blue = color.getBlue();
 }
开发者ID:roboshepherd,项目名称:myro-epuck,代码行数:6,代码来源:Graphics.cs

示例3: clear

        public void clear(Color color)
        {
            unsafe {
            int rowstride = pixbuf.Rowstride;
            int width = pixbuf.Width;
            int height = pixbuf.Height;
            byte *line = (byte *) pixbuf.Pixels;

            int r = color.getRed();
            int g = color.getGreen();
            int b = color.getBlue();

            for (int y = 0; y < height; y++){
            for (int x = 0; x < width; x++){
            byte *rgb = &line[x * bytesPerPixel];
            *rgb++ = (byte) r;
            *rgb++ = (byte) g;
            *rgb++ = (byte) b;
            }
            line += rowstride;
            }
            }
        }
开发者ID:roboshepherd,项目名称:myro-epuck,代码行数:23,代码来源:Graphics.cs


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