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


C++ ePoint类代码示例

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


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

示例1: moveTopRight

void eRect::moveTopRight( const ePoint &p )
{
	x1 += (p.x() - x2);
	y2 += (p.y() - y1);
	x2 = p.x();
	y1 = p.y();
}
开发者ID:TitanNit,项目名称:tdt,代码行数:7,代码来源:erect.cpp

示例2: moveBottomLeft

void eRect::moveBottomLeft( const ePoint &p )
{
	x2 += (p.x() - x1);
	y1 += (p.y() - y2);
	x1 = p.x();
	y2 = p.y();
}
开发者ID:TitanNit,项目名称:tdt,代码行数:7,代码来源:erect.cpp

示例3:

eRect::eRect( const ePoint &topLeft, const ePoint &bottomRight )
{
	x1 = topLeft.x();
	y1 = topLeft.y();
	x2 = bottomRight.x();
	y2 = bottomRight.y();
}
开发者ID:TitanNit,项目名称:tdt,代码行数:7,代码来源:erect.cpp

示例4: moveBottomRight

void eRect::moveBottomRight( const ePoint &p )
{
	x1 += (p.x() - x2);
	y1 += (p.y() - y2);
	x2 = p.x();
	y2 = p.y();
}
开发者ID:TitanNit,项目名称:tdt,代码行数:7,代码来源:erect.cpp

示例5: moveTopLeft

void eRect::moveTopLeft( const ePoint &p )
{
	x2 += (p.x() - x1);
	y2 += (p.y() - y1);
	x1 = p.x();
	y1 = p.y();
}
开发者ID:TitanNit,项目名称:tdt,代码行数:7,代码来源:erect.cpp

示例6: moveCenter

void eRect::moveCenter( const ePoint &p )
{
	int w = x2 - x1;
	int h = y2 - y1;
	x1 = (p.x() - w/2);
	y1 = (p.y() - h/2);
	x2 = x1 + w;
	y2 = y1 + h;
}
开发者ID:TitanNit,项目名称:tdt,代码行数:9,代码来源:erect.cpp

示例7: if

