本文整理汇总了C++中TImage::GetHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ TImage::GetHeight方法的具体用法?C++ TImage::GetHeight怎么用?C++ TImage::GetHeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TImage
的用法示例。
在下文中一共展示了TImage::GetHeight方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadAnyTexture
bool loadAnyTexture(CMzString &filename, Texture* tex )
{
TImage img;
char strTexPath[_MAX_PATH];
wcstombs(strTexPath, filename.C_Str(), _MAX_PATH);
bool ret = false;
if(img.LoadFromFile(strTexPath))
{
img.Bind2DTexture(tex->tex);
ret = true;
}
tex->w = img.GetWidth() ;
tex->h = img.GetHeight();
return ret;
}
示例2: plot_logo
void plot_logo( Float_t v_scale = 1.0, Float_t skew = 1.0 )
{
TImage *img = findImage("tmva_logo.gif");
if (!img) {
cout << "+++ Could not open image tmva_logo.gif" << endl;
return;
}
img->SetConstRatio(kFALSE);
UInt_t h_ = img->GetHeight();
UInt_t w_ = img->GetWidth();
Float_t r = w_/h_;
gPad->Update();
Float_t rpad = Double_t(gPad->VtoAbsPixel(0) - gPad->VtoAbsPixel(1))/(gPad->UtoAbsPixel(1) - gPad->UtoAbsPixel(0));
r *= rpad;
Float_t d = 0.055;
// absolute coordinates
Float_t x1R = 1 - gStyle->GetPadRightMargin();
Float_t y1B = 1 - gStyle->GetPadTopMargin()+.01; // we like the logo to sit a bit above the histo
Float_t x1L = x1R - d*r/skew;
Float_t y1T = y1B + d*v_scale*skew;
if (y1T>0.99) y1T = 0.99;
TPad *p1 = new TPad("imgpad", "imgpad", x1L, y1B, x1R, y1T );
p1->SetRightMargin(0);
p1->SetBottomMargin(0);
p1->SetLeftMargin(0);
p1->SetTopMargin(0);
p1->Draw();
Int_t xSizeInPixel = p1->UtoAbsPixel(1) - p1->UtoAbsPixel(0);
Int_t ySizeInPixel = p1->VtoAbsPixel(0) - p1->VtoAbsPixel(1);
if (xSizeInPixel<=25 || ySizeInPixel<=25) {
delete p1;
return; // ROOT doesn't draw smaller than this
}
p1->cd();
img->Draw();
}
示例3: rose_image
void rose_image()
{
// Display image in a new canvas and pad.
TImage *img = TImage::Open("rose512.jpg");
if (!img) {
printf("Could not create an image... exit\n");
return;
}
img->SetConstRatio(0);
img->SetImageQuality(TAttImage::kImgBest);
TString fp = gEnv->GetValue("Root.TTFontPath", "");
TString bc = fp + "/BlackChancery.ttf";
TString ar = fp + "/arial.ttf";
// draw text over image with funny font
img->DrawText(120, 160, "Hello World!", 32,
gROOT->GetColor(4)->AsHexString(),
bc, TImage::kShadeBelow);
// draw text over image with foreground specified by pixmap
img->DrawText(250, 350, "goodbye cruel world ...", 24, 0,
ar, TImage::kPlain, "fore.xpm");
TImage *img2 = TImage::Open("mditestbg.xpm");
// tile image
img2->Tile(img->GetWidth(), img->GetHeight());
c1 = new TCanvas("rose512", "examples of image manipulations", 760, 900);
c1->Divide(2, 3);
c1->cd(1);
img->Draw("xxx");
img->SetEditable(kTRUE);
c1->cd(2);
// averaging with mditestbg.xpm image
TImage *img3 = (TImage*)img->Clone("img3");
img3->Merge(img2, "allanon");
img3->Draw();
// contrasting (tint with itself)
c1->cd(3);
TImage *img4 = (TImage*)img->Clone("img4");
img4->Merge(img4, "tint");
// draw filled rectangle with magenta color
img4->FillRectangle("#FF00FF", 20, 220, 40, 40);
// Render multipoint alpha-blended gradient (R->G->B)
img4->Gradient(0, "#FF0000 #00FF00 #220000FF", 0, 50, 50, 100, 100);
// draw semi-transparent 3D button
img4->Bevel(300, 20, 160, 40, "#ffffffff", "#fe000000", 3, 0);
img4->DrawLine(10, 100, 100, 10, "#0000ff", 4);
img4->Draw();
// vectorize image. Reduce palette to 256 colors
c1->cd(4);
TImage *img5 = (TImage*)img->Clone("img5");
img5->Vectorize(256);
img5->Draw();
// quantization of the image
c1->cd(5);
TImage *img6 = (TImage*)img->Clone("img6");
TImagePalette *pal = (TImagePalette *)&img5->GetPalette();
TArrayD *arr = img6->GetArray(50, 40, pal);
img6->SetImage(arr->GetArray(), 50, 40, pal);
img6->Draw();
// HSV adjustment (convert red to yellow)
c1->cd(6);
TImage *img7 = (TImage*)img->Clone("img7");
img7->HSV(0, 40, 40);
img7->Draw();
}
示例4: trans_graph
void trans_graph()
{
// remember if we are in batch mode
Bool_t batch = gROOT->IsBatch();
// switch to batch mode
gROOT->SetBatch(kTRUE);
// execute graph.C macro
gROOT->Macro("$ROOTSYS/tutorials/graphs/graph.C");
// create gVirtualPS object
TImageDump dmp("dummy.png");
TImage *fore = dmp.GetImage(); // image associated with image_dump
// resize canvas
gPad->SetCanvasSize(400, 300);
gPad->Paint(); // paint gPad on fore image associated with TImageDump
// open background image
TImage *back = TImage::Open("$ROOTSYS/tutorials/image/rose512.jpg");
// choose colors to be transparent
TColor *bk1 = gROOT->GetColor(gPad->GetFillColor());
TColor *bk2 = gROOT->GetColor(gPad->GetFrame()->GetFillColor());
UInt_t rgb1 = color2rgb(bk1);
UInt_t rgb2 = color2rgb(bk2);
// get directly accessible ARGB array
UInt_t *argb = fore->GetArgbArray();
UInt_t w = fore->GetWidth();
UInt_t h = fore->GetHeight();
// scan all pixels in fore image and
// make rgb1, rgb2 colors transparent.
for (UInt_t i = 0; i < h; i++) {
for (UInt_t j = 0; j < w; j++) {
Int_t idx = i*w + j;
// RGB part of ARGB color
UInt_t col = argb[idx] & 0xffffff;
// 24..31 bits define transparency of the color in the range 0 - 0xff
// for example, 0x00000000 - black color with 100% transparency
// 0xff000000 - non-transparent black color
if ((col == rgb1) || (col == rgb2)) { //
argb[idx] = 0; // 100% transparent
} else {
argb[idx] = 0xff000000 + col; // make other pixels non-transparent
}
}
}
// alphablend back and fore images
back->Merge(fore, "alphablend", 20, 20);
// write result image in PNG format
back->WriteImage("trans_graph.png");
printf("*************** File trans_graph.png created ***************\n");
delete back;
// switch back to GUI mode
if (!batch) gROOT->SetBatch(kFALSE);
}