当前位置: 首页>>代码示例>>C++>>正文


C++ Rect::GetSize方法代码示例

本文整理汇总了C++中Rect::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ Rect::GetSize方法的具体用法?C++ Rect::GetSize怎么用?C++ Rect::GetSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Rect的用法示例。


在下文中一共展示了Rect::GetSize方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: FramePaint

void BorderFrame::FramePaint(Draw& draw, const Rect& r)
{
	Size sz = r.GetSize();
	int n = (int)(intptr_t)*border;
	if(sz.cx >= 2 * n && sz.cy >= 2 * n)
		DrawBorder(draw, r.left, r.top, r.Width(), r.Height(), border);
}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:7,代码来源:Frame.cpp

示例2: CreateNode

void SceneEditorScreenMain::CreateNode(ResourceEditor::eNodeType nodeType)
{
	Rect rect = GetRect();

	if(dialogBack->GetSize() != rect.GetSize())
	{
		ReleaseResizedControl(dialogBack);
		ReleaseResizedControl(nodeDialog);


		dialogBack = ControlsFactory::CreatePanelControl(rect);
		ControlsFactory::CustomizeDialogFreeSpace(dialogBack);

		Rect r;
		r.dx = rect.dx / 2;
		r.dy = rect.dy / 2;

		r.x = rect.x + r.dx / 2;
		r.y = rect.y + r.dy / 2;

		nodeDialog = new CreateNodesDialog(r);
		nodeDialog->SetDelegate(this);
	}

    nodeDialog->CreateNode(nodeType);
    
    AddControl(dialogBack);
    AddControl(nodeDialog);
}
开发者ID:vilonosec,项目名称:dava.framework,代码行数:29,代码来源:SceneEditorScreenMain.cpp

示例3: DrawEllipseOp

void Painter::DrawEllipseOp(const Rect& r, Color color, int pen, Color pencolor)
{
	Sizef sz = r.GetSize();
	Ellipse(r.left + sz.cx / 2, r.top + sz.cy / 2, sz.cx / 2, sz.cy / 2);
	Fill(color);
	Stroke(max(pen, 0), pencolor);
}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:7,代码来源:Painter.cpp

示例4: FrameLayout

void BorderFrame::FrameLayout(Rect& r)
{
	Size sz = r.GetSize();
	int n = (int)(intptr_t)*border;
	if(sz.cx >= 2 * n && sz.cy >= 2 * n)
		r.Deflate(n);
}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:7,代码来源:Frame.cpp

示例5: FrameLayout

void SplitterFrame::FrameLayout(Rect& r)
{
	Rect rr = r;
	parentsize = r.GetSize();
	int sz = BoundSize();
	switch(type) {
	case LEFT:
		r.left += sz;
		rr.right = r.left;
		break;
	case RIGHT:
		r.right -= sz;
		rr.left = r.right;
		break;
	case TOP:
		r.top += sz;
		rr.bottom = r.top;
		break;
	case BOTTOM:
		r.bottom -= sz;
		rr.top = r.bottom;
		break;
	}
	SetFrameRect(rr);
}
开发者ID:pedia,项目名称:raidget,代码行数:25,代码来源:FrameSplitter.cpp

示例6: PutRect

NAMESPACE_UPP