void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected)
{
	painter.clip(eRect(offset, m_itemsize));

	int marked = 0;

	if (m_current_marked && selected)
		marked = 2;
	else if (cursorValid() && isMarked(*m_cursor))
	{
		if (selected)
			marked = 2;
		else
			marked = 1;
	}
	else
		style.setStyle(painter, selected ? eWindowStyle::styleListboxSelected : eWindowStyle::styleListboxNormal);

	eListboxStyle *local_style = 0;

		/* get local listbox style, if present */
	if (m_listbox)
		local_style = m_listbox->getLocalStyle();

	if (marked == 1)  // marked
	{
		style.setStyle(painter, eWindowStyle::styleListboxMarked);
		if (m_color_set[markedForeground])
			painter.setForegroundColor(m_color[markedForeground]);
		if (m_color_set[markedBackground])
			painter.setBackgroundColor(m_color[markedBackground]);
	}
	else if (marked == 2) // marked and selected
	{
		style.setStyle(painter, eWindowStyle::styleListboxMarkedAndSelected);
		if (m_color_set[markedForegroundSelected])
			painter.setForegroundColor(m_color[markedForegroundSelected]);
		if (m_color_set[markedBackgroundSelected])
			painter.setBackgroundColor(m_color[markedBackgroundSelected]);
	}
	else if (local_style)
	{
		if (selected)
		{
			/* if we have a local background color set, use that. */
			if (local_style->m_background_color_selected_set)
				painter.setBackgroundColor(local_style->m_background_color_selected);
			/* same for foreground */
			if (local_style->m_foreground_color_selected_set)
				painter.setForegroundColor(local_style->m_foreground_color_selected);
		}
		else
		{
			/* if we have a local background color set, use that. */
			if (local_style->m_background_color_set)
				painter.setBackgroundColor(local_style->m_background_color);
			/* same for foreground */
			if (local_style->m_foreground_color_set)
				painter.setForegroundColor(local_style->m_foreground_color);
		}
	}

	if (!local_style || !local_style->m_transparent_background)
		/* if we have no transparent background */
	{
		/* blit background picture, if available (otherwise, clear only) */
		if (local_style && local_style->m_background)
			painter.blit(local_style->m_background, offset, eRect(), 0);
		else
			painter.clear();
	} else
	{
		if (local_style->m_background)
			painter.blit(local_style->m_background, offset, eRect(), gPainter::BT_ALPHATEST);
		else if (selected && !local_style->m_selection)
			painter.clear();
	}

	if (cursorValid())
	{
		/* get service information */
		ePtr<iStaticServiceInformation> service_info;
		m_service_center->info(*m_cursor, service_info);
		eServiceReference ref = *m_cursor;
		bool isMarker = ref.flags & eServiceReference::isMarker;
		bool isPlayable = !(ref.flags & eServiceReference::isDirectory || isMarker);
		ePtr<eServiceEvent> evt;

		bool serviceAvail = true;
#ifndef FORCE_SERVICEAVAIL
		if (!marked && isPlayable && service_info && m_is_playable_ignore.valid() && !service_info->isPlayable(*m_cursor, m_is_playable_ignore))
		{
			if (m_color_set[serviceNotAvail])
				painter.setForegroundColor(m_color[serviceNotAvail]);
			else
				painter.setForegroundColor(gRGB(0xbbbbbb));
			serviceAvail = false;
		}
#endif
		if (selected && local_style && local_style->m_selection)
//.........这里部分代码省略.........
开发者ID:popazerty,项目名称:enigma2,代码行数:101,代码来源:listboxservice.cpp

示例8: paint

void eListboxPythonMultiContent::paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected)
{
	gRegion itemregion(eRect(offset, m_itemsize));
	eListboxStyle *local_style = 0;
	eRect sel_clip(m_selection_clip);
	bool cursorValid = this->cursorValid();
	gRGB border_color;
	int border_size = 0;

	if (sel_clip.valid())
		sel_clip.moveBy(offset);

		/* get local listbox style, if present */
	if (m_listbox)
	{
		local_style = m_listbox->getLocalStyle();
		border_size = local_style->m_border_size;
		border_color = local_style->m_border_color;
	}

	painter.clip(itemregion);
	clearRegion(painter, style, local_style, ePyObject(), ePyObject(), ePyObject(), ePyObject(), selected, itemregion, sel_clip, offset, cursorValid);

	ePyObject items, buildfunc_ret;

	if (m_list && cursorValid)
	{
			/* a multicontent list can be used in two ways:
				either each item is a list of (TYPE,...)-tuples,
				or there is a template defined, which is a list of (TYPE,...)-tuples,
				and the list is an unformatted tuple. The template then references items from the list.
			*/
		items = PyList_GET_ITEM(m_list, m_cursor); // borrowed reference!

		if (m_buildFunc)
		{
			if (PyCallable_Check(m_buildFunc))  // when we have a buildFunc then call it
			{
				if (PyTuple_Check(items))
					buildfunc_ret = items = PyObject_CallObject(m_buildFunc, items);
				else
					eDebug("[eListboxPythonMultiContent] items is no tuple");
			}
			else
				eDebug("[eListboxPythonMultiContent] buildfunc is not callable");
		}

		if (!items)
		{
			eDebug("[eListboxPythonMultiContent] error getting item %d", m_cursor);
			goto error_out;
		}

		if (!m_template)
		{
			if (!PyList_Check(items))
			{
				eDebug("[eListboxPythonMultiContent] list entry %d is not a list (non-templated)", m_cursor);
				goto error_out;
			}
		} else
		{
			if (!PyTuple_Check(items))
			{
				eDebug("[eListboxPythonMultiContent] list entry %d is not a tuple (templated)", m_cursor);
				goto error_out;
			}
		}

		ePyObject data;

			/* if we have a template, use the template for the actual formatting.
				we will later detect that "data" is present, and refer to that, instead
				of the immediate value. */
		int start = 1;
		if (m_template)
		{
			data = items;
			items = m_template;
			start = 0;
		}

		int size = PyList_Size(items);
		for (int i = start; i < size; ++i)
		{
			ePyObject item = PyList_GET_ITEM(items, i); // borrowed reference!

			if (!item)
			{
				eDebug("[eListboxPythonMultiContent] ?");
				goto error_out;
			}

			if (!PyTuple_Check(item))
			{
				eDebug("[eListboxPythonMultiContent] did not receive a tuple.");
				goto error_out;
			}

			int size = PyTuple_Size(item);
//.........这里部分代码省略.........
开发者ID:Akki01,项目名称:enigma2,代码行数:101,代码来源:elistboxcontent.cpp

示例9: itemrect

void eListboxPythonConfigContent::paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected)
{
	ePtr<gFont> fnt;
	ePtr<gFont> fnt2;
	eRect itemrect(offset, m_itemsize);
	eListboxStyle *local_style = 0;
	bool cursorValid = this->cursorValid();
	gRGB border_color;
	int border_size = 0;

	painter.clip(itemrect);
	style.setStyle(painter, selected ? eWindowStyle::styleListboxSelected : eWindowStyle::styleListboxNormal);

		/* get local listbox style, if present */
	if (m_listbox)
		local_style = m_listbox->getLocalStyle();

	if (local_style)
	{
		border_size = local_style->m_border_size;
		border_color = local_style->m_border_color;
		fnt = local_style->m_font;
		if (selected)
		{
			/* if we have a local background color set, use that. */
			if (local_style->m_background_color_selected_set)
				painter.setBackgroundColor(local_style->m_background_color_selected);
			/* same for foreground */
			if (local_style->m_foreground_color_selected_set)
				painter.setForegroundColor(local_style->m_foreground_color_selected);
		}
		else
		{
			/* if we have a local background color set, use that. */
			if (local_style->m_background_color_set)
				painter.setBackgroundColor(local_style->m_background_color);
			/* same for foreground */
			if (local_style->m_foreground_color_set)
				painter.setForegroundColor(local_style->m_foreground_color);
		}
	}

	if (fnt)
	{
		fnt2 = new gFont(fnt->family, fnt->pointSize - fnt->pointSize/5);
	}
	else
	{
		fnt = new gFont("Regular", 20);
		fnt2 = new gFont("Regular", 16);
	}

	if (!local_style || !local_style->m_transparent_background)
		/* if we have no transparent background */
	{
		/* blit background picture, if available (otherwise, clear only) */
		if (local_style && local_style->m_background && cursorValid)
			painter.blit(local_style->m_background, offset, eRect(), 0);
		else
			painter.clear();
	} else
	{
		if (local_style->m_background && cursorValid)
			painter.blit(local_style->m_background, offset, eRect(), gPainter::BT_ALPHATEST);
		else if (selected && !local_style->m_selection)
			painter.clear();
	}

	if (m_list && cursorValid)
	{
			/* get current list item */
		ePyObject item = PyList_GET_ITEM(m_list, m_cursor); // borrowed reference!
		ePyObject text, value;
		painter.setFont(fnt);
		int valueWidth(0);

		if (selected && local_style && local_style->m_selection)
			painter.blit(local_style->m_selection, offset, eRect(), gPainter::BT_ALPHATEST);

			/* the first tuple element is a string for the left side.
			   the second one will be called, and the result shall be an tuple.

			   of this tuple,
			   the first one is the type (string).
			   the second one is the value. */
		if (PyTuple_Check(item))
		{
				/* handle left part. get item from tuple, convert to string, display. */
			text = PyTuple_GET_ITEM(item, 0);
			text = PyObject_Str(text); /* creates a new object - old object was borrowed! */
			const char *configitemstring = (text && PyString_Check(text)) ? PyString_AsString(text) : "<not-a-string>";
			Py_XDECREF(text);
			eSize itemsize = eSize(m_itemsize.width()-10, m_itemsize.height());
			ePoint textoffset = ePoint(offset.x()+5, offset.y());

				/* when we have no label, align value to the left. (FIXME:
				   don't we want to specifiy this individually?) */
			int value_alignment_left = !*configitemstring;

				/* now, handle the value. get 2nd part from tuple*/
//.........这里部分代码省略.........
开发者ID:Akki01,项目名称:enigma2,代码行数:101,代码来源:elistboxcontent.cpp

示例10: cursorValid

void eListboxPythonStringContent::paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected)
{
	ePtr<gFont> fnt;
	painter.clip(eRect(offset, m_itemsize));
	style.setStyle(painter, selected ? eWindowStyle::styleListboxSelected : eWindowStyle::styleListboxNormal);
	bool validitem = (m_list && cursorValid());
	eListboxStyle *local_style = 0;
	bool cursorValid = this->cursorValid();
	gRGB border_color;
	int border_size = 0;

		/* get local listbox style, if present */
	if (m_listbox)
		local_style = m_listbox->getLocalStyle();

	if (local_style)
	{
		border_size = local_style->m_border_size;
		border_color = local_style->m_border_color;
		fnt = local_style->m_font;
		if (selected)
		{
			/* if we have a local background color set, use that. */
			if (local_style->m_background_color_selected_set)
				painter.setBackgroundColor(local_style->m_background_color_selected);
			/* same for foreground */
			if (local_style->m_foreground_color_selected_set)
				painter.setForegroundColor(local_style->m_foreground_color_selected);
		}
		else
		{
			/* if we have a local background color set, use that. */
			if (local_style->m_background_color_set)
				painter.setBackgroundColor(local_style->m_background_color);
			/* same for foreground */
			if (local_style->m_foreground_color_set)
				painter.setForegroundColor(local_style->m_foreground_color);
		}
	}
	if (!fnt) fnt = new gFont("Regular", 20);

	/* if we have no transparent background */
	if (!local_style || !local_style->m_transparent_background)
	{
			/* blit background picture, if available (otherwise, clear only) */
		if (local_style && local_style->m_background && cursorValid)
		{
			if (validitem) painter.blit(local_style->m_background, offset, eRect(), 0);
		}
		else
			painter.clear();
	} else
	{
		if (local_style->m_background && cursorValid)
		{
			if (validitem) painter.blit(local_style->m_background, offset, eRect(), gPainter::BT_ALPHATEST);
		}
		else if (selected && !local_style->m_selection)
			painter.clear();
	}

	if (validitem)
	{
		int gray = 0;
		ePyObject item = PyList_GET_ITEM(m_list, m_cursor); // borrowed reference!
		painter.setFont(fnt);

			/* the user can supply tuples, in this case the first one will be displayed. */
		if (PyTuple_Check(item))
		{
			if (PyTuple_Size(item) == 1)
				gray = 1;
			item = PyTuple_GET_ITEM(item, 0);
		}

		if (selected && local_style && local_style->m_selection)
			painter.blit(local_style->m_selection, offset, eRect(), gPainter::BT_ALPHATEST);

		if (item == Py_None)
		{
				/* seperator */
			int half_height = m_itemsize.height() / 2;
			painter.fill(eRect(offset.x() + half_height, offset.y() + half_height - 2, m_itemsize.width() - m_itemsize.height(), 4));
		} else
		{
			const char *string = PyString_Check(item) ? PyString_AsString(item) : "<not-a-string>";
			ePoint text_offset = offset;
			if (gray)
				painter.setForegroundColor(gRGB(0x808080));

			int flags = 0;
			if (local_style)
			{
				text_offset += local_style->m_text_offset;

				if (local_style->m_valign == eListboxStyle::alignTop)
					flags |= gPainter::RT_VALIGN_TOP;
				else if (local_style->m_valign == eListboxStyle::alignCenter)
					flags |= gPainter::RT_VALIGN_CENTER;
				else if (local_style->m_valign == eListboxStyle::alignBottom)
//.........这里部分代码省略.........
开发者ID:Akki01,项目名称:enigma2,代码行数:101,代码来源:elistboxcontent.cpp

示例11: line

void gPixmap::line(const gRegion &clip, ePoint start, ePoint dst, gColor color)
{
	__u8 *srf8 = 0;
	__u32 *srf32 = 0; 
	int stride = surface->stride;
	
	if (clip.rects.empty())
		return;
		
	__u32 col = 0;
	if (surface->bpp == 8)
	{
		srf8 = (__u8*)surface->data;
	} else if (surface->bpp == 32)
	{
		srf32 = (__u32*)surface->data;
		
		if (surface->clut.data && color < surface->clut.colors)
			col=(surface->clut.data[color].a<<24)|(surface->clut.data[color].r<<16)|(surface->clut.data[color].g<<8)|(surface->clut.data[color].b);
		else
			col=0x10101*color;
//#if defined(__sh__) 
//printf("%s:%d col = %08X\n", __FUNCTION__, __LINE__, col);
//if(col&0xFF000000 == 0xFF000000)
//col = 0xFF000000;
//#endif
		col^=0xFF000000;	

	}
	
	int xa = start.x(), ya = start.y(), xb = dst.x(), yb = dst.y();
	int dx, dy, x, y, s1, s2, e, temp, swap, i;
	dy=abs(yb-ya);
	dx=abs(xb-xa);
	s1=sgn(xb-xa);
	s2=sgn(yb-ya);
	x=xa;
	y=ya;
	if (dy>dx)
	{
		temp=dx;
		dx=dy;
		dy=temp;
		swap=1;
	} else
		swap=0;
	e = 2*dy-dx;
	
	int lasthit = 0;
	for(i=1; i<=dx; i++)
	{
				/* i don't like this clipping loop, but the only */
				/* other choice i see is to calculate the intersections */
				/* before iterating through the pixels. */
				
				/* one could optimize this because of the ordering */
				/* of the bands. */
				
		lasthit = 0;
		int a = lasthit;
		
			/* if last pixel was invisble, first check bounding box */
		if (a == -1)
		{
				/* check if we just got into the bbox again */
			if (clip.extends.contains(x, y))
				lasthit = a = 0;
			else
				goto fail;
		} else if (!clip.rects[a].contains(x, y))
		{
			do
			{
				++a;
				if ((unsigned int)a == clip.rects.size())
					a = 0;
				if (a == lasthit)
				{
					goto fail;
					lasthit = -1;
				}
			} while (!clip.rects[a].contains(x, y));
			lasthit = a;
		}
		
		if (srf8)
			srf8[y * stride + x] = color;
		if (srf32)
			srf32[y * stride/4 + x] = col;
fail:
		while (e>=0)
		{
			if (swap==1) x+=s1;
			else y+=s2;
			e-=2*dx;
		}
    if (swap==1)
    	y+=s2;
		else
			x+=s1;
//.........这里部分代码省略.........
开发者ID:TitanNit,项目名称:tdt,代码行数:101,代码来源:gpixmap.cpp

示例12: size

void gPixmap::blit(const gPixmap &src, ePoint pos, const gRegion &clip, int flag)
{
	for (unsigned int i=0; i<clip.rects.size(); ++i)
	{
		eRect area=eRect(pos, src.size());
		area&=clip.rects[i];
		area&=eRect(ePoint(0, 0), size());

		if ((area.width()<0) || (area.height()<0))
			continue;

		eRect srcarea=area;
		srcarea.moveBy(-pos.x(), -pos.y());

		if ((surface->data_phys && src.surface->data_phys) && (gAccel::getInstance()))
			if (!gAccel::getInstance()->blit(surface, src.surface, area.topLeft(), srcarea, flag))
				continue;

		if ((surface->bpp == 8) && (src.surface->bpp==8))
		{
			__u8 *srcptr=(__u8*)src.surface->data;
			__u8 *dstptr=(__u8*)surface->data;

			srcptr+=srcarea.left()*src.surface->bypp+srcarea.top()*src.surface->stride;
			dstptr+=area.left()*surface->bypp+area.top()*surface->stride;
			for (int y=0; y<area.height(); y++)
			{
				if (flag & (blitAlphaTest|blitAlphaBlend))
				{
  		      // no real alphatest yet
					int width=area.width();
					unsigned char *src=(unsigned char*)srcptr;
					unsigned char *dst=(unsigned char*)dstptr;
						// use duff's device here!
					while (width--)
					{
						if (!*src)
						{
							src++;
							dst++;
						} else
							*dst++=*src++;
					}
				} else
					memcpy(dstptr, srcptr, area.width()*surface->bypp);
				srcptr+=src.surface->stride;
				dstptr+=surface->stride;
			}
		} else if ((surface->bpp == 32) && (src.surface->bpp==32))
		{
			__u32 *srcptr=(__u32*)src.surface->data;
			__u32 *dstptr=(__u32*)surface->data;

			srcptr+=srcarea.left()+srcarea.top()*src.surface->stride/4;
			dstptr+=area.left()+area.top()*surface->stride/4;
			for (int y=0; y<area.height(); y++)
			{
				if (flag & blitAlphaTest)
				{
					int width=area.width();
					unsigned long *src=(unsigned long*)srcptr;
					unsigned long *dst=(unsigned long*)dstptr;

					while (width--)
					{
						if (!((*src)&0xFF000000))
						{
							src++;
							dst++;
						} else
							*dst++=*src++;
					}
				} else if (flag & blitAlphaBlend)
				{
					// uh oh. this is only until hardware accel is working.

					int width=area.width();
							// ARGB color space!
					unsigned char *src=(unsigned char*)srcptr;
					unsigned char *dst=(unsigned char*)dstptr;

#define BLEND(x, y, a) (y + ((x-y) * a)/256)
					while (width--)
					{
						unsigned char sa = src[3];
						unsigned char sr = src[2];
						unsigned char sg = src[1];
						unsigned char sb = src[0];

						unsigned char da = dst[3];
						unsigned char dr = dst[2];
						unsigned char dg = dst[1];
						unsigned char db = dst[0];

						dst[3] = BLEND(0xFF, da, sa);
						dst[2] = BLEND(sr, dr, sa);
						dst[1] = BLEND(sg, dg, sa);
						dst[0] = BLEND(sb, db, sa);
#undef BLEND

//.........这里部分代码省略.........
开发者ID:TitanNit,项目名称:tdt,代码行数:101,代码来源:gpixmap.cpp

示例13: contains

bool eRect::contains( const ePoint &p) const
{
	return p.x() >= x1 && p.x() < x2 &&
		   p.y() >= y1 && p.y() < y2;
}
开发者ID:TitanNit,项目名称:tdt,代码行数:5,代码来源:erect.cpp

示例14: recalcClientRect

void eWidget::cmove(const ePoint& nposition)
{
	recalcClientRect();
	move(ePoint(nposition.x()-clientrect.x(), nposition.y()-clientrect.y()));
}
开发者ID:TitanNit,项目名称:tdt,代码行数:5,代码来源:ewidget.cpp


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