• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ graphics::TBitmap类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中graphics::TBitmap的典型用法代码示例。如果您正苦于以下问题:C++ TBitmap类的具体用法?C++ TBitmap怎么用?C++ TBitmap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



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

示例1: run

//---------------------------------------------------------------------------
int __stdcall run(Block *aBlock)
{
	if(aBlock->input.size() != 1 || aBlock->input[0].getConnectedType().IsEmpty())
		return 1;

	Graphics::TBitmap* picture = new Graphics::TBitmap();
	AnsiString connectedType(aBlock->input[0].getConnectedType());
	
	if(connectedType == "Bitmap1bit")
		picture->Assign(const_cast<Graphics::TBitmap*>(&(IBitmap1bit::getBitmap(aBlock->input[0].getObject()))));

	else	if(connectedType == "Bitmap4bit")
		picture->Assign(const_cast<Graphics::TBitmap*>(&(IBitmap4bit::getBitmap(aBlock->input[0].getObject()))));

	else	if(connectedType == "Bitmap8bit")
		picture->Assign(const_cast<Graphics::TBitmap*>(&(IBitmap8bit::getBitmap(aBlock->input[0].getObject()))));

	else	if(connectedType == "Bitmap16bit")
		picture->Assign(const_cast<Graphics::TBitmap*>(&(IBitmap16bit::getBitmap(aBlock->input[0].getObject()))));

	else	if(connectedType == "Bitmap24bit")
		picture->Assign(const_cast<Graphics::TBitmap*>(&(IBitmap24bit::getBitmap(aBlock->input[0].getObject()))));

	else	if(connectedType == "Bitmap32bit")
		picture->Assign(const_cast<Graphics::TBitmap*>(&(IBitmap32bit::getBitmap(aBlock->input[0].getObject()))));

	int mode=aBlock->getConfig()->getInt("mode");

	if(mode == 0)
	{
		if(!Binarization(picture))
		{
			aBlock->output[0].setErrorCode(2);
			aBlock->output[0].setErrorDescription("Pusta bitmapa");
			picture->Free();
			return 2;
		}
	}
	else
	{
		int limitB(aBlock->getConfig()->getInt("limitB"));
		if(!BinarizationBalance(picture,limitB,clWhite,clBlack))
		{
			aBlock->output[0].setErrorCode(2);
			aBlock->output[0].setErrorDescription("Pusta bitmapa");
			picture->Free();
			return 2;
		}
	}
    
	TypeConfig* copy = IBitmap1bit::getNew();

	IBitmap1bit::setBitmap(copy, *picture);
	aBlock->output[0].setObject(*copy);

	picture->Free();
	delete copy;

	return 0;
}
开发者ID:ClockMan,项目名称:edytorgraficzny,代码行数:61,代码来源:binarization_dll.cpp


示例2: FormCreate

//---------------------------------------------------------------------------
void __fastcall TFormMain::FormCreate(TObject *Sender)
{
  SetFileName("");
  PaintBox->ControlStyle = PaintBox->ControlStyle << csOpaque;
  SetZoom(11);

  Graphics::TBitmap* BM = new Graphics::TBitmap;
  __try
  {
    BM->Width = 64;
    BM->Height = 64;
    
    for (int i = 0; i < YETI_TEXTURE_MAX; i++)
    {
      for (int y = 0; y < 64; y++)
      {
        for (int x = 0; x < 64; x++)
        {
          int c = textures[i][y][x];
          BM->Canvas->Pixels[x][y] = (TColor) RGB(
            palette[c][0], palette[c][1], palette[c][2]);
        }
      }
      TListItem* LI = ListView->Items->Add();
      LI->Caption = String("#") + i;
      LI->ImageIndex = ILTextures->Add(BM, NULL);
    }
  }
  __finally
  {
    BM->Free();
  }
  ListView->ItemIndex = 0;
}
开发者ID:noname22,项目名称:megadrive-gcc,代码行数:35,代码来源:UnitMain.cpp


示例3: mruBkImagePropertiesButtonClick

