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


C++ Color::GetRed方法代码示例

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


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

示例1: OpenBitmapFromFile

void OpenBitmapFromFile(
    const WCHAR *pFilename,
    void **pBuffer,
    uint32_t *width,
    uint32_t *height)
{
    GdiplusStartupInput gdiplusStartupInput;
    ULONG_PTR gdiplusToken;
    GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, nullptr);

    Bitmap *bitmap  = new Bitmap(pFilename);

    *width          = bitmap->GetWidth();
    *height         = bitmap->GetHeight();
    *pBuffer        = new BYTE[*width * *height * 4]; // width * height * |RGBA|

    // The folder 'stb_image' contains a PNG open/close module which
    // is far less painful than this is, yo.
    Gdiplus::Color clr;
    for (uint32_t y = 0, idx = 0; y < *height; ++y)
    {
        for (uint32_t x = 0; x < *width; ++x, idx += 4)
        {
            bitmap->GetPixel(x, *height - y - 1, &clr);
            ((BYTE*)*pBuffer)[idx + 0] = clr.GetBlue();
            ((BYTE*)*pBuffer)[idx + 1] = clr.GetGreen();
            ((BYTE*)*pBuffer)[idx + 2] = clr.GetRed();
            ((BYTE*)*pBuffer)[idx + 3] = clr.GetAlpha();
        }
    }

    delete bitmap;
    bitmap = 0;
}
开发者ID:menpo,项目名称:mesa,代码行数:34,代码来源:utils.cpp

示例2:

DirectionalLight::DirectionalLight(Gdiplus::Color colour, Vector3D direction)
{
	_redIntensity = colour.GetRed();
	_greenIntensity = colour.GetGreen();
	_blueIntensity = colour.GetBlue();
	_lightDirection = direction;
}
开发者ID:ElmsPlusPlus,项目名称:Intro3DRenderer,代码行数:7,代码来源:DirectionalLight.cpp

示例3:

// if an identical pen is set up already, find and use it
// if no such pen is set up, create one and save it for future use
std::shared_ptr<Gdiplus::Pen> PenWeight::GetPen(Gdiplus::Color color, float width) 
{
	std::stringstream newStream;
	newStream << "(" << color.GetRed() << ",";
	newStream << color.GetGreen() << ",";
	newStream << color.GetBlue() << ");";
	newStream << std::setprecision(2) << width;
	std::string newString = newStream.str();
	// when an identical pen is found
	if (this->pens.find(newString) != this->pens.end()) {
		return pens.at(newString);
	}
	// no identical pens are found
	else {
		std::shared_ptr<Gdiplus::Pen> newPen = std::make_shared<Gdiplus::Pen>(color, width);
		pens.insert(std::pair<std::string, std::shared_ptr<Gdiplus::Pen>>(newString, newPen));
		return newPen;
	}
}
开发者ID:Rancho06,项目名称:ProCppProjects,代码行数:21,代码来源:PenWeight.cpp

示例4: v

void v(const wchar_t* f1, const char* f2) {
  Gdiplus::Bitmap bmp(f1);
  Gdiplus::Graphics g(bmp2);
  g.Clear(Gdiplus::Color(0,0,0));  
  std::vector<char> data, data2;
  for(int y=0; y<bmp.GetHeight(); y+=2) {
    int lc=0, lc2=0;
    for(int u=0; u<8; u++) {
      data.push_back(0);
      data2.push_back(0);
    }
    int v = data.size();
    int prevcl=-1, prevcl2=-1;
    for(int x=0; x<bmp.GetWidth(); x+=3) {
      int ca[3][2]; int cac=0;
      int cb[3][2]; int cbc=0;
      for(int xx=0; xx<3; xx++)
        for(int yy=0; yy<2; yy++)
          ca[xx][yy]=cb[xx][yy]=0;

      for(int sy=0; sy<2; sy++)
        for(int sx=0; sx<3; sx++) {
          Gdiplus::Color clr;
          bmp.GetPixel(x+sx, y+sy, &clr);
          int cc1 = int(clr.GetRed()<<16) | (int(clr.GetGreen()) << 8) | (int(clr.GetBlue()));
          int c1, c2;
          if(cc1==0x000000) continue; else
          if(cc1==0xFF0000) c1=0x8C, c2=c1;   else
          if(cc1==0xFF8000) c1=0x8C, c2=0x84; else
          if(cc1==0xFFFF00) c1=0x84, c2=c1;   else
          if(cc1==0x80FF00) c1=0x84, c2=0x85; else
          if(cc1==0x00FF00) c1=0x85, c2=c1;   else
          if(cc1==0x00FF80) c1=0x85, c2=0x81; else
          if(cc1==0x00FFFF) c1=0x81, c2=c1;   else
          if(cc1==0x0080FF) c1=0x81, c2=0x89; else
          if(cc1==0x0000FF) c1=0x89, c2=c1;   else
          if(cc1==0x8000FF) c1=0x89, c2=0x88; else
          if(cc1==0xFF00FF) c1=0x88, c2=c1;   else
          if(cc1==0xFF0080) c1=0x88, c2=0x8C; else
          if(cc1==0x800000) c1=0x8C, c2=0;    else
          if(cc1==0x808000) c1=0x84, c2=0;    else
          if(cc1==0x008000) c1=0x85, c2=0;    else
          if(cc1==0x008080) c1=0x81, c2=0;    else
          if(cc1==0x000080) c1=0x89, c2=0;    else
          if(cc1==0x800080) c1=0x88, c2=0;    else
          if(cc1==0x808080) c1=0x80, c2=0;    else
          if(cc1==0xFF8080) c1=0x8C, c2=0x80; else
          if(cc1==0xFFFF80) c1=0x84, c2=0x80; else
          if(cc1==0x80FF80) c1=0x85, c2=0x80; else
          if(cc1==0x80FFFF) c1=0x81, c2=0x80; else
          if(cc1==0x8080FF) c1=0x89, c2=0x80; else
          if(cc1==0xFF80FF) c1=0x88, c2=0x80; else
          if(cc1==0xFFFFFF) c1=0x80, c2=c1;   else continue;

          int used;
          if(cac==0 || cac==c1) {
            cac = c1;
            ca[sx][sy] = 1;
            used=1;
          } else 
          if(cbc==0 || cbc==c1) {
            cbc = c1;
            cb[sx][sy] = 1;
            used=2;
          } else {
            int x=1;
          }

          if(c2!=0) {
            if(used!=1 && (cac==0 || cac==c2)) {
              cac = c2;
              ca[sx][sy] = 1;
            } else 
            if(used!=2 && (cbc==0 || cbc==c2)) {
              cbc = c2;
              cb[sx][sy] = 1;
            } else {
              int x=1;
            }
          }
          /* 
          if(c1!=0) {
            int j;
            for(j=0; j<cln; j++) {
              if(clv[j]==c1) {
                clc[j]++;
                break;
              }
            }
            if(j==cln) {
              clv[cln] = c1;
              clvr[cln] = c1r;
              clc[cln] = 1;
              cln++;
            }
          }*/
          //raise("Color limit. "+i2s(x)+":"+i2s(y)+"-"+i2s(x+2)+":"+i2s(y+1));
        }
          
        /*
//.........这里部分代码省略.........
开发者ID:VWarlock,项目名称:OldLines,代码行数:101,代码来源:pads.cpp


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