void SystemDraw::PutRect(const Rect& r, Color color)
{
	LLOG("Ctrl::PutRect " << r << ", color " << color);
	Ctrl::stat_putrect++;
	Point p = r.TopLeft();
	if(color == InvertColor()) {
		Ctrl::Put8(Ctrl::INVERTRECT);
		Ctrl::Put(r);
	}
	else {
		Size sz = r.GetSize();
		Point dp = p - pos;
		if(abs(dp.x) < 256 && abs(dp.y) < 256 && sz.cx < 256 && sz.cy < 256 && 0) {
			Ctrl::Put8(dp.x < 0 ? dp.y < 0 ? Ctrl::RECTNN : Ctrl::RECTNP
			                    : dp.y < 0 ? Ctrl::RECTPN : Ctrl::RECTPP);
			Ctrl::Put8(abs(dp.x));
			Ctrl::Put8(abs(dp.y));
			Ctrl::Put8(sz.cx);
			Ctrl::Put8(sz.cy);
		}
		else {
			Ctrl::Put8(Ctrl::RECT);
			Ctrl::Put(r);
		}
		Ctrl::Put8(color.GetR());
		Ctrl::Put8(color.GetG());
		Ctrl::Put8(color.GetB());
	}
	pos = p;
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:32,代码来源:Draw.cpp

示例7: LeftDrag

void HeaderCtrl::LeftDrag(Point p, dword keyflags)
{
	if(li < 0 || !moving) return;
	int n = 0;
	for(int i = 0; i < col.GetCount(); i++)
		if(col[i].visible)
			n++;
	if(n < 2)
		return;
	push = false;
	ti = li;
	pushi = -1;
	Refresh();
	Rect r = GetTabRect(li).OffsetedHorz(-sb);
	Size sz = r.GetSize();
	ImageDraw iw(sz.cx, sz.cy);
	bool first = true;
	col[li].Paint(first, iw, 0, 0, sz.cx, sz.cy, false, false, false);
	DrawFrame(iw, sz, SColorText());
	dragtab = iw;
	dragx = p.x;
	dragd = r.left - p.x;
	ImageBuffer ib(dragtab);
	Unmultiply(ib);
	RGBA *s = ~ib;
	RGBA *e = s + ib.GetLength();
	while(s < e) {
		s->a >>= 1;
		s++;
	}
	Premultiply(ib);
	dragtab = ib;
	isdrag = true;
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:34,代码来源:HeaderCtrl.cpp

示例8: END

void Ctrl::UpdateArea0(SystemDraw& draw, const Rect& clip, int backpaint)
{
	GuiLock __;
	LTIMING("UpdateArea");
	LLOG("========== UPDATE AREA " << UPP::Name(this) << " ==========");
	if(globalbackbuffer) {
		CtrlPaint(draw, clip);
		LLOG("========== END (TARGET IS BACKBUFFER)");
		return;
	}
	if(backpaint == FULLBACKPAINT || globalbackpaint && !hasdhctrl && !dynamic_cast<DHCtrl *>(this)) {
		ShowRepaintRect(draw, clip, LtRed());
		BackDraw bw;
		bw.Create(draw, clip.GetSize());
		bw.Offset(-clip.TopLeft());
		bw.SetPaintingDraw(draw, clip.TopLeft());
		CtrlPaint(bw, clip);
		bw.Put(draw, clip.TopLeft());
		LLOG("========== END (FULLBACKPAINT)");
		return;
	}
	if(backpaint == TRANSPARENTBACKPAINT) {
		LLOG("TransparentBackpaint");
		Vector<Rect> area;
		GatherTransparentAreas(area, draw, GetRect().GetSize(), clip);
		for(int i = 0; i < area.GetCount(); i++) {
			Rect ar = area[i];
			LLOG("Painting area: " << ar);
			ShowRepaintRect(draw, ar, LtBlue());
			BackDraw bw;
			bw.Create(draw, ar.GetSize());
			bw.Offset(-ar.TopLeft());
			bw.SetPaintingDraw(draw, ar.TopLeft());
			CtrlPaint(bw, ar);
			bw.Put(draw, ar.TopLeft());
			if(!draw.ExcludeClip(ar)) {
				LLOG("========== END");
				return;
			}
		}
		PaintOpaqueAreas(draw, GetRect().GetSize(), clip);
		LLOG("========== END");
		return;
	}
	CtrlPaint(draw, clip);
	LLOG("========== END");
}
开发者ID:pedia,项目名称:raidget,代码行数:47,代码来源:CtrlDraw.cpp

示例9: 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()));
	}
开发者ID:guowei8412,项目名称:upp-mirror,代码行数:8,代码来源:Display.cpp

示例10: PutImage