void __fastcall TCustomDrawDemoEditorForm::mruBkImagePropertiesButtonClick(
      TObject *Sender)
{
  if (OpenDialog->Execute()){
    Graphics::TBitmap *ABitmap = new Graphics::TBitmap();
    ABitmap->LoadFromFile(OpenDialog->FileName);
    GetSelectedDrawItem()->Bitmap = ABitmap;
    ((TcxCustomEdit*)Sender)->EditValue = "User Defined";
    CustomDrawDemoMainForm->cxDBVerticalGrid->Invalidate();
  }
}
开发者ID:chinnyannieb,项目名称:Meus-Projetos,代码行数:11,代码来源:CustomDrawDemoEditor.cpp


示例4: LoadImageFromRes

void LoadImageFromRes(Graphics::TBitmap* ABitmap, String AResName)
{
    Graphics::TBitmap* Bitmap = new Graphics::TBitmap();
    TResourceStream* Rs = new TResourceStream((int)HInstance, AResName, PChar(RT_RCDATA));
    try {
        Bitmap->LoadFromStream(Rs);
        ABitmap->Assign(Bitmap);
    }
    __finally {
        delete Bitmap;
        delete Rs;
    }
}
开发者ID:chinnyannieb,项目名称:Meus-Projetos,代码行数:13,代码来源:CustomDrawDemoUtils.cpp


示例5: convert

/** basically, it converts =)
    it's just a converter, basically */
void convert (AnsiString textfile, AnsiString bmpfile)
{
    int i,j,left=5,top=5,x=left,y=top;
    Graphics::TBitmap *Bitmap = new Graphics::TBitmap;
    TExprClass *Expr;
    char Str[10000];

    Bitmap->Width = 1000;
    Bitmap->Height = 4000;

    TList *Text = loadText(textfile, new TList);
#ifdef DEBUG
    for(int i=0; i<Text->Count; ++i)
        printf("\"%s\"\n", (char *)Text->Items[i]);
#endif

    /*
    Text->Add("String(\"# Тема - JOB \")");
    Text->Add("String(\"Вариант   1, задача 1.\")");
    Text->Add("String(\"Вычислить предел:\")");
    Text->Add("lim(x->4, (-3*x^2+15*x)/(3*x^2+15*x))=...");
    Text->Add("String(@Часть преподавателя )");
    Text->Add("String(\"Тема - JOB \")");
    Text->Add("String(ВАРИАНТ 1, решение задачи 1, ключ 865)");
    Text->Add("lim(x->4, (-3*x^2+15*x)/(3*x^2+15*x))=(1/9)");
    */

    TFont *font = new TFont;
    font->PixelsPerInch = 1000;
    font->Name = "Trebuchet MS";
    font->Size=10;
    for(i=0; i<Text->Count; i++)
    {
        strcpy(Str, (char*)Text->Items[i]);
        Expr = BuildExpr(Str);
        Expr->Canvas = Bitmap->Canvas;
        Expr->Font = font;
        Expr->Draw(left, y, 1000, 4000);
        y = y + Expr->Height;
        if (x<Expr->Width)
            x = Expr->Width;
        delete Expr;
    }
    Bitmap->Width = x+left + 5;
    Bitmap->Height = y + 5;
    Bitmap->SaveToFile(bmpfile);
    delete Bitmap;
    delete font;
}
开发者ID:F1-GTR,项目名称:mentor-old,代码行数:51,代码来源:txt2bmp.cpp


示例6:

Pixmap::Pixmap(const string &f){
        Graphics::TBitmap* AuxBMP = new Graphics::TBitmap();
        AuxBMP->LoadFromFile(f.c_str());
        cols=AuxBMP->Width;
        rows=AuxBMP->Height;
        matrix = new colorRGBA[cols*rows];
        int c = 0;
        for (int i = 0; i < rows; i++)
                for (int j = 0; j < cols; j++) {
                        c = i * cols + j;
                        matrix[c][0]=GetRValue(AuxBMP->Canvas->Pixels[j][rows-i-1]);
                        matrix[c][1]=GetGValue(AuxBMP->Canvas->Pixels[j][rows-i-1]);
                        matrix[c][2]=GetBValue(AuxBMP->Canvas->Pixels[j][rows-i-1]);
                }
}
开发者ID:HectorGPala,项目名称:Practices-openGL,代码行数:15,代码来源:Pixmap.cpp


