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


C++ PSD::DrawPixel方法代码示例

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


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

示例1:

/**
 * Restore the screen overwritten by the cursor.
 *
 * @param psd Drawing surface.
 * @return 1 iff the cursor was visible, else <= 0
 */
int
GdHideCursor(PSD psd)
{
	MWPIXELVAL *	saveptr;
	MWCOORD 		x, y;
	int 		oldmode;
	int		prevcursor = curvisible;

	if(curvisible-- <= 0)
		return prevcursor;
	oldmode = gr_mode;
	gr_mode = MWROP_COPY;

	saveptr = cursavbits;
	for (y = cursavy; y <= cursavy2; y++) {
		for (x = cursavx; x <= cursavx2; x++) {
			if(x >= 0 && x < psd->xvirtres &&
			   y >= 0 && y < psd->yvirtres) {
				psd->DrawPixel(psd, x, y, *saveptr++);
			}
		}
	}
 	gr_mode = oldmode;
	return prevcursor;
}
开发者ID:koujinogaku,项目名称:helloos,代码行数:31,代码来源:devmouse.c

示例2: while

/*
 * Generalized low level bitmap output routine, called
 * only if no clipping is required.  Only the set bits
 * in the bitmap are drawn, in the foreground color.
 */
void
gen_drawbitmap(PSD psd,COORD x, COORD y, COORD width, COORD height,
	const IMAGEBITS *table, PIXELVAL fgcolor)
{
  COORD minx;
  COORD maxx;
  IMAGEBITS bitvalue;	/* bitmap word value */
  int bitcount;			/* number of bits left in bitmap word */

  minx = x;
  maxx = x + width - 1;
  bitcount = 0;
  while (height > 0) {
	if (bitcount <= 0) {
		bitcount = IMAGE_BITSPERIMAGE;
		bitvalue = *table++;
	}
	if (IMAGE_TESTBIT(bitvalue))
		psd->DrawPixel(psd, x, y, fgcolor);
	bitvalue = IMAGE_SHIFTBIT(bitvalue);
	--bitcount;
	if (x++ == maxx) {
		x = minx;
		++y;
		--height;
		bitcount = 0;
	}
  }
}
开发者ID:allanshin,项目名称:DirectFB_Microwindows,代码行数:34,代码来源:romfont.c

示例3:

/*
 * Draw the mouse pointer.  Save the screen contents underneath
 * before drawing. Returns previous cursor state.
 */
int
GdShowCursor(PSD psd)
{
	MWCOORD 		x;
	MWCOORD 		y;
	MWPIXELVAL *	saveptr;
	MWIMAGEBITS *	cursorptr;
	MWIMAGEBITS *	maskptr;
	MWIMAGEBITS 	curbit, cbits, mbits;
	MWPIXELVAL 	oldcolor;
	MWPIXELVAL 	newcolor;
	int 		oldmode;
	int		prevcursor = curvisible;

	if(++curvisible != 1)
		return prevcursor;
	oldmode = gr_mode;
	gr_mode = MWMODE_COPY;

	saveptr = cursavbits;
	cursavx = curminx;
	cursavy = curminy;
	cursavx2 = curmaxx;
	cursavy2 = curmaxy;
	cursorptr = cursorcolor;
	maskptr = cursormask;

	for (y = curminy; y <= curmaxy; y++) {
		cbits = *cursorptr++;
		mbits = *maskptr++;
		curbit = MWIMAGE_FIRSTBIT;
		for (x = curminx; x <= curmaxx; x++) {
			if(x >= 0 && x < psd->xvirtres &&
			   y >= 0 && y < psd->yvirtres) {
				oldcolor = psd->ReadPixel(psd, x, y);
				if (curbit & mbits) {
					newcolor = (curbit&cbits)? curbg: curfg;
					if (oldcolor != newcolor)
					       psd->DrawPixel(psd, x, y, newcolor);
				}
				*saveptr++ = oldcolor;
			}
			curbit = MWIMAGE_NEXTBIT(curbit);
		}
	}

	gr_mode = oldmode;
	return prevcursor;
}
开发者ID:EPiCS,项目名称:reconos_v2,代码行数:53,代码来源:devmouse.c


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