コード例 #1
0
ファイル: Bar.cpp プロジェクト: ultimatepp/mirror
	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
0
ファイル: Static.cpp プロジェクト: AbdelghaniDr/mirror
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
0
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
0
ファイル: SampleDraw.cpp プロジェクト: achellies/DUI_LIb
    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
0
ファイル: test.cpp プロジェクト: dreamsxin/ultimatepp
	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
0
ファイル: DropGrid.cpp プロジェクト: AbdelghaniDr/mirror
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
0
ファイル: PopUpText.cpp プロジェクト: ultimatepp/mirror
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
0
ファイル: RichImage.cpp プロジェクト: koz4k/soccer
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
0
ファイル: DropGrid.cpp プロジェクト: AbdelghaniDr/mirror
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
0
ファイル: MXImage.cpp プロジェクト: Neurochrom/boroboro
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
0
ファイル: main.cpp プロジェクト: dreamsxin/ultimatepp
	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
0
ファイル: main.cpp プロジェクト: dreamsxin/ultimatepp
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
0
ファイル: main.cpp プロジェクト: dreamsxin/ultimatepp
    void Paint(Draw &w)
    {
        Size sz = GetSize();
        Rect rc = w.GetClip();
        static bool first = true;

		DUMP(rc);

        if(first)
        {
            w.DrawRect(sz, SGreen);
            first = false;
        }
        else
        for(int i = rc.left; i <= rc.right; i++)
            w.DrawLine(i, rc.top , i, rc.bottom, 0,  (i & 1) ? SWhite : SBlack);
    }
