本文整理汇总了C++中Draw::DrawImage方法的典型用法代码示例。如果您正苦于以下问题:C++ Draw::DrawImage方法的具体用法?C++ Draw::DrawImage怎么用?C++ Draw::DrawImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Draw
的用法示例。
在下文中一共展示了Draw::DrawImage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Paint
void MyApp::Paint(Draw& w)
{
w.DrawRect(GetSize(), SColorPaper());
for(int i = 0; i < MyImages::GetCount(); i++) {
w.DrawImage(50, 80 + 20 * i, MyImages::Get(i));
w.DrawText(80, 80 + 20 * i, MyImages::GetId(i));
}
w.DrawImage(20, 0, 50, 50, MyImages::Get(MyImages::I_Circle));
w.DrawText(80, 0, AsString(MyImages::Find("Circle")));
}
示例2: DrawFocus
void DrawFocus(Draw& w, int x, int y, int cx, int cy, Color c) {
w.Clipoff(x, y, cx, cy);
for(int a = 0; a < cx; a += CtrlImg::focus_h().GetWidth()) {
w.DrawImage(a, 0, CtrlImg::focus_h(), c);
w.DrawImage(a, cy - 1, CtrlImg::focus_h(), c);
}
for(int a = 0; a < cy; a += CtrlImg::focus_v().GetHeight()) {
w.DrawImage(0, a, CtrlImg::focus_v(), c);
w.DrawImage(cx - 1, a, CtrlImg::focus_v(), c);
}
w.End();
}
示例3: StdFont
void StdDisplayClass::Paint0(Draw& w, const Rect& r, const Value& q,
Color ink, Color paper, dword s) const {
LLOG("StdDisplay::Paint0: " << q << " ink:" << ink << " paper:" << paper);
WString txt;
Font font = StdFont();
int a = align;
int x = r.left;
int width = r.GetWidth();
if(IsType<AttrText>(q)) {
const AttrText& t = ValueTo<AttrText>(q);
txt = t.text;
font = t.font;
if(!IsNull(t.paper))
paper = t.paper;
if(!IsNull(t.ink))
ink = t.ink;
if(!IsNull(t.normalink) && !(s & (CURSOR|SELECT|READONLY)))
ink = t.normalink;
if(!IsNull(t.normalpaper) && !(s & (CURSOR|SELECT|READONLY)))
paper = t.normalpaper;
if(!IsNull(t.align))
a = t.align;
if(!IsNull(t.img)) {
Size isz = t.img.GetSize();
w.DrawImage(x, r.top + max((r.Height() - isz.cy) / 2, 0), t.img);
x += isz.cx + t.imgspc;
}
}
else
txt = IsString(q) ? q : StdConvert().Format(q);
Size tsz = GetTLTextSize(txt, font);
if(a == ALIGN_RIGHT)
x = r.right - tsz.cx;
if(a == ALIGN_CENTER)
x += (width - tsz.cx) / 2;
int tcy = GetTLTextHeight(txt, font);
int tt = r.top + max((r.Height() - tcy) / 2, 0);
if(tsz.cx > width) {
Size isz = DrawImg::threedots().GetSize();
int wd = width - isz.cx;
w.Clip(r.left, r.top, wd, r.GetHeight());
DrawTLText(w, x, tt, width, txt, font, ink);
w.End();
w.DrawImage(r.left + wd, tt + font.Info().GetAscent() - isz.cy, DrawImg::threedots(), ink);
}
else
DrawTLText(w, x, tt, width, txt, font, ink);
}
示例4: Paint
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
}
}
示例5: DrawImageBandRLE
void DrawImageBandRLE(Draw& w, int x, int y, const Image& m, int minp)
{
int xi = 0;
int cx = m.GetWidth();
int ccy = m.GetHeight();
Buffer<bool> todo(cx, true);
#ifdef BENCHMARK_RLE
sTotal += cx;
#endif
while(xi < cx) {
int xi0 = xi;
while(w.Dots() && IsWhiteColumn(m, xi) && xi < cx)
xi++;
if(xi - xi0 >= 16) {
#ifdef BENCHMARK_RLE
sRle += xi - xi0;
#endif
w.DrawRect(x + xi0, y, xi - xi0, ccy, White);
Fill(~todo + xi0, ~todo + xi, false);
}
xi++;
}
xi = 0;
while(xi < cx)
if(todo[xi]) {
int xi0 = xi;
while(xi < cx && todo[xi] && xi - xi0 < 2000)
xi++;
w.DrawImage(x + xi0, y, m, RectC(xi0, 0, xi - xi0, ccy));
}
else
xi++;
}
示例6: Paint
void RGBACtrl::Paint(Draw& w)
{
w.DrawRect(GetSize(), SColorFace);
if(alpha.IsMask())
return;
for(int x = 0; x <= 18; x++)
w.DrawRect(x * cbox.cx + cs.x, cs.y, 1, cbox.cy * 14, SColorText());
int i = 0;
int my = cs.y + 1;
w.DrawRect(cs.x, cs.y + 14 * cbox.cy, cbox.cx * 18 + 1, 1, SColorText());
Point pp = Null;
for(int y = 0; y < 14; y++) {
w.DrawRect(cs.x, my - 1, cbox.cx * 18 + 1, 1, SColorText());
int mx = cs.x + 1;
for(int x = 0; x < 18; x++) {
Color c = GetColor(i++);
w.DrawRect(mx, my, cbox.cx - 1, cbox.cy - 1, c);
if(c == color)
pp = Point(mx, my);
mx += cbox.cx;
}
my += cbox.cy;
}
if(!IsNull(pp)) {
Size isz = CtrlImg::wheel_cursor().GetSize();
pp = pp + (cbox - isz) / 2;
w.DrawImage(pp.x, pp.y, CtrlImg::wheel_cursor(),
Grayscale(color) < 120 ? White() : Black());
}
}
示例7: Paint
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);
}
示例8: 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))
w.DrawImage(r.left, r.top, Rescale(m, r.GetSize()));
}
示例9: Paint
virtual void Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const {
ValueArray va = q;
String txt = va[0];
Image icon = va[1];
w.DrawRect(r, paper);
w.DrawImage(r.left, r.top + (r.Height() - 16) / 2, IsNull(icon) ? IdeImg::Package() : icon);
w.DrawText(r.left + 20, r.top + (r.Height() - Draw::GetStdFontCy()) / 2, txt, fnt, ink);
}
示例10: Paint
void HelloWorld::Paint(Draw& w)
{
ImagePainter iw(50, 50);
// iw.Clear(RGBAZero());
iw.DrawImage(0, 0, CtrlImg::exclamation());
Image m = iw;
w.DrawRect(GetSize(), Gray);
w.DrawImage(100, 100, m);
}
示例11: PaintTab
void RightTabs::PaintTab(Draw& w, int x, int y, int cx, int cy, Color paper, const Image& img, Color hl)
{
Color fc = FieldFrameColor();
w.DrawRect(x, y + 1, cx - 1, cy - 2, paper);
w.DrawRect(x, y, cx - 1, 1, fc);
w.DrawRect(x + cx - 1, y + 1, 1, cy - 2, fc);
w.DrawRect(x, y + cy - 1, cx - 1, 1, fc);
Size isz = img.GetSize();
int ix = (cx - isz.cx) / 2 + x;
int iy = (cy - isz.cx) / 2 + y;
if(!IsNull(hl)) {
w.DrawImage(ix - 1, iy - 1, img, hl);
w.DrawImage(ix - 1, iy + 1, img, hl);
w.DrawImage(ix + 1, iy - 1, img, hl);
w.DrawImage(ix + 1, iy + 1, img, hl);
}
w.DrawImage(ix, iy, img);
}
示例12: Paint
void RasterPlayer::Paint(Draw& w) {
Size sz = GetSize();
if (!IsNull(background))
w.DrawRect(sz, background);
if (images.IsEmpty())
return;
if (!images[ind])
return;
w.DrawImage(Fit(sz, images[ind].GetSize()), images[ind]);
}
示例13: HotPaint
NAMESPACE_UPP
#define IMAGECLASS RichEditImg
#define IMAGEFILE <RichEdit/RichEdit.iml>
#include <Draw/iml_source.h>
void HotPaint(Draw& w, int x, int y, const Image& img)
{
Point p = img.GetHotSpot();
w.DrawImage(x - p.x, y - p.y, img);
}
示例14: Paint
virtual void Paint(Draw& w, const Rect& r, const Value& q, Color ink, Color paper, dword style) const {
ValueArray va = q;
String txt = va[0];
Image icon = va[1];
if(IsNull(icon))
icon = IdeImg::Package();
else
icon = DPI(icon, 16);
w.DrawRect(r, paper);
w.DrawImage(r.left, r.top + (r.Height() - icon.GetHeight()) / 2, icon);
w.DrawText(r.left + Zx(20), r.top + (r.Height() - Draw::GetStdFontCy()) / 2, txt, fnt, ink);
}
示例15: Paint
// ImgButton
void ImgButton::Paint(Draw &w)
{
Size sz = GetSize();
if (look)
ChPaint(w, sz, look[Pusher::GetVisualState()]);
int dx = IsPush() * -1;
int dy = IsPush();
if (!img.IsEmpty()) {
Size isz = img.GetSize();
w.DrawImage((sz.cx - isz.cx) / 2 + dx, (sz.cy - isz.cy) / 2 + dy, img);
}
}