本文整理汇总了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;
}
示例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;
}