LOCAL void MergeMaskData(LPMASK lpMask, int x, int y, int npix, int outDepth, LPTR lpSrc, LPTR lpDst) /************************************************************************/ { LPTR lpM; MaskLoad(lpMask, x, y, npix, lpMask->mbuffer); lpM = lpMask->mbuffer; if (outDepth == 1) { while (--npix >= 0) { *lpDst++ = *lpSrc++; *lpDst++ = *lpM++; } } else if (outDepth == 3) { while (--npix >= 0) { *lpDst++ = *lpSrc++; *lpDst++ = *lpSrc++; *lpDst++ = *lpSrc++; *lpDst++ = *lpM++; } } else if (outDepth == 4) { while (--npix >= 0) { *lpDst++ = *lpSrc++; *lpDst++ = *lpSrc++; *lpDst++ = *lpSrc++; *lpDst++ = *lpSrc++; *lpDst++ = *lpM++; } } }
BOOL ObjGetLine(LPOBJECT lpObject, int x, int y, int dx, LPTR lpOut) /************************************************************************/ { LPALPHA lpAlpha; LPTR lp; LPPROCESSPROC lpProcessProc; RECT rLine, rSect; int nPixels, ox, oy, depth; FRMTYPEINFO TypeInfo; FRMDATATYPE DataType; long lOffset; LPFRAME lpFrame; // fill buffer with base image object // use depth of base image object lpFrame = ObjGetEditFrame(lpObject); FrameGetTypeInfo(lpFrame, &TypeInfo); DataType = TypeInfo.DataType; depth = FrameDepth(lpFrame); if (TypeInfo.DataType == FDT_LINEART) { depth = 1; TypeInfo.DataType = FDT_GRAYSCALE; } if (!ObjGetLineAlloc(dx, depth)) { //Message(IDS_EMEMALLOC); return(FALSE); } if (!FrameRead(lpFrame, x, y, dx, lpOut, dx)) return(FALSE); // setup rect for this line for intersect check rLine.left = x; rLine.right = x + dx - 1; rLine.top = rLine.bottom = y; // start with first object on top of base image while(lpObject = lpObject->lpNext) { // if object cannot be rendered through raster means if (lpObject->fDeleted || !AstralIntersectRect(&rSect, &lpObject->rObject, &rLine)) continue; // get merge proc for this object lpProcessProc = GetProcessProc(lpObject->MergeMode, DataType); ox = rSect.left-lpObject->rObject.left; oy = y-lpObject->rObject.top; nPixels = (rSect.right - rSect.left + 1); lOffset = (long)(rSect.left - rLine.left) * depth; lp = FramePointer(ObjGetEditFrame(lpObject), ox, oy, NO, nPixels); if (lp) { if (lpAlpha = ObjGetAlpha(lpObject)) { MaskLoad(lpAlpha, ox, oy, nPixels, lpGLMaskBuf); if (lpObject->Opacity != 255) ScaleData8(lpGLMaskBuf, nPixels, lpObject->Opacity); } else set(lpGLMaskBuf, nPixels, lpObject->Opacity); (*lpProcessProc)(lpOut+lOffset, lp, lpGLMaskBuf, nPixels); } } return(TRUE); }