本文整理汇总了C++中Draw类的典型用法代码示例。如果您正苦于以下问题:C++ Draw类的具体用法?C++ Draw怎么用?C++ Draw使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Draw类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Paint
virtual void Paint(Draw& w, const Rect& r, const Value& q,
Color ink, Color paper, dword style) const
{
w.DrawRect(r, paper);
Image m = q;
if(IsNull(m))
return;
Size isz = m.GetSize();
if(isz.cx > 200 || isz.cy > 200)
m = IconDesImg::LargeImage();
else
if(isz.cx > r.GetWidth() || isz.cy > r.GetHeight())
m = CachedRescale(m, GetFitSize(m.GetSize(), r.GetSize()));
Point p = r.CenterPos(m.GetSize());
w.DrawImage(p.x, p.y, m);
}
示例2: GetSize
void ImageCtrl::Paint(Draw& w)
{
if(!img) return;
Size sz = GetSize();
Size bsz = GetStdSize();
w.DrawImage((sz.cx - bsz.cx) / 2, (sz.cy - bsz.cy) / 2, img);
}
示例3: GetX
void GCDCGraphs::DrawRemarksBitmaps(wxGraphicsContext &dc) {
Draw* draw = m_draws_wdg->GetSelectedDraw();
if (draw == NULL)
return;
const ValuesTable& vt = draw->GetValuesTable();
for (size_t i = 0; i < draw->GetValuesTable().size(); i++)
if (vt.at(i).m_remark) {
double x = GetX(i);
dc.DrawBitmap(m_remark_flag_bitmap,
x - m_remark_flag_bitmap.GetWidth() / 2,
m_screen_margins.topmargin - 7,
m_remark_flag_bitmap.GetWidth(),
m_remark_flag_bitmap.GetHeight());
}
}
示例4: onClick
virtual bool onClick(Click* click) {
if (Click::kUp_State == click->fState) {
if (click->isType("maker")) {
if (SkPoint::Distance(click->fOrig, click->fCurr) > SkIntToScalar(3)) {
*fList.append() = fDraw;
} else {
fDraw->unref();
}
fDraw = NULL;
}
return true;
}
if (Click::kDown_State == click->fState) {
SkPaint p = fFactory->getPaint();
p.setColor(this->randColor());
fFactory->setPaint(p);
}
if (click->isType("maker")) {
this->setDraw(fFactory->create(click->fOrig, click->fCurr))->unref();
} else if (click->isType("dragger")) {
for (Draw** iter = fList.begin(); iter < fList.end(); iter++) {
if ((*iter)->isSelected()) {
(*iter)->offset(click->fCurr.x() - click->fPrev.x(),
click->fCurr.y() - click->fPrev.y());
}
}
}
this->inval(NULL);
return true;
}
示例5: Paint2
virtual void Paint2(Draw& w) {
Size sz = GetSize();
w.DrawRect(GetSize(), White());
static GdkColormap* cm = gdk_x11_colormap_foreign_new(
gdkx_visual_get(XVisualIDFromVisual(Xvisual)), Xcolormap);
GdkWindow *gw = gdk_window_foreign_new(w.GetDrawable());
GtkStyle *style = gtk_widget_get_style((GtkWidget *)gtk__parent());
GdkRectangle r;
r.x = r.y = 0;
r.width = r.height = 64;
gtk_paint_box(style, gw,
(GtkStateType)0, (GtkShadowType)0, &r,
(GtkWidget*)GTK().gtk_button_new(), "button",
0, 0, 64, 64);
}
示例6: GetSize
void DropGrid::Paint(Draw& w)
{
Size sz = GetSize();
Size isz = clear.GetStdSize();
if(clear_button && !notnull && IsEnabled() && IsSelected())
{
clear.Show();
clear.RightPos(3, isz.cx).TopPos((sz.cy - isz.cy) / 2, isz.cy);
}
else
clear.Hide();
GridDisplay &disp = display ? *display : list.GetDisplay();
bool hf = HasFocus();
bool isnull = rowid < 0;
Color fg = hf ? SColorHighlightText() : IsEnabled() ? SColorText() : SColorDisabled();
Color bg = !IsEnabled() || !IsEditable()
? EditField::StyleDefault().disabled
: notnull && isnull
? Blend(SColorPaper, Color(255, 0, 0), 32)
: hf ? SColorHighlight() : SColorPaper();
const int d = 0;
if(isnull)
w.DrawRect(d, d, sz.cx - d * 2, sz.cy - d * 2, bg);
else
{
Font fnt(StdFont());
Paint0(w, 1, 1, d, d, sz.cx - d * 2, sz.cy - d * 2, Format0(Null, rowid), 0, fg, bg, fnt);
}
if(hf)
DrawFocus(w, d - 0, d - 0, sz.cx - (d - 0) * 2, sz.cy - (d - 0) * 2);
}
示例7: GetSize
void PopUpInfo::Paint(Draw& w)
{
Size sz = GetSize();
if(!IsTransparent())
w.DrawRect(0, 0, sz.cx, sz.cy, color);
PaintLabel(w, 0, 0, sz.cx, sz.cy, !IsShowEnabled(), false, false, VisibleAccessKeys());
}
示例8: ss
void RichRawImage::Paint(const Value& data, Draw& w, Size sz, void *) const
{
String s = data;
StringStream ss(s);
One<StreamRaster> r = StreamRaster::OpenAny(ss);
if(r) {
Size isz = r->GetSize();
if(isz.cx * isz.cy > sz.cx * sz.cy) { // conserve memory by scaling down from source
ImageEncoder m;
Rescale(m, sz, *r, r->GetSize());
w.DrawImage(0, 0, sz.cx, sz.cy, m);
}
else
w.DrawImage(0, 0, sz.cx, sz.cy, r->GetImage()); // scale up by Draw to give e.g. PDF chance to store unscaled
}
}
示例9: GetTextSize
void DropGrid::Paint0(Draw &w, int lm, int rm, int x, int y, int cx, int cy, const Value &val, dword style, Color &fg, Color &bg, Font &fnt, bool found, int fs, int fe)
{
real_size.Clear();
w.DrawRect(x, y, cx, cy, bg);
int nx = x + lm;
int ny = y + tm;
int ncx = cx - lm - rm;
if(IsType< Vector<String> >(val))
{
const Vector<String> &v = ValueTo< Vector<String> >(val);
const char * SPACE = " ";
int tcx = 0;
int scx = GetTextSize(SPACE, fnt).cx;
int cnt = v.GetCount();
Size isz = GridImg::Dots2().GetSize();
for(int i = 0; i < cnt; i++)
{
bool iscol = (i + 1) & 1;
if(!display_columns && iscol)
continue;
fnt.Bold(iscol);
Size tsz = GetTextSize(v[i], fnt);
DrawText(w, nx, x + lm + tcx,
ny, tcx + tsz.cx > ncx - isz.cx ? ncx - tcx: tsz.cx + isz.cx, cy,
GD::VCENTER, WString(v[i]), fnt, fg, bg, found, fs, fe, false);
tcx += tsz.cx + scx;
}
}
else
DrawText(w, nx, nx, ny, ncx, cy, GD::VCENTER, GetStdConvertedValue(val), fnt, fg, bg, found, fs, fe, false);
}
示例10: Load
bool Image::Load(Draw &draw, const wchar_t *path, D3DCOLOR ColorKey)
{
Deinitialize();
D3DXIMAGE_INFO info;
W = H = 0;
ZeroMemory(&info,sizeof(D3DXIMAGE_INFO));
HRESULT hr = D3DXCreateTextureFromFileEx(draw.Device(),
path,
D3DX_DEFAULT_NONPOW2,
D3DX_DEFAULT_NONPOW2,
0,
0,
D3DFMT_UNKNOWN,
D3DPOOL_MANAGED,
D3DX_DEFAULT,
D3DX_DEFAULT,
ColorKey,
&info,
NULL,
&texture);
if (hr == D3D_OK)
{
W = info.Width;
H = info.Height;
return true;
}
texture = NULL;
return false;
}
示例11: Paint
virtual void Paint(Draw &draw) {
Rect paintrect=draw.GetPaintRect();
DDUMP(paintrect);
Point p = paintrect.TopLeft();
if(p.x < ib.GetSize().cx && p.y < ib.GetSize().cy)
SetSurface(draw, paintrect, ib, ib.GetSize(), p);
}
示例12: GetSize
void ImageMT::Paint(Draw& w)
{
Size sz = GetSize();
if(m_pLayers.GetCount()<=0)
w.DrawRect(sz,SWhite);
for(int i=0;i<m_pLayers.GetCount();i++)
{
Rect rc;
rc.left = m_pLayers[i]->m_rc.left * sz.cx;
rc.right = m_pLayers[i]->m_rc.right * sz.cx;
rc.top = m_pLayers[i]->m_rc.top * sz.cy;
rc.bottom = m_pLayers[i]->m_rc.bottom * sz.cy;
w.DrawImage(rc,m_pLayers[i]->m_img);
}
}
示例13: SetInfoDataObject
void DrawsWidget::CopyToClipboard() {
Draw *d = m_draws_controller->GetSelectedDraw();
if (d == NULL)
return;
if (wxTheClipboard->Open() == false)
return;
DrawInfo *di = d->GetDrawInfo();
SetInfoDataObject* wido =
new SetInfoDataObject(di->GetBasePrefix(), di->GetSetName(), d->GetPeriod(), d->GetCurrentTime().GetTicks(), d->GetDrawNo());
wxTheClipboard->SetData(wido);
wxTheClipboard->Close();
}
示例14: GetSize
void IdeImgView::Paint(Draw& w)
{
Size sz = GetSize();
String t = (img_sz != img.GetSize() ? "Resized from: " : "Image size: ");
t << Format("%d x %d", img_sz.cx, img_sz.cy);
int tcy = Draw::GetStdFontCy();
w.DrawRect(0, 0, sz.cx, tcy, SColorFace());
w.DrawText(5, 0, t, StdFont(), SColorText());
int ii = 0;
for(int x = 0; x < sz.cx; x += 16) {
int jj = ii;
for(int y = tcy; y < sz.cy; y += 16)
w.DrawRect(x, y, 16, 16, jj++ & 1 ? LtGray() : WhiteGray());
ii++;
}
w.DrawImage(5, 5 + tcy, img);
}
示例15: StdFont
int Navigator::ScopeDisplay::DoPaint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const
{
w.DrawRect(r, paper);
if(IsNull(q)) {
const char *txt = "All";
w.DrawText(r.left, r.top, txt, StdFont().Bold().Italic(),
style & CURSOR ? ink : HighlightSetup::GetHlStyle(HighlightSetup::INK_KEYWORD).color);
return GetTextSize(txt, StdFont().Bold().Italic()).cx;
}
String h = q;
if(*h == '\xff')
return PaintFileName(w, r, h, ink);
else
h = FormatNest(h);
w.DrawText(r.left, r.top, h, StdFont().Bold(), ink);
return GetTextSize(h, StdFont().Bold()).cx;
}