示例7: mcmUpdateText

HBITMAP mcmUpdateText(HANDLE hObj, HBITMAP hDest, LPCSTR pText)
{
	ASSERT(hObj);
	ASSERT(hDest);
	CItem *pItem = (CItem *)hObj;

	// Draw object to hDest
	Graphics::TBitmap *pDest = new Graphics::TBitmap;
	pDest->Handle = hDest;
	pDest = pItem->Draw(pDest, pText);

	HBITMAP hb = pDest->ReleaseHandle();
	delete pDest;
	return (hb != hDest) ? hb : NULL;
}
开发者ID:mygaldre,项目名称:mmsstv,代码行数:15,代码来源:TextBox.cpp


示例8: TurnBoard

void __fastcall TMode::TurnBoard ()
{

Graphics::TBitmap *pBitmap = new Graphics::TBitmap();
pBitmap->LoadFromResourceName(0,"board");
Game->Board->Left=0;
Game->Board->Top=0;
Game->Board->Width=pBitmap->Width;
Game->Board->Height=pBitmap->Height;


for(int j=0; j < pBitmap->Height; j++)

Game->Board->Canvas->CopyRect(Rect(0,j,pBitmap->Width,j+1),
pBitmap->Canvas,Rect(0,j,pBitmap->Width,j+1));

delete pBitmap;

}
开发者ID:evgenrus70,项目名称:Evgen,代码行数:19,代码来源:UMode.cpp


示例9: btn_Hue_Img_loadClick

void __fastcall THSVFormOrg::btn_Hue_Img_loadClick(TObject * Sender)
{
    if (!OpenDialog1->Execute())
	return;
    String Fpath;
    //Hue_Img->Picture->LoadFromFile(Fpath);

    Fpath = OpenDialog1->FileName;
    Graphics::TBitmap * Bitmap;

    Graphics::TBitmap * RefGraph;
    RefGraph = new Graphics::TBitmap();
    RefGraph->Height = Hue_Img->Height;
    RefGraph->Width = Hue_Img->Width;
    RefGraph->LoadFromFile(Fpath);
    Hue_Img->Picture->Graphic = RefGraph;
//        Hue_Img->Canvas->Draw(0,0,RefGraph);
    delete RefGraph;

}
开发者ID:beaver999,项目名称:mygoodjob,代码行数:20,代码来源:HueSatVal1.cpp


示例10: WinExec

void __fastcall TMatdet::Button4Click(TObject *Sender)
{
        Graphics::TBitmap * bmv = new Graphics::TBitmap();

        if ( !Memo1->Lines->Count )
                Button1->Click();
        /*Memo1->Lines->SaveToFile("txtout.txt");
        WinExec("txt2bmp.exe",SW_SHOWDEFAULT);
        Preview->Image1->Picture->LoadFromFile("out.bmp");*/

        TxtToBmp( Memo1->Lines, bmv, qvar->FontDialog1->Font, 0, 0 );
        bmv->SaveToFile( "out.bmp" );

        Preview->ImageEnIO1->LoadFromFile( "out.bmp" );
        //Preview->ImageEnProc1->Resample( -1, Screen->Height - 40, rfBSpline );

        unlink( "out.bmp" );
        delete bmv;
        
        Preview->ShowModal();
}
开发者ID:F1-GTR,项目名称:mentor-old,代码行数:21,代码来源:matopr.cpp


示例11:

