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