コード例 #14
0
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();
}
コード例 #15
0
ファイル: Img.cpp プロジェクト: ultimatepp/mirror
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);
}
コード例 #16
0
ファイル: Navigator.cpp プロジェクト: AbdelghaniDr/mirror
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;
}
コード例 #17
0
ファイル: CtrlDraw.cpp プロジェクト: dreamsxin/ultimatepp
void Ctrl::DrawCtrlWithParent(Draw& w, int x, int y)
{
	GuiLock __;
	if(parent) {
		Rect r = GetRect();
		Ctrl *top = parent->GetTopRect(r, inframe);
		w.Clip(x, y, r.Width(), r.Height());
		w.Offset(x - r.left, y - r.top);
		SystemDraw *ws = dynamic_cast<SystemDraw *>(&w);
		if(ws)
			top->UpdateArea(*ws, r);
		w.End();
		w.End();
	}
	else
		DrawCtrl(w, x, y);
}
コード例 #18
0
ファイル: ExGridCtrl.cpp プロジェクト: AbdelghaniDr/mirror
void ExGridCtrl::Paint(Draw &w)
{
	GridCtrl::Paint(w);

	if (GetCount() == 0)
		w.DrawText(GetSize().cx / 2 - _X, GetSize().cy / 2 - _Y - _Offset,
			_Info, _Font, _Ink);
}
コード例 #19
0
ファイル: FileList.cpp プロジェクト: AbdelghaniDr/mirror
void FileList::Paint(Draw& w, const Rect& r, const Value& q,
		             Color ink, Color paper, dword style) const
{
	const File& m = ValueTo<File>(q);
	bool dark = Grayscale(paper) < 150;
	w.DrawRect(r, paper);
	int x = r.left + 2;
	w.DrawImage(x, r.top + (r.Height() - m.icon.GetSize().cy) / 2, m.icon);
	x += iconwidth;
	x += 2;
	FontInfo fi = m.font.Info();
	DrawFileName(w, x, r.top + (r.Height() - fi.GetHeight()) / 2,
	             r.right - x - 2, r.Height(), WString(m.name), m.isdir, m.font,
	             dark ? SColorHighlightText : m.ink,
	             dark ? SColorHighlightText : m.extink,
	             WString(m.desc), m.descfont, justname, m.underline);
}
コード例 #20
0
ファイル: Display.cpp プロジェクト: guowei8412/upp-mirror
void  ColorDisplayNull::Paint(Draw& w, const Rect& r, const Value& q,
							 Color ink, Color paper, dword style) const
{
	if(IsNull(q))
		StdDisplay().Paint(w, r, nulltext, ink, paper, style);
	else
		w.DrawRect(r, Color(q));
}
コード例 #21
0
ファイル: DockCont.cpp プロジェクト: dreamsxin/ultimatepp
void DockCont::Handle::Paint(Draw& w)
{
	if (IsShown() && dc) {
		const DockableCtrl::Style &s = dc->GetStyle();
		Rect r = GetSize();
		const Rect &m = s.handle_margins;
		Point p;

		if (s.handle_vert)
			p = Point(r.left-1 + m.left, r.bottom - m.bottom);
		else
			p = Point(r.left + m.left, r.top + m.top);
		ChPaint(w, r, s.handle[focus]);

		Image img = dc->GetIcon();
		if (!img.IsEmpty()) {
			if (s.handle_vert) {
				int isz = r.GetWidth();
				p.y -= isz;
				isz -= (m.left + m.right);
				ChPaint(w, max(p.x+m.left, r.left), p.y, isz, isz, img);
				p.y -= 2;
			}
			else {
				int isz = r.GetHeight();
				isz -= (m.top + m.bottom);
				ChPaint(w, p.x, max(p.y, r.top), isz, isz, img);
				p.x += isz + 2;
			}
		}
		if (!s.title_font.IsNull()) {
			Ctrl *c = GetLastChild();
			while (c && !c->IsShown() && c->GetParent())
				c = c->GetNext();
			if (s.handle_vert)
				r.top = c ? c->GetRect().bottom + m.top : m.top;
			else
				r.right = c ? c->GetRect().left + m.right : m.right;
			w.Clip(r);
			WString text = IsNull(dc->GetGroup()) ? dc->GetTitle() : (WString)Format("%s (%s)", dc->GetTitle(), dc->GetGroup());
			w.DrawText(p.x, p.y, s.handle_vert ? 900 : 0, text, s.title_font, s.title_ink[focus]);
			w.End();
		}
	}
}
コード例 #22
0
ファイル: MainFrm.cpp プロジェクト: UniqueOnly/DrawLine
void CMainFrame::OnControlPrint(WPARAM wParam, LPARAM lParam)
{
	struct tInfo{
		CPoint sPoint;
		CPoint ePoint;
		int color;
	};
	//接收成功
	if(wParam == 1){
		tInfo *nMessage = (tInfo *)lParam;
		Draw draw;
		switch(input.GetCase())
		{
			case 1: draw.DDALineDraw(nMessage->sPoint, nMessage->ePoint, nMessage->color, this); break;
			case 2: draw.MiddlePointLineDraw(nMessage->sPoint, nMessage->ePoint, nMessage->color, this); break;
			case 3: draw.BresenhamLineDraw(nMessage->sPoint, nMessage->ePoint, nMessage->color, this); break;
			case 4: draw.MiddleCircleDraw(nMessage->sPoint, nMessage->ePoint.x, nMessage->color, this); break;
			case 5: draw.BresenhamCircleDraw(nMessage->sPoint, nMessage->ePoint.x, nMessage->color, this); break;
			case 6: draw.MiddleEllipseDraw(nMessage->sPoint, nMessage->ePoint.x, nMessage->ePoint.y, nMessage->color, this); break;
			default: break;
		}
	}else{
		this->MessageBox("接收失败");
	}
}
コード例 #23
0
ファイル: MenuItem.cpp プロジェクト: guowei8412/upp-mirror
void DrawMnemonicText(Draw& w, int x, int y, const String& s, Font font, Color color,
                      int mnemonic, bool menumark)
{
	int apos = HIWORD(mnemonic);
	int q;
	if(apos && apos < s.GetLength())
		q = apos - 1;
	else {
		q = s.Find(ToUpper(mnemonic));
		if(q < 0)
			q = s.Find(ToLower(mnemonic));
	}
	w.DrawText(x, y, s, font, color);
	if(q < 0) return;
	FontInfo f = font.Info();
	w.DrawRect(x + GetTextSize(~s, font, q).cx, y + f.GetAscent() + 1, f[s[q]], 1,
	           menumark ? SColorMenuMark() : SColorMark());
}
コード例 #24
0
ファイル: tree.cpp プロジェクト: toddxue/todd-algorithm
void Tree::print() {

    tree_calculate_level(this, 0);

    // calculate level_no 1st
    int level_no[64] = {0};
    int level_max = 0;
    tree_calculate_level_no(this, level_no, level_max);
    
    // calculate the x by the level_no
    tree_calculate_x(this, level_no);
    
    // now it's ready to print out
    Draw d;
    double yunit = Draw::eY_MAX * 1.0 / (level_max+2);
    draw_tree(this, d, yunit);
    d.print();
}
コード例 #25
0
ファイル: paintbox.cpp プロジェクト: dreamsxin/ultimatepp
void PaintBox::Paint( Draw &w ) 
{	
	
	/*ImageDraw	dw(GetSize());
	onPaint(dw);
	w.DrawImage(0, 0, dw);	*/
	w.DrawRect(0,0,this->GetSize().cx,this->GetSize().cy, White);
	onPaint(w);
}
コード例 #26
0
ファイル: FormViewDraw.cpp プロジェクト: AbdelghaniDr/mirror
void FormView::DrawRect(Draw& w, const Point& p, const Size& sz, int width, Color clr)
{
	if (!IsLayout())
		return;

	w.DrawPolyline( Vector<Point>() << Point(p.x, p.y) << Point(p.x + sz.cx, p.y) 
		<< Point(p.x + sz.cx, p.y + sz.cy) << Point(p.x, p.y + sz.cy)
			<< Point(p.x, p.y), width, clr);
}
コード例 #27
0
ファイル: Static.cpp プロジェクト: AbdelghaniDr/mirror
NAMESPACE_UPP