void GLDraw::PutImage(Point p, const Image& img, const Rect& src)
{
	LTIMING("PutImage");
	FlushPutRect();

	gl_image.Use();

	Size isz = img.GetSize();
	Rect s = src & isz;
	Rect r(p, s.GetSize());
	
	PutImagePixels += isz.cx * isz.cy;

	GLshort vertex[] = {
	    r.left, r.top,
	    r.left, r.bottom,
	    r.right, r.bottom,
	    r.right, r.top,
	};

	static GLushort indices[] = { 0, 1, 2, 0, 2, 3 };

	const float *tc;

	if(src == isz) {
		static float fixed[] = {
			0.0, 0.0,
			0.0, 1.0,
			1.0, 1.0,
			1.0, 0.0,
		};
		tc = fixed;
	}
	else {
		Sizef iszf = isz;
		Rectf h;
		h.left = s.left / iszf.cx;
		h.right = s.right / iszf.cx;
		h.top = s.top / iszf.cy;
		h.bottom = s.bottom / iszf.cy;
		float partial[] = {
			(float)h.left, (float)h.top,
			(float)h.left, (float)h.bottom,
			(float)h.right, (float)h.bottom,
			(float)h.right, (float)h.top,
		};
		tc = partial;
	}

	glEnableVertexAttribArray(ATTRIB_TEXPOS);
	glVertexAttribPointer(ATTRIB_TEXPOS, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(GLfloat), tc);
	glVertexAttribPointer(ATTRIB_VERTEX, 2, GL_SHORT, GL_FALSE, 2 * sizeof(GLshort), vertex);
	glBindTexture(GL_TEXTURE_2D, GetTextureForImage(img));

	glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices);

	glDisableVertexAttribArray(ATTRIB_TEXPOS);
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:58,代码来源:GLDrawS.cpp

示例11: TranslatePoint

Vector2 LandscapeEditorDrawSystem::TranslatePoint(const Vector2& point, const Rect& fromRect, const Rect& toRect)
{
	DVASSERT(fromRect.dx != 0.f && fromRect.dy != 0.f);

	Vector2 origRectSize = fromRect.GetSize();
	Vector2 destRectSize = toRect.GetSize();

	Vector2 scale(destRectSize.x / origRectSize.x,
				  destRectSize.y / origRectSize.y);

	Vector2 relPos = point - fromRect.GetPosition();
	Vector2 newRelPos(relPos.x * scale.x,
					  relPos.y * scale.y);

	Vector2 newPos = newRelPos + toRect.GetPosition();

	return newPos;
}
开发者ID:droidenko,项目名称:dava.framework,代码行数:18,代码来源:LandscapeEditorDrawSystem.cpp

示例12: DrawPaintingOp

void Painter::DrawPaintingOp(const Rect& target, const Painting& p)
{
	Size sz = target.GetSize();
	Sizef psz = p.GetSize();
	Begin();
	Translate(target.left, target.top);
	Scale(sz.cx / psz.cx, sz.cy / psz.cy);
	Paint(p);
	End();
}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:10,代码来源:Painter.cpp

示例13: PutImage

void GLDraw::PutImage(Point p, const Image& img, const Rect& src)
{
	if(img.GetLength() == 0)
		return;

	LLOG("PutImage " << img.GetSerialId() << ' ' << p.x << ", " << p.y << ", "<< img.GetSize());
	LLOG("SysImage cache pixels " << sTextureCache.GetSize() << ", count " << sTextureCache.GetCount());
	ImageGLDataMaker m;
	m.img = img;
	ImageGLData& sd = sTextureCache.Get(m);

	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, sd.texture_id);
	
	glColor3f(1.0f, 1.0f, 1.0f);
	
	if(src == img.GetSize()) {
		Rect r(p, img.GetSize());
		glBegin(GL_TRIANGLE_STRIP);
			glTexCoord2f(0, 0);
			glVertex2i(r.left, r.top);
			glTexCoord2f(1, 0);
			glVertex2i(r.right, r.top);
			glTexCoord2f(0, 1);
			glVertex2i(r.left, r.bottom);
			glTexCoord2f(1, 1);
			glVertex2i(r.right, r.bottom);
		glEnd();
	}
	else {
		Sizef iszf = img.GetSize();
		Rect s = src & img.GetSize();
		Rect r(p, s.GetSize());
		Rectf h;
		h.left = (double)s.left / iszf.cx;
		h.right = (double)s.right / iszf.cx;
		h.top = (double)s.top / iszf.cy;
		h.bottom = (double)s.bottom / iszf.cy;
		glBegin(GL_TRIANGLE_STRIP);
			glTexCoord2f(h.left, h.top);
			glVertex2i(r.left, r.top);
			glTexCoord2f(h.right, h.top);
			glVertex2i(r.right, r.top);
			glTexCoord2f(h.left, h.bottom);
			glVertex2i(r.left, r.bottom);
			glTexCoord2f(h.right, h.bottom);
			glVertex2i(r.right, r.bottom);
		glEnd();
	}

   	glDisable(GL_TEXTURE_2D);

	sTextureCache.Shrink(4 * 1024 * 768, 1000);
}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:54,代码来源:GlDraw.cpp

