本文整理汇总了C++中JPainter::Image方法的典型用法代码示例。如果您正苦于以下问题:C++ JPainter::Image方法的具体用法?C++ JPainter::Image怎么用?C++ JPainter::Image使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JPainter
的用法示例。
在下文中一共展示了JPainter::Image方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CellToSymbolIndex
void
CBSymbolTable::TableDrawCell
(
JPainter& p,
const JPoint& cell,
const JRect& rect
)
{
HilightIfSelected(p, cell, rect);
const JIndex symbolIndex = CellToSymbolIndex(cell);
CBLanguage lang;
CBSymbolList::Type type;
const JString& symbolName =
itsSymbolList->GetSymbol(symbolIndex, &lang, &type);
const JString* signature;
itsSymbolList->GetSignature(symbolIndex, &signature);
if (CalcColWidths(symbolName, signature))
{
AdjustColWidths();
}
const JXImage* icon = NULL;
const JFontStyle& style = (CBGetSymbolTypeList())->GetStyle(type, &icon);
// draw icon
if (icon != NULL)
{
JRect r = rect;
r.right = r.left + kIconWidth;
p.Image(*icon, icon->GetBounds(), r);
}
// draw name
p.SetFontStyle(style);
JRect r = rect;
r.left += kIconWidth + kHMarginWidth;
p.String(r, symbolName, JPainter::kHAlignLeft, JPainter::kVAlignCenter);
if (signature != NULL)
{
r.left += (GetFontManager())->GetStringWidth(
JGetDefaultFontName(), kJDefaultFontSize, JFontStyle(), symbolName);
p.String(r, *signature, JPainter::kHAlignLeft, JPainter::kVAlignCenter);
}
}
示例2: if
void
GLFitDescriptionList::TableDrawCell
(
JPainter& p,
const JPoint& cell,
const JRect& rect
)
{
HilightIfSelected(p, cell, rect);
const JString* curveName = itsNameList->NthElement(cell.y);
const GLFitDescription& fd = GetFitManager()->GetFitDescription(cell.y);
JRect irect = rect;
irect.right = rect.left + kIconWidth;
if (fd.GetType() == GLFitDescription::kPolynomial)
{
p.Image(*itsPolyIcon, itsPolyIcon->GetBounds(), irect);
}
else if (fd.GetType() == GLFitDescription::kNonLinear)
{
p.Image(*itsNonLinearIcon, itsNonLinearIcon->GetBounds(), irect);
}
else if (fd.GetType() == GLFitDescription::kModule)
{
p.Image(*itsExecutableIcon, itsExecutableIcon->GetBounds(), irect);
}
else if (fd.GetType() >= GLFitDescription::kBLinear)
{
p.Image(*itsBuiltInIcon, itsBuiltInIcon->GetBounds(), irect);
}
JRect r = rect;
r.left += kHMarginWidth + kIconWidth;
p.String(r, *curveName, JPainter::kHAlignLeft, JPainter::kVAlignCenter);
}
示例3: ellipseRect
void
TestWidget::DrawStuff
(
JPainter& p
)
{
JIndex i;
JXColormap* colormap = GetColormap();
p.SetPenColor(colormap->GetGreenColor());
JRect ellipseRect(100,50,150,300);
p.Ellipse(ellipseRect);
p.SetPenColor(colormap->GetBlackColor());
if (itsFillFlag)
{
p.SetFilling(kJTrue);
}
JRect ap = GetAperture();
p.Line(ap.topLeft(), ap.bottomRight());
p.Line(ap.topRight(), ap.bottomLeft());
p.SetLineWidth(2);
p.SetFontName("Times");
p.SetFontSize(18);
p.Image(*itsHomeImage, itsHomeImage->GetBounds(), itsHomeRect);
its2Rect = JRect(150, 5, 200, 30);
p.SetPenColor(colormap->GetRedColor());
p.Rect(its2Rect);
p.SetFontStyle(colormap->GetRedColor());
p.String(its2Rect.topLeft(), "2",
its2Rect.width(), JPainter::kHAlignCenter,
its2Rect.height(), JPainter::kVAlignCenter);
its3Rect = JRect(10, 150, 40, 200);
p.SetPenColor(colormap->GetBlueColor());
p.Rect(its3Rect);
p.SetFontStyle(colormap->GetBlueColor());
p.String(its3Rect.topLeft(), "3",
its3Rect.width(), JPainter::kHAlignCenter,
its3Rect.height(), JPainter::kVAlignCenter);
p.SetLineWidth(1);
p.SetFont(GetFontManager()->GetDefaultFont());
p.ShiftOrigin(10,10);
p.Point(0,0);
for (i=1; i<=itsRandPointCount; i++)
{
p.Point(itsRNG.UniformLong(0,200), itsRNG.UniformLong(0,200));
}
p.SetPenColor(colormap->GetRedColor());
p.Line(10,0, 0,10);
p.SetPenColor(colormap->GetGreenColor());
p.LineTo(10,20);
p.SetPenColor(colormap->GetBlueColor());
p.LineTo(0,30);
p.ShiftOrigin(2,0);
JPoint textPt(40,30);
p.String( 0.0, textPt, "Hello");
p.String( 90.0, textPt, "Hello");
p.String(180.0, textPt, "Hello");
p.String(270.0, textPt, "Hello");
p.ShiftOrigin(-2, 0);
p.SetPenColor(colormap->GetBlueColor());
JRect r(70, 290, 150, 390);
p.Rect(r);
/*
for (JCoordinate y=70; y<150; y++)
{
p.SetPenColor(colormap->GetGrayColor(y-50));
p.Line(290,y, 390,y);
}
for (JCoordinate x=290; x<390; x++)
{
p.SetPenColor(colormap->GetGrayColor(x-290));
p.Line(x,70, x,150);
}
p.SetLineWidth(2);
for (JCoordinate y=70; y<150; y+=2)
{
p.SetPenColor(colormap->GetGrayColor(y%4 ? 40 : 60));
p.Line(290,y, 390,y);
}
p.SetLineWidth(1);
p.SetLineWidth(2);
//.........这里部分代码省略.........
示例4: ellipseRect
void
TestWidget::DrawStuff
(
JPainter& p
)
{
JIndex i;
JXColormap* colormap = GetColormap();
p.SetPenColor(colormap->GetGreenColor());
JRect ellipseRect(100,50,150,300);
p.Ellipse(ellipseRect);
p.SetPenColor(colormap->GetBlackColor());
if (itsFillFlag)
{
p.SetFilling(kJTrue);
}
JRect ap = GetAperture();
p.Line(ap.topLeft(), ap.bottomRight());
p.Line(ap.topRight(), ap.bottomLeft());
p.SetLineWidth(2);
p.SetFontName(JXGetTimesFontName());
p.SetFontSize(18);
p.Image(*itsHomeImage, itsHomeImage->GetBounds(), itsHomeRect);
its2Rect = JRect(150, 5, 200, 30);
p.SetPenColor(colormap->GetRedColor());
p.Rect(its2Rect);
p.SetFontStyle(colormap->GetRedColor());
p.String(its2Rect.topLeft(), "2",
its2Rect.width(), JPainter::kHAlignCenter,
its2Rect.height(), JPainter::kVAlignCenter);
its3Rect = JRect(10, 150, 40, 200);
p.SetPenColor(colormap->GetBlueColor());
p.Rect(its3Rect);
p.SetFontStyle(colormap->GetBlueColor());
p.String(its3Rect.topLeft(), "3",
its3Rect.width(), JPainter::kHAlignCenter,
its3Rect.height(), JPainter::kVAlignCenter);
p.SetLineWidth(1);
p.SetFont(JGetDefaultFontName(), kJXDefaultFontSize, colormap->GetBlackColor());
p.ShiftOrigin(10,10);
p.Point(0,0);
for (i=1; i<=itsRandPointCount; i++)
{
p.Point(itsRNG.UniformLong(0,200), itsRNG.UniformLong(0,200));
}
p.SetPenColor(colormap->GetRedColor());
p.Line(10,0, 0,10);
p.SetPenColor(colormap->GetGreenColor());
p.LineTo(10,20);
p.SetPenColor(colormap->GetBlueColor());
p.LineTo(0,30);
p.ShiftOrigin(2,0);
JPoint textPt(40,30);
p.String( 0.0, textPt, "Hello");
p.String( 90.0, textPt, "Hello");
p.String(180.0, textPt, "Hello");
p.String(270.0, textPt, "Hello");
p.Rect(310, 70, 80, 80);
p.String( 0.0, 310, 70, "Hello", 80, JPainter::kHAlignCenter,
80, JPainter::kVAlignCenter);
p.String( 90.0, 310,150, "Hello", 80, JPainter::kHAlignCenter,
80, JPainter::kVAlignCenter);
p.String(180.0, 390,150, "Hello", 80, JPainter::kHAlignCenter,
80, JPainter::kVAlignCenter);
p.String(270.0, 390, 70, "Hello", 80, JPainter::kHAlignCenter,
80, JPainter::kVAlignCenter);
p.Rect(200, 10, 100, 50);
p.String(200, 10, "Hello", 100, JPainter::kHAlignLeft);
p.String(200, 10+p.GetLineHeight(), "Hello", 100, JPainter::kHAlignCenter);
p.String(200, 10+2*p.GetLineHeight(), "Hello", 100, JPainter::kHAlignRight);
p.SetPenColor(colormap->GetYellowColor());
JRect r(0,11,80,91);
p.Rect(r);
r.Shrink(1,1);
p.SetPenColor(colormap->GetBlueColor());
p.Ellipse(r);
r.Shrink(1,1);
p.SetPenColor(colormap->GetRedColor());
p.Arc(r, 270.0-45.0, -270.0);
JPolygon poly;
poly.AppendElement(JPoint(0,85));
//.........这里部分代码省略.........
示例5: if
void
JXTextMenuTable::TableDrawCell
(
JPainter& p,
const JPoint& cell,
const JRect& origRect
)
{
JRect rect = AdjustRectForSeparator(cell.y, origRect);
if (cell.x == kCheckboxColumnIndex)
{
rect.left += kHilightBorderWidth;
DrawCheckbox(p, cell.y, rect);
}
else if (cell.x == kImageColumnIndex)
{
const JXImage* image;
if (itsTextMenuData->GetImage(cell.y, &image))
{
p.Image(*image, image->GetBounds(), rect);
}
}
else if (cell.x == kTextColumnIndex)
{
JIndex ulIndex;
JFontID id;
JSize size;
JFontStyle style;
const JString& text =
itsTextMenuData->GetText(cell.y, &ulIndex, &id, &size, &style);
if (!itsTextMenuData->IsEnabled(cell.y))
{
style.color = (GetColormap())->GetInactiveLabelColor();
}
p.SetFont(id, size, style);
rect.left += kHMarginWidth;
JXWindowPainter* xp = dynamic_cast<JXWindowPainter*>(&p);
assert( xp != NULL );
xp->String(rect.left, rect.top, text, ulIndex,
rect.width(), JPainter::kHAlignLeft,
rect.height(), JPainter::kVAlignCenter);
}
else if (cell.x == kSubmenuColumnIndex && itsTextMenuData->HasSubmenu(cell.y))
{
rect.right -= kHilightBorderWidth;
rect.left = rect.right - JXMenuTable::kSubmenuColWidth;
DrawSubmenuIndicator(p, cell.y, rect,
JConvertToBoolean(((JIndex) cell.y) == itsHilightRow));
}
else if (cell.x == kSubmenuColumnIndex)
{
const JString* nmShortcut;
JFontID id;
JSize size;
JFontStyle style;
if (itsTextMenuData->GetNMShortcut(cell.y, &nmShortcut, &id, &size, &style))
{
if (!itsTextMenuData->IsEnabled(cell.y))
{
style.color = (GetColormap())->GetInactiveLabelColor();
}
p.SetFont(id, size, style);
rect.left += kHNMSMarginWidth;
rect.right -= kHilightBorderWidth;
p.String(rect, *nmShortcut, JPainter::kHAlignLeft, JPainter::kVAlignCenter);
}
}
}