本文整理汇总了C++中Bitmap::Create方法的典型用法代码示例。如果您正苦于以下问题:C++ Bitmap::Create方法的具体用法?C++ Bitmap::Create怎么用?C++ Bitmap::Create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bitmap
的用法示例。
在下文中一共展示了Bitmap::Create方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例2: Main
void Main()
{
wnd.Create("てすと", 0, 0, 500, 500,
WindowOption::StandardStyle|
WindowOption::ClientSize|
WindowOption::BGWhite|
WindowOption::Centering);
wnd.Show();
// Initialize
backBuf.Create(500, 500);
rect[0] = Vector2(-50.0, -50.0);
rect[1] = Vector2(-50.0, 50.0);
rect[2] = Vector2(50.0, 50.0);
rect[3] = Vector2(50.0, -50.0);
//Vector3 v(20, 30, 1);
//Matrix3 m;
//Matrix3Translation4V2(m, 100, 200);
//v = v * m;
// Application Loop
MainLoop(Run);
// Finalize
backBuf.Release();
}
示例3: Bitmap
Bitmap *CreateBitmap(int width, int height, int color_depth)
{
Bitmap *bitmap = new Bitmap();
if (!bitmap->Create(width, height, color_depth))
{
delete bitmap;
bitmap = NULL;
}
return bitmap;
}
示例4: switch
////////////////////////////////////////////////////////////////////////////////
// Draws a default skin bitmap
void MAS::Skin::GenerateDefaultBitmap(int i) {
Bitmap *bmp = bmpList[i];
static int w[] = { 64,64,18,26,72,18,18,11,15,15,15,15,36,64,18, 48,64,64,64,64,12,36,26,16,18,18,16,16,16,16,16,16,16,12, 2,18,64,88,88,30,30,30, 8, 8,12,30 };
static int h[] = { 64,64,72,52,72,80,88,88,56,56,56,56,96,64,24,112,64,64,64,64,36,12,52,64,64,64,64,64,64,64,64,48,64, 2,12,72,64,18,11, 8,30,36,72,72,17, 8 };
static int tw[] = { 60,58,14,13,68,18,14,11,15,15,15,15,32,60,18, 16,60,60,60,60, 8,14,13,16,14,14,12,16,16,16,12,12,12, 8, 2,14,60,18,22,-1,-1,-1,-1,-1,-1,-1 };
static int th[] = { 48,58,14,13,68,20,18,22,14,14,14,14, 8,60,12, 16,60,60,60,60,14, 8,13,16,12,12,12,16,16,16,12, 8,12, 2, 8,14,60,14,11,-1,-1,-1,-1,-1,-1,-1 };
bmp->Create(w[i], h[i], MAS::Settings::useVideoMemory ? Bitmap::VIDEO : Bitmap::MEMORY);
bmp->ThickX(tw[i]);
bmp->ThickY(th[i]);
bmp->Clear(c_face);
switch (i) {
case BOX:
bmp->Rectangle(1, 4, 63, 63, c_shad1);
bmp->Rectangle(0, 3, 62, 62, c_shad2);
break;
case BOX_SHADOW:
bmp->Draw3DFrame(0, 0, 62, 62, c_face, c_shad1, c_shad2);
bmp->Hline(1, 63, 63, Color::black);
bmp->Vline(63, 1, 63, Color::black);
break;
case BUTTON:
bmp->Draw3DFrame(0, 0, 17, 17, c_deselect, c_shad1, c_shad2);
bmp->Draw3DFrame(0, 18, 17, 35, c_select, c_shad2, c_shad1);
bmp->Draw3DFrame(0, 36, 17, 53, c_face, c_shad1, c_shad2);
bmp->Draw3DFrame(0, 54, 17, 71, c_focus, c_shad1, c_shad2);
break;
case CHECKBOX:
bmp->Draw3DFrame(0, 0, 12, 12, c_sunken, c_shad2, c_shad1);
bmp->Draw3DFrame(13, 0, 25, 12, c_sunken, c_shad2, c_shad1);
bmp->DrawXMark(19, 6, 6, c_font);
bmp->Draw3DFrame(0, 13, 12, 25, c_select, c_shad2, c_shad1);
bmp->Draw3DFrame(13, 13, 25, 25, c_select, c_shad2, c_shad1);
bmp->DrawXMark(19, 19, 6, c_font);
bmp->Draw3DFrame(0, 26, 12, 38, c_face, c_shad2, c_shad1);
bmp->Draw3DFrame(13, 26, 25, 38, c_face, c_shad2, c_shad1);
bmp->DrawXMark(19, 32, 6, c_disable);
bmp->Draw3DFrame(0, 39, 12, 51, c_focus, c_shad2, c_shad1);
bmp->Draw3DFrame(13,39, 25, 51, c_focus, c_shad2, c_shad1);
bmp->DrawXMark(19, 45, 6, c_font);
break;
case CLEAR_BACK:
bmp->Clear(c_back);
break;
case COMBO_BUTTON:
bmp->Clear(Color::transparent);
bmp->DrawArrow(4, 9, c_font, 3);
bmp->DrawArrow(4, 29, c_font, 3);
bmp->DrawArrow(4, 49, c_disable, 3);
bmp->DrawArrow(4, 69, c_font, 3);
break;
case HSLIDER_BACK:
bmp->Draw3DFrame(0, 9, 17, 12, Color::transparent, c_shad2, c_shad1);
bmp->Draw3DFrame(0, 31, 17, 34, Color::transparent, c_shad2, c_shad1);
bmp->Draw3DFrame(0, 53, 17, 56, Color::transparent, c_shad2, c_shad1);
bmp->Draw3DFrame(0, 75, 17, 78, Color::transparent, c_shad2, c_shad1);
break;
case HSLIDER_GRIP:
bmp->Draw3DFrame(0, 0, 10, 21, c_deselect, c_shad1, c_shad2);
bmp->Draw3DFrame(0, 22, 10, 43, c_select, c_shad2, c_shad1);
bmp->Draw3DFrame(0, 44, 10, 65, c_face, c_shad1, c_shad2);
bmp->Draw3DFrame(0, 66, 10, 87, c_focus, c_shad1, c_shad2);
break;
case ICONEXIT:
bmp->Draw3DFrame(0, 0, 14, 13, c_face, c_shad1, c_shad2);
bmp->Draw3DFrame(0, 14, 14, 27, c_face, c_shad2, c_shad1);
bmp->Draw3DFrame(0, 28, 14, 41, c_face, c_shad1, c_shad2);
bmp->Draw3DFrame(0, 42, 14, 55, c_face, c_shad1, c_shad2);
bmp->DrawXMark(7, 7, 6, c_font);
bmp->DrawXMark(7, 21, 6, c_font);
bmp->DrawXMark(7, 35, 6, c_disable);
bmp->DrawXMark(7, 49, 6, c_font);
break;
case ICONMAX:
bmp->Draw3DFrame(0, 0, 14, 13, c_face, c_shad1, c_shad2);
bmp->Draw3DFrame(0, 14, 14, 27, c_face, c_shad2, c_shad1);
bmp->Draw3DFrame(0, 28, 14, 41, c_face, c_shad1, c_shad2);
bmp->Draw3DFrame(0, 42, 14, 55, c_face, c_shad1, c_shad2);
bmp->Rectangle(3, 3, 10, 10, c_font);
bmp->Rectangle(3, 17, 10, 24, c_font);
bmp->Rectangle(3, 31, 10, 38, c_disable);
bmp->Rectangle(3, 45, 10, 52, c_font);
bmp->Hline(3, 4, 10, c_font);
bmp->Hline(3, 18, 10, c_font);
bmp->Hline(3, 32, 10, c_disable);
bmp->Hline(3, 46, 10, c_font);
break;
//.........这里部分代码省略.........