void StaticText::Paint(Draw& w)
{
	Size sz = GetSize();
	if(!IsTransparent())
		w.DrawRect(0, 0, sz.cx, sz.cy, SColorFace);
	PaintLabel(this, w, 0, 0, sz.cx, sz.cy, !IsShowEnabled(), false, false, VisibleAccessKeys());
}
コード例 #28
0
ファイル: Menu.c プロジェクト: SNavleen/Paint
void Menu::ClearScreen(){
    drawMenu.resetAllColours();
    drawMenu.setRed(1.0f);
    drawMenu.setGreen(1.0f);
    drawMenu.setBlue(1.0f);
    drawMenu.setColour();
//glutGet(GLUT_WINDOW_WIDTH)
//glutGet(GLUT_WINDOW_HEIGHT)
    glPointSize(500);
    glBegin(GL_POINTS);
        for(int i = -25; i < 25; i++){
            for(int j = -25; j < 25; j++){
                glVertex2i(i/1, j/1);     
            }       
        }
    glEnd();  
    glFlush();
}
コード例 #29
0
ファイル: main.cpp プロジェクト: den4ix/8puzzle
int main(int argc, char** argv)
{
    ifstream fin;

    if (argc == 2)
    {
        fin.open(argv[1]);
        if (!fin.is_open())
            cerr << "Could not open " << argv[1] << endl;
    }
    else
    {
        cerr << "Usage: " << argv[0] << " [board's filename]\n";
        exit(EXIT_FAILURE);
    }

    int N;
    fin >> N;
    int** blocks = Board::arAlloc(N);
    for (int i = 0; i < N; i++)
        for (int j = 0; j < N; j++)
            fin >> blocks[i][j];

    Board* initial = new Board(blocks, N);
    Solver* solver = new Solver(initial);

    if (!solver->isSolvable())
        cout << "No solution possible\n";
    else
    {
        cout << "Minimum number of moves = " << solver->moves() << endl;
        if (N == 4)
        {
            Draw theDraw;
            theDraw.OnExecute(solver->solution());
        }
        else
        {
            for (Board* b : solver->solution())
                cout << b->toString() << endl;
        }
    }
    return 0;
}
コード例 #30
0
ファイル: HeaderCtrl.cpp プロジェクト: AbdelghaniDr/mirror
void HeaderCtrl::Paint(Draw& w) {
	RefreshDistribution();
	Size sz = GetSize();
	w.DrawRect(sz, SColorFace());
	bool ds = !IsShowEnabled();
	double rs = Denominator();
	double rr = 0;
	int x = -sb;
	light = -1;
	bool first = true;
	int dx = Null;
	for(int i = 0; i < col.GetCount(); i++) {
		if(col[i].visible) {
			Rect r;
			if(mode == SCROLL) {
				int cx = (int)col[i].ratio;
				r = RectC(x, 0, cx, sz.cy);
				x += cx;
			}
			else {
				rr += rs ? col[i].ratio : 1;
				int xx = int(rr * sz.cx / (rs ? rs : col.GetCount()));
				r = RectC(x, 0, i == col.GetCount() - 1 ? sz.cx - x : xx - x, sz.cy);
				x = xx;
			}
			bool mousein = HasMouseIn(r.Deflated(1, 0)) && col[i].WhenAction && pushi < 0 &&
			               !isdrag;
			if(mousein)
				light = i;
			col[i].Paint(first, w,
			             r.left, r.top, r.Width(), r.Height(), ds, push && i == pushi, mousein);
			if(isdrag && ti == i)
				dx = r.left;
		}
		if(x >= sz.cx) break;
	}
	Column h;
	h.header = this;
	h.Paint(first, w, x, 0, 999, sz.cy, false, false, false);
	if(isdrag) {
		w.DrawImage(dragx + dragd, 0, dragtab);
		DrawVertDrop(w, IsNull(dx) ? sz.cx - 2 : dx - (dx > 0), 0, sz.cy);
	}
}