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


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

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


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

示例1:

/**
 * Draw the mouse pointer.  Save the screen contents underneath
 * before drawing. Returns previous cursor state.
 *
 * @param psd Drawing surface.
 * @return 1 iff the cursor was visible, else <= 0
 */
int
GdShowCursor(PSD psd)
{
	MWCOORD 		x;
	MWCOORD 		y;
	MWPIXELVAL *	saveptr;
	MWIMAGEBITS *	cursorptr;
	MWIMAGEBITS *	maskptr;
	MWIMAGEBITS 	curbit, cbits = 0, mbits = 0;
	MWPIXELVAL 	oldcolor;
	MWPIXELVAL 	newcolor;
	int 		oldmode;
	int		prevcursor = curvisible;

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

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

	/*
	 * Loop through bits, resetting to firstbit at end of each row
	 */
	curbit = 0;
	for (y = curminy; y <= curmaxy; y++) {
		if (curbit != MWIMAGE_FIRSTBIT) {
			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);
			if (!curbit) {	/* check > one MWIMAGEBITS wide*/
				cbits = *cursorptr++;
				mbits = *maskptr++;
				curbit = MWIMAGE_FIRSTBIT;
			}
		}
	}

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

示例2:

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