/*

1. 103	0	241
2. 91	0	241
3.  24	0	240
4.  0	121	231
5.  0	194	209
6.  0	255	164
7.  0	255	0
8.  136	232	0
9.  173	219	0
10. 201	204	0
11. 244	172	0
12. 255	134	0
13. 255	86	0
14. 255	0	0


*/
void __fastcall TMainForm::ViewPalette1Click(TObject *Sender)
{
    Graphics::TBitmap* bmp = new Graphics::TBitmap();

    bmp->Width = 1920;
    bmp->Height = 1080;

    bmp->Canvas->Brush->Color = clWhite;
    TRect rect;
    rect.left = 0;
    rect.top  = 0;
    rect.right = 1920;
    rect.top   = 1080;

    bmp->Canvas->FillRect(rect);
    rect.left = 70;
    rect.top = 60;
    rect.right = 1850;
    rect.bottom = 1050;

    bmp->Canvas->Pen->Color = clRed;
    bmp->Canvas->Pen->Width = 3;
    bmp->Canvas->Rectangle(rect);

    int count = 0;
    for (int y = 0; y < 48; y++)
    {
        for (int x = 0; x < 54; x++)
        {
            if (count >= m_database.Count)/*this->m_Entries->Count*/
                continue;

            TRect r;
            r.left = 80+ x*32;
            r.right = 80+ x*32 +32;
            r.top = 80+ y*26;
            r.Bottom = 80 + y*26+26;
            if (r.top > 500)
            {
                r.top    += 100;
                r.bottom += 100;
            }

            TPantoneColorEntry* ee = m_database.Get(count);//(TPantoneColorEntry*)m_Entries->Items[count];
            bmp->Canvas->Brush->Color =  (TColor)RGB(ee->Red, ee->Green, ee->Blue);
            bmp->Canvas->FillRect(r);
            count++;

        }
    }

    bmp->Canvas->Brush->Color = clBlack;

    rect.left =  800;
    rect.right = 1120;
    rect.top   = 522;
    rect.bottom = 622;

    bmp->Canvas->FillRect(rect);

    /*1*/
    bmp->Canvas->Brush->Color = (TColor)RGB( 103,	0,	241);;

    rect.left =  80;
    rect.right = 100;
    rect.top   = 522;
    rect.bottom = 622;

    bmp->Canvas->FillRect(rect);

    /*2*/
    bmp->Canvas->Brush->Color = (TColor)RGB( 103,	0,	241);;

    rect.left =  100;
    rect.right = 120;
    rect.top   = 522;
    rect.bottom = 622;

    bmp->Canvas->FillRect(rect);
    /*3*/
    bmp->Canvas->Brush->Color = (TColor)RGB( 24,	0,	240);;
//.........这里部分代码省略.........
开发者ID:telnykha,项目名称:Colorimetr,代码行数:101,代码来源:MainUnit.cpp


示例12: run

//---------------------------------------------------------------------------
int __stdcall run(Block *aBlock)
{
	if(aBlock->input.size() != 1 || aBlock->input[0].getConnectedType().IsEmpty())
		return 1;

	Graphics::TBitmap* picture = new Graphics::TBitmap();
	AnsiString connectedType(aBlock->input[0].getConnectedType());
	
	if(connectedType == "Bitmap1bit")
		picture->Assign(const_cast<Graphics::TBitmap*>(&(IBitmap1bit::getBitmap(aBlock->input[0].getObject()))));

	else	if(connectedType == "Bitmap4bit")
		picture->Assign(const_cast<Graphics::TBitmap*>(&(IBitmap4bit::getBitmap(aBlock->input[0].getObject()))));

	else	if(connectedType == "Bitmap8bit")
		picture->Assign(const_cast<Graphics::TBitmap*>(&(IBitmap8bit::getBitmap(aBlock->input[0].getObject()))));

	else	if(connectedType == "Bitmap16bit")
		picture->Assign(const_cast<Graphics::TBitmap*>(&(IBitmap16bit::getBitmap(aBlock->input[0].getObject()))));

	else	if(connectedType == "Bitmap24bit")
		picture->Assign(const_cast<Graphics::TBitmap*>(&(IBitmap24bit::getBitmap(aBlock->input[0].getObject()))));

	else	if(connectedType == "Bitmap32bit")
		picture->Assign(const_cast<Graphics::TBitmap*>(&(IBitmap32bit::getBitmap(aBlock->input[0].getObject()))));
	Graphics::TBitmap** pict;
	if(picture->Width==picture->Height)
	{
		pict = Fimage(picture);
		if(pict[0]==NULL || pict[1]==NULL)//na razie dzial tylko dla obrazow NxN
		{
                aBlock->output[0].setErrorCode(2);
                aBlock->output[0].setErrorDescription("Pusta bitmapa");
                picture->Free();
                return 2;
		}
	}
	else {
                aBlock->output[0].setErrorCode(2);
                aBlock->output[0].setErrorDescription("Bitmapa musi byc kwadratowa");
                picture->Free();
                return 2;
	}

	TypeConfig* copy1;
    TypeConfig* copy2;

    copy1 = IBitmap8bit::getNew();
    IBitmap8bit::setBitmap(copy1, *pict[0]);

    copy2 = IBitmap8bit::getNew();
    IBitmap8bit::setBitmap(copy2, *pict[1]);


	aBlock->output[0].setObject(*copy1);
	aBlock->output[1].setObject(*copy2);
	
	pict[0]->Free();
    pict[1]->Free();
    delete pict;
	delete copy1;
    delete copy2;

	return 0;
}
开发者ID:ClockMan,项目名称:edytorgraficzny,代码行数:66,代码来源:FastFourierTransformate_dll.cpp


示例13: IdTCPServerExecute

//---------------------------------------------------------------------------
void __fastcall TMainForm::IdTCPServerExecute(TIdPeerThread *AThread)
{

    AnsiString s;
    AnsiString sCommand;
    AnsiString sAction;
    TFileStream* tmpfStream;
    Graphics::TBitmap *tbm;

try
{
s = UpperCase(AThread->Connection->ReadLn("",5000));

sCommand = s.SubString (1,3);
sAction = s.SubString(5,s.Length()-4);

if (sCommand == "LST")
   {
    AThread->Connection->WriteLn(GetList());
    AThread->Connection->Disconnect();
   }
else if (sCommand == "PIC")
    {
    if (FileExists(ExtractFileDir(ParamStr(0)) + "\\images\\" + sAction))
        {
        lstRequests->Items->Add("Serving up: " + sAction);
        // open file stream to image requested
        tmpfStream = new TFileStream(ExtractFileDir(ParamStr(0)) + "\\images\\" + sAction,fmOpenRead |fmShareDenyNone);
        // copy file stream to write stream
        AThread->Connection->OpenWriteBuffer(-1);
        AThread->Connection->WriteStream(tmpfStream,true,false);
        AThread->Connection->CloseWriteBuffer();
        // free the file stream
        delete tmpfStream;
        tmpfStream=NULL;
        lstRequests->Items->Add("File transfer completed");
        AThread->Connection->Disconnect();
        }
        else
          {AThread->Connection->WriteLn("ERR - Requested file does not exist");
           AThread->Connection->Disconnect();
          }
    }
else if (sCommand == "SRN")
   {
    // in production version you would use a unique file name such as one generated
    // from a tickcount plus clint IP / id etc.
    // take snapshot
    lstRequests->Items->Add("Taking screen snap shot");

    tbm = new Graphics::TBitmap();

    ScreenShot(0,0,Screen->Width,Screen->Height,tbm);
    if (FileExists (ExtractFileDir(ParamStr(0)) + "\\images\\ScreenShot.BMP"))
        DeleteFile(ExtractFileDir(ParamStr(0)) + "\\images\\ScreenShot.BMP");
    tbm->SaveToFile(ExtractFileDir(ParamStr(0)) + "\\images\\ScreenShot.BMP");
    tbm->FreeImage();
    delete tbm;
    tbm=NULL;

    lstRequests->Items->Add("Serving up: SCREENSHOT.BMP");
    // open file stream to image requested
    tmpfStream = new TFileStream(ExtractFileDir(ParamStr(0)) + "\\images\\ScreenShot.BMP",fmOpenRead | fmShareDenyNone);
    // copy file stream to write stream
    AThread->Connection->OpenWriteBuffer(-1);
    AThread->Connection->WriteStream(tmpfStream,true,false);
    AThread->Connection->CloseWriteBuffer();
    // free the file stream
    delete tmpfStream;
    tmpfStream=NULL;
    lstRequests->Items->Add("File transfer completed");
    AThread->Connection->Disconnect();
    }
else
if ((sCommand != "LST") && (sCommand != "PIC") && (sCommand != "SRN"))
     {
     AThread->Connection->WriteLn("ERR : Unknown command / action");
     AThread->Connection->Disconnect();
     }

     }


catch (Exception& E)
{
ShowMessage(E.Message);
}


}
开发者ID:java-tester-x,项目名称:SendFileHttp,代码行数:91,代码来源:frmMain.cpp


示例14: run

//---------------------------------------------------------------------------
int __stdcall run(Block *aBlock)
{
	if(aBlock->input.size() != 1 || aBlock->input[0].getConnectedType().IsEmpty()||aBlock->getConfig()->getString("path").IsEmpty())
		return 1;

	Graphics::TBitmap* picture = new Graphics::TBitmap();
	AnsiString connectedType(aBlock->input[0].getConnectedType());

	if(connectedType == "Bitmap1bit")
		picture->Assign(const_cast<Graphics::TBitmap*>(&(IBitmap1bit::getBitmap(aBlock->input[0].getObject()))));

	else if(connectedType == "Bitmap4bit")
		picture->Assign(const_cast<Graphics::TBitmap*>(&(IBitmap4bit::getBitmap(aBlock->input[0].getObject()))));

	else	if(connectedType == "Bitmap8bit")
		picture->Assign(const_cast<Graphics::TBitmap*>(&(IBitmap8bit::getBitmap(aBlock->input[0].getObject()))));

	else if(connectedType == "Bitmap16bit")
		picture->Assign(const_cast<Graphics::TBitmap*>(&(IBitmap16bit::getBitmap(aBlock->input[0].getObject()))));

	else	if(connectedType == "Bitmap24bit")
		picture->Assign(const_cast<Graphics::TBitmap*>(&(IBitmap24bit::getBitmap(aBlock->input[0].getObject()))));

	else	if(connectedType == "Bitmap32bit")
		picture->Assign(const_cast<Graphics::TBitmap*>(&(IBitmap32bit::getBitmap(aBlock->input[0].getObject()))));


	AnsiString path(aBlock->getConfig()->getString("path"));
	AnsiString bitrate(aBlock->getConfig()->getString("bitrate"));

	if(bitrate == "Bitmap1bit")
	{
		if(!SaveImage(picture,path,bit_1))
		{
			aBlock->output[0].setErrorCode(2);
			aBlock->output[0].setErrorDescription("B³¹d zapisu obrazu");
			picture->Free();
			return 2;
		}
	}
	else if(bitrate == "Bitmap4bit")
	{
		if(!SaveImage(picture,path,bit_4))
		{
			aBlock->output[0].setErrorCode(2);
			aBlock->output[0].setErrorDescription("B³¹d zapisu obrazu");
			picture->Free();
			return 2;
		}
	}
	else if(bitrate == "Bitmap8bit")
	{
		if(!SaveImage(picture,path,bit_8))
		{
			aBlock->output[0].setErrorCode(2);
			aBlock->output[0].setErrorDescription("B³¹d zapisu obrazu");
			picture->Free();
			return 2;
		}
	}
	else if(bitrate == "Bitmap16bit")
	{
		if(!SaveImage(picture,path,bit_16))
		{
			aBlock->output[0].setErrorCode(2);
			aBlock->output[0].setErrorDescription("B³¹d zapisu obrazu");
			picture->Free();
			return 2;
		}
	}
	else if(bitrate == "Bitmap24bit")
	{
		if(!SaveImage(picture,path,bit_24))
		{
			aBlock->output[0].setErrorCode(2);
			aBlock->output[0].setErrorDescription("B³¹d zapisu obrazu");
			picture->Free();
			return 2;
		}
	}
	else if(bitrate == "Bitmap32bit")
	{
		if(!SaveImage(picture,path,bit_32))
		{
			aBlock->output[0].setErrorCode(2);
			aBlock->output[0].setErrorDescription("B³¹d zapisu obrazu");
			picture->Free();
			return 2;
		}
	}

	picture->Free();
	return 0;	
}
开发者ID:ClockMan,项目名称:edytorgraficzny,代码行数:95,代码来源:SaveImage_dll.cpp


示例15: fileName

// Class functions.
TPresError
TGUIView::SetStyle( const char  *inStyleName )
{
  // Load the colors and widths of view elements from a bitmap resource or file.
  // The rows of the bitmap represent the elements in the order given by
  // the TGUIElements enumeration in GUI.h. An element's width is taken
  // by counting the number of pixels in its row that have the same color
  // as the leftmost one.

  if( inStyleName == NULL || *inStyleName == '\0' )
    return presNoError;

  TPresError  result = presNoError;
  Graphics::TBitmap   *bitmap = new Graphics::TBitmap();

  std::string fileName( inStyleName );
  for( std::string::iterator i = fileName.begin(); i != fileName.end(); ++i )
    *i = toupper( *i );
  fileName += ".BMP";

  // Look for a bitmap resource for the style given.
  try
  {
    bitmap->LoadFromResourceName( ( int )HInstance, fileName.c_str() );
  }
  catch( const EResNotFound& )
  {
    result = presResNotFoundError;
  }

  // No resource found, look for a bitmap file in the application default path.
  if( result == presResNotFoundError )
  {
    result = presNoError;
    try
    {
      bitmap->LoadFromFile( fileName.c_str() );
    }
    catch( ... )
    {
      result = presFileOpeningError;
    }
  }

  // No file found, look in the resource directory.
  if( result == presFileOpeningError )
  {
    result = presNoError;

    Util::TPath curPath;
    fileName = curPath + fileName;

    try
    {
      bitmap->LoadFromFile( fileName.c_str() );
    }
    catch( ... )
    {
      result = presFileOpeningError;
      gPresErrors.AddError( result, fileName.c_str() );
    }
  }

  if( result == presNoError )
  {
    for( int i = 0; i < MIN( int( numGUIElements ), bitmap->Height ); ++i )
    {
      TColor  curColor = bitmap->Canvas->Pixels[ 0 ][ i ];
      ElementColors[ i ].cl = curColor;
      int j = 0;
      while( j < bitmap->Width && bitmap->Canvas->Pixels[ j ][ i ] == curColor )
        ++j;
      ElementWidths[ i ] = j;
    }
  }

  delete bitmap;
  return result;
}
开发者ID:el-fran,项目名称:weka-bci2000,代码行数:80,代码来源:GUIView.cpp


示例16: Execute

// ---------------------------------------------------------------------------
void __fastcall ShmThread::Execute()
{
    NameThreadForDebugging("ShmThread");

    status = shmbuf;
    cmd = shmbuf +sizeof(char);
    data = shmbuf +sizeof(char)+sizeof(char);
    shmbuf[0] = SHM_READY;
    shme->ResetEvent();

    while (1)
    {
        shme->WaitFor(INFINITE);

        if (status[0] != SHM_RREADY)
        {
            deb("shm signaled");
            shme->ResetEvent();
            continue;
        }

        // deb("shm cmd %d", cmd[0]);

        shme->ResetEvent();
        // Synchronize(Do);
        // shme->SetEvent();
        // }
        // }
        //
        // void __fastcall ShmThread::Do(void)
        // {

        if (!shmbuf)
        {
            MessageBox(Application->MainFormHandle, "error no shmbuf", "err", MB_OK);
            ExitProcess(0);
        }

        switch(cmd[0])
        {
            case LO_UPDWNDPIC:
            // deb("L:O_UPDWNDPIC");
            // ReadFile(hPipe, &hid, sizeof(hid), &dwRead, false);
            HANDLE hid;
            LPVOID p;
            HDC hdc;
            BITMAPINFO *pbmi;
            LPVOID dbuf;
            Graphics::TBitmap *ub;

            memcpy(&hid, data, sizeof(hid));
            // data += sizeof(HANDLE);

            bool fail;
            fail = false;
            wcs->Acquire();
            bool found;
            found = false;
            WNDBUTTONS *pwnd;
            pwnd = NULL;

            try
            {
                pwnd = (WNDBUTTONS*)hid;
                for (wnd_buttons_v::iterator it = wnd_buttons.begin();it!=wnd_buttons.end();it++)
                {
                    // deb("%x > %x",(*it)->id,hid);

                    if ((*it)->id == hid)
                    {
                        // deb("found %x",hid);
                        found = true;
                        break;
                    }
                }

                if (!found || IsBadReadPtr(pwnd, sizeof(WNDBUTTONS)))
                {
                    fail = true;
                }
                else
                {

                    // deb(" LO_UPDWNDPIC => %x ", pwnd);
                    // deb("%d:%d", pwnd->rect.left, pwnd->rect.top);

                    if (pwnd->pic)
                    {
                        // deb(" SHM:LO_UPDWNDPIC @ %p deleting %p", pwnd, pwnd->pic);
                        delete pwnd->pic;

                    }

                    ub = new Graphics::TBitmap();

                    pbmi = (BITMAPINFO*)(data +sizeof(HANDLE));
                    dbuf = data +sizeof(BITMAPINFO)+sizeof(HANDLE);

                    hdc = CreateCompatibleDC(0);
//.........这里部分代码省略.........
开发者ID:kilitary,项目名称:form,代码行数:101,代码来源:ShmThread.cpp


示例17: run

//---------------------------------------------------------------------------
int __stdcall run(Block *aBlock)
{
	if(aBlock->input.size() != 1 || aBlock->input[0].getConnectedType().IsEmpty())
		return 1;

	Graphics::TBitmap* picture = new Graphics::TBitmap();
	AnsiString connectedType(aBlock->input[0].getConnectedType());
	
	if(connectedType == "Bitmap1bit")
		picture->Assign(const_cast<Graphics::TBitmap*>(&(IBitmap1bit::getBitmap(aBlock->input[0].getObject()))));

	else if(connectedType == "Bitmap4bit")
		picture->Assign(const_cast<Graphics::TBitmap*>(&(IBitmap4bit::getBitmap(aBlock->input[0].getObject()))));

	else	if(connectedType == "Bitmap8bit")
		picture->Assign(const_cast<Graphics::TBitmap*>(&(IBitmap8bit::getBitmap(aBlock->input[0].getObject()))));

	else if(connectedType == "Bitmap16bit")
		picture->Assign(const_cast<Graphics::TBitmap*>(&(IBitmap16bit::getBitmap(aBlock->input[0].getObject()))));

	else	if(connectedType == "Bitmap24bit")
		picture->Assign(const_cast<Graphics::TBitmap*>(&(IBitmap24bit::getBitmap(aBlock->input[0].getObject()))));

	else	if(connectedType == "Bitmap32bit")
		picture->Assign(const_cast<Graphics::TBitmap*>(&(IBitmap32bit::getBitmap(aBlock->input[0].getObject()))));

	if(!InversionColors(picture))
	{
		aBlock->output[0].setErrorCode(2);
		aBlock->output[0].setErrorDescription("Pusta bitmapa");
		picture->Free();
		return 2;
	}
    
	TypeConfig* copy;

	if(connectedType == "Bitmap1bit")
	{
		copy = IBitmap1bit::getNew();
		IBitmap1bit::setBitmap(copy, *picture);
	}
	else if(connectedType == "Bitmap4bit")
	{
		copy = IBitmap4bit::getNew();
		IBitmap4bit::setBitmap(copy, *picture);
	}
	else if(connectedType == "Bitmap8bit")
	{
		copy = IBitmap8bit::getNew();
		IBitmap8bit::setBitmap(copy, *picture);
	}
	else if(connectedType == "Bitmap16bit")
	{
		copy = IBitmap16bit::getNew();
		IBitmap16bit::setBitmap(copy, *picture);
	}
	else if(connectedType == "Bitmap24bit")
	{
		copy = IBitmap24bit::getNew();
		IBitmap24bit::setBitmap(copy, *picture);
	}
	else if(connectedType == "Bitmap32bit")
	{
		copy = IBitmap32bit::getNew();
		IBitmap32bit::setBitmap(copy, *picture);
	}

	aBlock->output[0].setObject(*copy);
	
	picture->Free();
	delete copy;

	return 0;
}
开发者ID:ClockMan,项目名称:edytorgraficzny,代码行数:75,代码来源:negative_dll.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ graphics::VertexArray类代码示例发布时间:2022-05-31
下一篇:
C++ graphics::Surface类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap