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


C++ Bitmap::Putpixel方法代码示例

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


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

示例1: pOffset

// creates a cursor shadow from a cursor bitmap
void MAS::Cursor::MakeShadow() {
   int x, y, i;

   Point pOffset(PADDING, PADDING);
   Point pOrigin(0,0);
   for (i=0; i<frameCount; i++) {
      Bitmap bmp;

      if (MAS::Settings::mouseShadow) {
         bmp.Create(Size(sprite[i]->w() + 2*PADDING, sprite[i]->h() + 2*PADDING), Bitmap::MEMORY);
      
         // create the alpha channel for the shadow by masking the cursor and bluring the results
         Bitmap alpha(bmp.size(), Bitmap::MEMORY);
         alpha.Clear(Color::transparent);
         sprite[i]->Blit(alpha, pOrigin, pOffset, sprite[i]->size());

         for (y=0; y<bmp.h(); y++) {
            for (x=0; x<bmp.w(); x++) {
               Point p(x,y);
               if (alpha.Getpixel(p) == Color::transparent)
                  alpha.Putpixel(p, Color::black);
               else
                  alpha.Putpixel(p, Color::white);
            }
         }

         Blur(alpha, PADDING);

         // write the alpha channel to the shadow bitmap
         for (y=0; y<bmp.h(); y++) {
            for (x=0; x<bmp.w(); x++) {
               Point p(x,y);
               bmp.Putpixel(p, Color(shadowColor.r(), shadowColor.g(), shadowColor.b(), alpha.Getpixel(p).r()));
            }
         }
      
         alpha.Destroy();
      }
      else {
         bmp.Create(1, 1);
         bmp.Putpixel(0, 0, Color::transparent);
      }

      Bitmap *result = new Bitmap(bmp.w(), bmp.h());
	  bmp.Blit(*result, 0, 0, 0, 0, bmp.w(), bmp.h());
      shadow.push_back(result);
   }
}
开发者ID:bambams,项目名称:ma5king,代码行数:49,代码来源:cursor.cpp

示例2: Reload

////////////////////////////////////////////////////////////////////////////////
// Colors the skin bitmaps with the specified color and alpha intensity
//TODO: do this using turbofast A5 blending functions
void MAS::Skin::Colorize(const Color &col, int alpha) {
   Bitmap *bmp;
   int i, x, y;
   Color pink = Color::transparent;

   Reload();
   for (i=0; i<nBitmaps; i++) {
      bmp = bmpList[i];
      for (y=0; y<bmp->h(); y++) {
         for (x=0; x<bmp->w(); x++) {
            Color p = bmp->Getpixel(x, y);
            if (p == pink)
               continue;

            p.Colorize(col, alpha);
            bmp->Putpixel(x, y, p);
         }
      }
   }

   //if (box_back != -1) box_back = MASColorizePixel(box_back, col, alpha);
   c_back.Colorize(col, alpha);
   c_deselect.Colorize(col, alpha);
   c_disable.Colorize(col, alpha);
   c_face.Colorize(col, alpha);
   c_focus.Colorize(col, alpha);
   c_font.Colorize(col, alpha);
   c_select.Colorize(col, alpha);
   c_shad1.Colorize(col, alpha);
   c_shad2.Colorize(col, alpha);
   c_sunken.Colorize(col, alpha);
}
开发者ID:bambams,项目名称:ma5king,代码行数:35,代码来源:skin.cpp

示例3: switch