示例14: PaintOpaqueAreas

bool Ctrl::PaintOpaqueAreas(SystemDraw& w, const Rect& r, const Rect& clip, bool nochild)
{
	GuiLock __;
	LTIMING("PaintOpaqueAreas");
	if(!IsShown() || r.IsEmpty() || !r.Intersects(clip) || !w.IsPainting(r))
		return true;
	Point off = r.TopLeft();
	Point viewpos = off + GetView().TopLeft();
	if(backpaint == EXCLUDEPAINT)
		return w.ExcludeClip(r);
	Rect cview = clip & (GetView() + off);
	for(Ctrl *q = lastchild; q; q = q->prev)
		if(!q->PaintOpaqueAreas(w, q->GetRect() + (q->InView() ? viewpos : off),
		                        q->InView() ? cview : clip))
			return false;
	if(nochild && (lastchild || GetNext()))
		return true;
	Rect opaque = (GetOpaqueRect() + viewpos) & clip;
	if(opaque.IsEmpty())
		return true;
#ifdef SYSTEMDRAW
	if(backpaint == FULLBACKPAINT && !dynamic_cast<BackDraw *>(&w))
#else
	if(backpaint == FULLBACKPAINT && !w.IsBack())
#endif
	{
		ShowRepaintRect(w, opaque, LtRed());
		BackDraw bw;
		bw.Create(w, opaque.GetSize());
		bw.Offset(viewpos - opaque.TopLeft());
		bw.SetPaintingDraw(w, opaque.TopLeft());
		{
			LEVELCHECK(bw, this);
			Paint(bw);
			PaintCaret(bw);
		}
		bw.Put(w, opaque.TopLeft());
	}
	else {
		w.Clip(opaque);
		ShowRepaintRect(w, opaque, Green());
		w.Offset(viewpos);
		{
			LEVELCHECK(w, this);
			Paint(w);
			PaintCaret(w);
		}
		w.End();
		w.End();
	}
	LLOG("Exclude " << opaque);
	return w.ExcludeClip(opaque);
}
开发者ID:dreamsxin,项目名称:ultimatepp,代码行数:53,代码来源:CtrlDraw.cpp

示例15: Open

void TopWindow::Open(Ctrl *owner)
{
    GuiLock __;
    Rect r = GetRect();
    if(r.IsEmpty())
        SetRect(GetDefaultWindowRect());
    else if(r.left == 0 && r.top == 0)
        if(owner && center == 1)
            SetRect(owner->GetRect().CenterRect(r.GetSize()));
        else if(center)
            SetRect(GetWorkArea().CenterRect(r.GetSize()));
    frame->SetClient(GetRect());
    frame->window = this;
    frame->PopUp(owner, false, true);
    PopUp(frame, false, true);
    popup = false;
    SetRect(frame->GetClient());
    SyncCaption();
    if(state == MAXIMIZED)
        frame->Maximize();
}
开发者ID:kolyden,项目名称:mirror,代码行数:21,代码来源:Top.cpp


注:本文中的Rect::GetSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。