#include <nodeliveeffect.h>
Inheritance diagram for ProcessBitmapState:
Public Member Functions | |
ProcessBitmapState () | |
ProcessBitmapState (LPBITMAPINFO lpInitialInfo, LPBYTE lpInitialBits, double InitialXOffset=0, double InitialYOffset=0, BOOL bInitialTempState=FALSE) | |
Produce a textual description of the specified record Building constructor. | |
ProcessBitmapState (const ProcessBitmapState ©state) | |
Copy constructor. | |
ProcessBitmapState & | operator= (const ProcessBitmapState &rhsstate) |
Assignment operator. | |
~ProcessBitmapState () | |
ProcessBitmapState | Create8BPPMask () |
Extract the 8bpp T channel from this bitmap state. | |
ProcessBitmapState | Contour8BPP (double dContourWidth) |
Contour this state return resulting state. | |
ProcessBitmapState | Blur8BPP (double dBlurWidth) |
Contour the source bitmap. | |
ProcessBitmapState | Expand8BPP (INT32 nPixels, BYTE fill) |
Expand the source bitmap, filling pixels with specified value. | |
ProcessBitmapState | AddMaskTo (LPBITMAPINFO lpDeepInfo, LPBYTE lpDeepBits) |
Put this bitmap state into another DIB as the transparency channel. | |
void | GetPixelOffsets (double *pXOffset, double *pYOffset) const |
void | GetBitmap (LPBITMAPINFO &pOutputInfo, LPBYTE &pOutputBits, BOOL bTemp=FALSE) |
Extract the bitmap from the current pipeline state. | |
BOOL | IsOK () const |
void | DeInit () |
Copy member vars that should propagate from one state to the next in a pipeline. | |
Protected Member Functions | |
void | InitPipelineSettings (ProcessBitmapState *const prevstate) |
Copy member vars that should propagate from one state to the next in a pipeline. | |
UINT32 | GetWidth () const |
UINT32 | GetHeight () const |
UINT32 | GetDepth () const |
UINT32 | GetXPelsPerMeter () const |
UINT32 | GetYPelsPerMeter () const |
void | SetPelsPerMeter (UINT32 x, UINT32 y) |
BOOL | AllocDIB (UINT32 Width, UINT32 Height, UINT32 Depth) |
Extract the bitmap from the current pipeline state. | |
Private Attributes | |
LPBITMAPINFO | m_lpInfo |
LPBYTE | m_lpBits |
double | m_XOffset |
double | m_YOffset |
BOOL | m_bTemp |
BOOL | m_bOK |
UINT32 | m_XPelsPerMeter |
UINT32 | m_YPelsPerMeter |
Definition at line 547 of file nodeliveeffect.h.
|
Definition at line 551 of file nodeliveeffect.h. 00552 { 00553 m_lpInfo = NULL; 00554 m_lpBits = NULL; 00555 m_XOffset = 0; 00556 m_YOffset = 0; 00557 m_XPelsPerMeter = 0; 00558 m_YPelsPerMeter = 0; 00559 m_bTemp = TRUE; 00560 m_bOK = FALSE; 00561 }
|
|
Produce a textual description of the specified record Building constructor.
Definition at line 5214 of file nodeliveeffect.cpp. 05219 { 05220 m_lpInfo = lpInitialInfo; 05221 m_lpBits = lpInitialBits; 05222 m_XOffset = InitialXOffset; 05223 m_YOffset = InitialYOffset; 05224 m_XPelsPerMeter = 0; 05225 m_YPelsPerMeter = 0; 05226 m_bTemp = bInitialTempState; 05227 m_bOK = TRUE; 05228 }
|
|
Copy constructor.
Definition at line 5246 of file nodeliveeffect.cpp. 05247 { 05248 m_lpInfo = copystate.m_lpInfo; 05249 m_lpBits = copystate.m_lpBits; 05250 m_XOffset = copystate.m_XOffset; 05251 m_YOffset = copystate.m_YOffset; 05252 m_XPelsPerMeter = copystate.m_XPelsPerMeter; 05253 m_YPelsPerMeter = copystate.m_YPelsPerMeter; 05254 m_bTemp = copystate.m_bTemp; 05255 m_bOK = copystate.m_bOK; 05256 }
|
|
Definition at line 575 of file nodeliveeffect.h.
|
|
Put this bitmap state into another DIB as the transparency channel.
Definition at line 5551 of file nodeliveeffect.cpp. 05552 { 05553 // Create the next state 05554 ProcessBitmapState deep; 05555 deep.InitPipelineSettings(this); 05556 05557 // Don't process if the current state is invalid 05558 if (!m_bOK) 05559 return deep; // IsOK = FALSE 05560 05561 ERROR3IF(GetDepth()!=8, "Error"); 05562 ERROR3IF(lpDeepInfo->bmiHeader.biBitCount != 32, "Error"); 05563 ERROR3IF(lpDeepInfo->bmiHeader.biWidth != (INT32)GetWidth(), "Error"); 05564 ERROR3IF(lpDeepInfo->bmiHeader.biHeight != (INT32)GetHeight(), "Error"); 05565 if (GetDepth()!=8) return deep; 05566 if (lpDeepInfo->bmiHeader.biBitCount != 32) return deep; 05567 if (lpDeepInfo->bmiHeader.biWidth != (INT32)GetWidth()) return deep; 05568 if (lpDeepInfo->bmiHeader.biHeight != (INT32)GetHeight()) return deep; 05569 05570 deep.m_lpInfo = lpDeepInfo; 05571 deep.m_lpBits = lpDeepBits; 05572 if (!deep.IsOK()) 05573 return deep; // IsOK = FALSE 05574 05575 UINT32 uWidth = GetWidth(); 05576 UINT32 uHeight = GetHeight(); 05577 UINT32 uByteWidth8 = DIBUtil::ScanlineSize(uWidth, 8); 05578 UINT32 uByteWidth32 = DIBUtil::ScanlineSize(deep.GetWidth(), deep.GetDepth())/sizeof(UINT32); // width in words 05579 05580 UINT32* pDst = (UINT32*)lpDeepBits; 05581 LPBYTE pSrc = m_lpBits; 05582 UINT32 i; 05583 UINT32 j; 05584 for ( j=0 ; j<uHeight ; j++ ) 05585 { 05586 for ( i=0 ; i<uWidth ; i++ ) 05587 { 05588 pDst[i] = (pDst[i]&0xFF000000) | pSrc[i] << 24; 05589 } 05590 pDst += uByteWidth32; 05591 pSrc += uByteWidth8; 05592 } 05593 05594 return deep; 05595 }
|
|
Extract the bitmap from the current pipeline state.
Definition at line 5427 of file nodeliveeffect.cpp. 05428 { 05429 m_bOK = FALSE; 05430 m_lpInfo = ::AllocDIB(Width, Height, Depth, &m_lpBits); 05431 if (m_lpInfo) 05432 { 05433 m_bOK = TRUE; 05434 if (m_XPelsPerMeter!=0 && m_YPelsPerMeter!=0) 05435 { 05436 m_lpInfo->bmiHeader.biXPelsPerMeter = m_XPelsPerMeter; 05437 m_lpInfo->bmiHeader.biYPelsPerMeter = m_YPelsPerMeter; 05438 m_XPelsPerMeter = 0; 05439 m_YPelsPerMeter = 0; 05440 } 05441 } 05442 05443 return m_bOK; 05444 }
|
|
Contour the source bitmap.
Definition at line 5674 of file nodeliveeffect.cpp. 05675 { 05676 // Create the next state 05677 ProcessBitmapState blur; 05678 blur.InitPipelineSettings(this); 05679 05680 // Don't process if the current state is invalid 05681 if (!m_bOK) 05682 return blur; // IsOK = FALSE 05683 05684 ERROR3IF(GetDepth()!=8, "Blur8BPP only copes with 8BPP inputs at the moment"); 05685 05686 // Now blur 05687 UINT32 DWordWidth = DIBUtil::ScanlineSize(GetWidth(), GetDepth()); 05688 // Alloc a destination DIB for the convolution. 05689 UINT32 uBlurDiameter = UINT32(dBlurWidth+0.5)-1 ; 05690 blur.AllocDIB(GetWidth()-uBlurDiameter, GetHeight()-uBlurDiameter, 8); 05691 if (!blur.IsOK()) 05692 return blur; // IsOK = FALSE 05693 05694 CBitmapShadow::Blur8BppBitmap(&m_lpInfo->bmiHeader, m_lpBits, &blur.m_lpInfo->bmiHeader, blur.m_lpBits, DWordWidth, dBlurWidth/2); 05695 05696 // Blur result is offset by blur radius 05697 // So to position blur bitmap correctly we must move it down and left by blur radius 05698 blur.m_XOffset += dBlurWidth/2; 05699 blur.m_YOffset += dBlurWidth/2; 05700 05701 return blur; 05702 }
|
|
Contour this state return resulting state.
Definition at line 5615 of file nodeliveeffect.cpp. 05616 { 05617 // Create the next state 05618 double OffsetX = 0; 05619 double OffsetY = 0; 05620 ProcessBitmapState contour; 05621 contour.InitPipelineSettings(this); 05622 05623 // Don't process if the current state is invalid 05624 if (!m_bOK) 05625 return contour; // IsOK = FALSE 05626 05627 ERROR3IF(GetDepth()!=8, "Contour8BPP only copes with 8BPP inputs at the moment"); 05628 ERROR3IF(dContourWidth>=0, "Contour8BPP only copes with inner contours at the moment"); 05629 05630 // Now generate an Inner contour of half the feather width 05631 contour.m_bOK = CBitmapShadow::ContourBitmap(m_lpInfo, 05632 m_lpBits, 05633 fabs(dContourWidth), 05634 (dContourWidth<0), 05635 0xFE, // Threshold 05636 &contour.m_lpInfo, 05637 &contour.m_lpBits, 05638 &OffsetX, 05639 &OffsetY 05640 ); 05641 ERROR3IF(!contour.IsOK(), "ContourBitmap failed in RenderShadowedNodeOffscreen"); 05642 if (!contour.IsOK()) 05643 return contour; 05644 05645 // If the contour produced a NULL bitmap 05646 // Just return a copy of the current state... 05647 if (contour.m_lpInfo==NULL) 05648 return *this; 05649 05650 contour.m_XOffset += OffsetX; // Assume ContourBitmap has set sense correctly for inside/outside contouring 05651 contour.m_YOffset += OffsetY; 05652 05653 return contour; 05654 }
|
|
Extract the 8bpp T channel from this bitmap state.
Definition at line 5464 of file nodeliveeffect.cpp. 05465 { 05466 // Create the next state 05467 ProcessBitmapState mask; 05468 mask.InitPipelineSettings(this); 05469 05470 // Don't process if the current state is invalid 05471 if (!m_bOK) 05472 return mask; // IsOK = FALSE 05473 05474 // ERROR3IF(GetDepth()!=32, "Create8BPPMask only copes with 32BPP inputs at the moment"); 05475 05476 // Get the alpha channel bitmap out of the capture bitmap and invert it 05477 // because we want ContourBitmap to generate an INNER contour... 05478 mask.AllocDIB(GetWidth(), GetHeight(), 8); 05479 if (!mask.IsOK()) 05480 return mask; // IsOK = FALSE 05481 05482 if (GetDepth()==32) 05483 { 05484 UINT32 uWidth = mask.GetWidth(); 05485 UINT32 uHeight = mask.GetHeight(); 05486 UINT32 uByteWidth8 = DIBUtil::ScanlineSize(uWidth, 8); 05487 UINT32 uByteWidth32 = DIBUtil::ScanlineSize(GetWidth(), GetDepth())/sizeof(UINT32); // width in words 05488 05489 LPBYTE pDst = mask.m_lpBits; 05490 UINT32* pSrc = (UINT32*)m_lpBits; 05491 UINT32 i; 05492 UINT32 j; 05493 for ( j=0 ; j<uHeight ; j++ ) 05494 { 05495 for ( i=0 ; i<uWidth ; i++ ) 05496 { 05497 // Combine alpha channel info with colour info to get silhouette 05498 // Unrendered areas are BGRT = 0x000000FF (T=0xFF for fully transparent) 05499 // Wherever transp is FE or less 05500 // pDst[i] = (pSrc[i]==0xFF000000) ? 0 : 0xFF; // Invert 05501 // pDst[i] = (pSrc[i]==0xFF000000) ? 0xFF : 0; 05502 pDst[i] = (pSrc[i]&0xFF000000) >> 24; 05503 } 05504 pDst += uByteWidth8; 05505 pSrc += uByteWidth32; 05506 } 05507 } 05508 else 05509 { 05510 // TODO! 05511 // Should try to get mask data from other formats here! 05512 // At the moment just create a solid rectangle... 05513 UINT32 uWidth = mask.GetWidth(); 05514 UINT32 uHeight = mask.GetHeight(); 05515 UINT32 uByteWidth8 = DIBUtil::ScanlineSize(uWidth, 8); 05516 05517 LPBYTE pDst = mask.m_lpBits; 05518 UINT32 i; 05519 UINT32 j; 05520 for ( j=0 ; j<uHeight ; j++ ) 05521 { 05522 for ( i=0 ; i<uWidth ; i++ ) 05523 { 05524 pDst[i] = 0; 05525 } 05526 pDst += uByteWidth8; 05527 } 05528 } 05529 05530 return mask; 05531 }
|
|
Copy member vars that should propagate from one state to the next in a pipeline.
Definition at line 5309 of file nodeliveeffect.cpp. 05310 { 05311 if (m_lpInfo && m_lpBits && m_bTemp) 05312 { 05313 ::FreeDIB(m_lpInfo, m_lpBits); 05314 m_lpInfo = NULL; 05315 m_lpBits = NULL; 05316 } 05317 }
|
|
Expand the source bitmap, filling pixels with specified value.
Definition at line 5722 of file nodeliveeffect.cpp. 05723 { 05724 ProcessBitmapState expand; 05725 expand.InitPipelineSettings(this); 05726 05727 // Don't process if the current state is invalid 05728 if (!m_bOK) 05729 return expand; // IsOK = FALSE 05730 05731 ERROR3IF(GetDepth()!=8, "Expand8BPP only copes with 8BPP inputs at the moment"); 05732 05733 expand.AllocDIB(GetWidth()+nPixels*2, GetHeight()+nPixels*2, 8); 05734 if (!expand.IsOK()) 05735 return expand; // IsOK = FALSE 05736 05737 UINT32 uSrcWidth8 = GetWidth(); 05738 UINT32 uSrcHeight8 = GetHeight(); 05739 UINT32 uSrcByteWidth8 = DIBUtil::ScanlineSize(uSrcWidth8, 8); 05740 05741 UINT32 uExWidth8 = expand.GetWidth(); 05742 UINT32 uExHeight8 = expand.GetHeight(); 05743 UINT32 uExByteWidth8 = DIBUtil::ScanlineSize(uExWidth8, 8); 05744 05745 LPBYTE pSrc = m_lpBits; 05746 LPBYTE pDst = expand.m_lpBits + uExByteWidth8*nPixels + nPixels; 05747 UINT32 i,j; 05748 05749 memset(expand.m_lpBits, fill, uExByteWidth8*uExHeight8); 05750 05751 for ( j=0 ; j<uSrcHeight8 ; j++ ) 05752 { 05753 for ( i=0 ; i<uSrcWidth8 ; i++ ) 05754 pDst[i] = pSrc[i]; 05755 05756 pSrc += uSrcByteWidth8; 05757 pDst += uExByteWidth8; 05758 } 05759 05760 // Resulting bitmap is bigger than original by nPixels all round so corner moves down and left 05761 expand.m_XOffset -= (double)nPixels; 05762 expand.m_YOffset -= (double)nPixels; 05763 05764 return expand; 05765 }
|
|
Extract the bitmap from the current pipeline state.
Definition at line 5392 of file nodeliveeffect.cpp. 05393 { 05394 if (m_lpInfo && m_XPelsPerMeter!=0 && m_YPelsPerMeter!=0) 05395 { 05396 m_lpInfo->bmiHeader.biXPelsPerMeter = m_XPelsPerMeter; 05397 m_lpInfo->bmiHeader.biYPelsPerMeter = m_YPelsPerMeter; 05398 m_XPelsPerMeter = 0; 05399 m_YPelsPerMeter = 0; 05400 } 05401 05402 pOutputInfo = m_lpInfo; 05403 pOutputBits = m_lpBits; 05404 m_bTemp = bTemp; 05405 }
|
|
Definition at line 601 of file nodeliveeffect.h. 00601 {return m_lpInfo->bmiHeader.biBitCount;}
|
|
Definition at line 600 of file nodeliveeffect.h.
|
|
Definition at line 587 of file nodeliveeffect.h.
|
|
Definition at line 599 of file nodeliveeffect.h.
|
|
Definition at line 602 of file nodeliveeffect.h. 00602 {return m_XPelsPerMeter==0 ? m_lpInfo->bmiHeader.biXPelsPerMeter : m_XPelsPerMeter;}
|
|
Definition at line 603 of file nodeliveeffect.h. 00603 {return m_YPelsPerMeter==0 ? m_lpInfo->bmiHeader.biYPelsPerMeter : m_YPelsPerMeter;}
|
|
Copy member vars that should propagate from one state to the next in a pipeline.
Definition at line 5275 of file nodeliveeffect.cpp. 05276 { 05277 m_XOffset = prevstate->m_XOffset; 05278 m_YOffset = prevstate->m_YOffset; 05279 05280 if (m_lpInfo) 05281 { 05282 m_lpInfo->bmiHeader.biXPelsPerMeter = prevstate->GetXPelsPerMeter(); 05283 m_lpInfo->bmiHeader.biYPelsPerMeter = prevstate->GetYPelsPerMeter(); 05284 } 05285 else 05286 { 05287 m_XPelsPerMeter = prevstate->GetXPelsPerMeter(); 05288 m_YPelsPerMeter = prevstate->GetYPelsPerMeter(); 05289 } 05290 }
|
|
Definition at line 589 of file nodeliveeffect.h. 00589 {return m_bOK;}
|
|
Assignment operator.
Definition at line 5340 of file nodeliveeffect.cpp. 05341 { 05342 if (m_lpInfo && m_lpBits && m_bTemp && m_lpInfo!=rhsstate.m_lpInfo && m_lpBits!=rhsstate.m_lpBits) 05343 { 05344 ::FreeDIB(m_lpInfo, m_lpBits); 05345 m_lpInfo = NULL; 05346 m_lpBits = NULL; 05347 } 05348 05349 m_lpInfo = rhsstate.m_lpInfo; 05350 m_lpBits = rhsstate.m_lpBits; 05351 m_XOffset = rhsstate.m_XOffset; 05352 m_YOffset = rhsstate.m_YOffset; 05353 m_bTemp = rhsstate.m_bTemp; 05354 m_bOK = rhsstate.m_bOK; 05355 05356 if (m_lpInfo) 05357 { 05358 m_lpInfo->bmiHeader.biXPelsPerMeter = rhsstate.GetXPelsPerMeter(); 05359 m_lpInfo->bmiHeader.biYPelsPerMeter = rhsstate.GetYPelsPerMeter(); 05360 m_XPelsPerMeter = 0; 05361 m_YPelsPerMeter = 0; 05362 } 05363 else 05364 { 05365 m_XPelsPerMeter = rhsstate.GetXPelsPerMeter(); 05366 m_YPelsPerMeter = rhsstate.GetYPelsPerMeter(); 05367 } 05368 05369 return *this; 05370 }
|
|
|
|
Definition at line 614 of file nodeliveeffect.h. |
|
Definition at line 613 of file nodeliveeffect.h. |
|
Definition at line 610 of file nodeliveeffect.h. |
|
Definition at line 609 of file nodeliveeffect.h. |
|
Definition at line 611 of file nodeliveeffect.h. |
|
Definition at line 615 of file nodeliveeffect.h. |
|
Definition at line 612 of file nodeliveeffect.h. |
|
Definition at line 616 of file nodeliveeffect.h. |