//.........这里部分代码省略.........
         bmp->DrawArrow(4, 6, c_font, 2);
         bmp->DrawArrow(5, 23, c_font, 2);
         bmp->DrawArrow(4, 38, c_disable, 2);
         bmp->DrawArrow(4, 54, c_font, 2);
         break;

      case SCROLL_VBACK:
         break;

      case SCROLL_VGRIP:
         bmp->Draw3DFrame(0,   0, 15, 11, c_deselect, c_shad1, c_shad2);
         bmp->Draw3DFrame(0, 12, 15, 23,   c_select, c_shad2, c_shad1);
         bmp->Draw3DFrame(0, 24, 15, 35,    c_face, c_shad2, c_shad2);
         bmp->Draw3DFrame(0, 36, 15, 47,   c_select, c_shad1, c_shad2);
         break;

      case SCROLL_VGRIPOVERLAY:
         bmp->Clear(Color::transparent);
         break;

      case SEPARATORH:
         bmp->Hline(0, 0, 11, c_shad2);
         bmp->Hline(0, 1, 11, c_shad1);
         break;

      case SEPARATORV:
         bmp->Vline(0, 0, 11, c_shad2);
         bmp->Vline(1, 0, 11, c_shad1);
         break;

      case TAB_BUTTON:
         bmp->Clear(Color::transparent);
         bmp->Draw3DFrame(0,  0, 17, 19, c_face, c_shad1, c_shad2);
         bmp->Hline(      1, 17, 16,     c_shad1);
         bmp->Putpixel(   0, 17,         Color::transparent);
         bmp->Putpixel(  17, 17,         Color::transparent);
         bmp->Draw3DFrame(0, 18, 17, 38, c_face, c_shad1, c_shad2);
         bmp->Putpixel(   0, 35,         Color::transparent);
         bmp->Putpixel(  17, 35,         Color::transparent);
         bmp->Draw3DFrame(0, 36, 17, 55, c_face, c_shad1, c_shad2);
         bmp->Hline(      1, 53, 16,     c_shad1);
         bmp->Putpixel(   0, 53,         Color::transparent);
         bmp->Putpixel(  17, 53,         Color::transparent);
         bmp->Draw3DFrame(0, 54, 17, 74, c_face, c_shad1, c_shad2);
         bmp->Hline(      1, 71, 16,     c_shad1);
         bmp->Putpixel(   0, 71,         Color::transparent);
         bmp->Putpixel(  17, 71,         Color::transparent);
         break;

      case TAB_WINDOW:
         bmp->Draw3DFrame(0, 0, 63, 63, c_face, c_shad1, c_shad2);
         break;

      case VSLIDER_BACK:
         bmp->Draw3DFrame( 9, 0, 12, 17, Color::transparent, c_shad2, c_shad1);
         bmp->Draw3DFrame(31, 0, 34, 17, Color::transparent, c_shad2, c_shad1);
         bmp->Draw3DFrame(53, 0, 56, 17, Color::transparent, c_shad2, c_shad1);
         bmp->Draw3DFrame(75, 0, 78, 17, Color::transparent, c_shad2, c_shad1);
         break;

      case VSLIDER_GRIP:
         bmp->Draw3DFrame( 0, 0, 21, 10, c_deselect, c_shad1, c_shad2);
         bmp->Draw3DFrame(22, 0, 43, 10, c_select, c_shad2, c_shad1);
         bmp->Draw3DFrame(44, 0, 65, 10, c_face, c_shad1, c_shad2);
         bmp->Draw3DFrame(66, 0, 87, 10, c_focus, c_shad1, c_shad2);
         break;

      case WINBOTTOM:
         bmp->Draw3DFrame(-2, 0, 31, 7, c_face, c_shad1, c_shad2);
         bmp->Draw3DFrame(-2, -2, 31, 3, c_face, c_shad1, c_shad2);
         break;

      case WINDOW:
         break;

      case WINGRIP:
         bmp->Rectfill( 0, 0, 29, 17, c_select);
         bmp->Rectfill( 0, 18, 29, 35, c_shad2);
         break;

      case WINLEFT:
         bmp->Draw3DFrame(0, 0, 7, 71, c_face, c_shad1, c_shad2);
         bmp->Draw3DFrame(4, 0, 10, 71, c_face, c_shad1, c_shad2);
         break;

      case WINRIGHT:
         bmp->Draw3DFrame(0, 0, 7, 71, c_face, c_shad1, c_shad2);
         bmp->Draw3DFrame(-2, 0, 3, 71, c_face, c_shad1, c_shad2);
         break;

      case WINTEXT:
         bmp->Clear(Color::transparent);
         break;

      case WINTOP:
         bmp->Draw3DFrame(-2, 0, 31, 7, c_face, c_shad1, c_shad2);
         bmp->Draw3DFrame(-2, 4, 31, 10, c_face, c_shad1, c_shad2);
         break;
   };
}
开发者ID:bambams,项目名称:ma5king,代码行数:101,代码来源:skin.cpp


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