void CObjectImageArray::CopyImage (CG16bitImage &Dest, int x, int y, int iFrame, int iRotation) const // CopyImage // // Copies entire image to the destination { if (m_pImage) { CG16bitImage *pSource = m_pImage->GetImage(); if (pSource == NULL) return; int xSrc = m_rcImage.left + (iFrame * RectWidth(m_rcImage)); int ySrc = m_rcImage.top + (iRotation * RectHeight(m_rcImage)); Dest.Blt(xSrc, ySrc, RectWidth(m_rcImage), RectHeight(m_rcImage), *pSource, x, y); Dest.CopyAlpha(xSrc, ySrc, RectWidth(m_rcImage), RectHeight(m_rcImage), *pSource, x, y); } }
void CObjectImageArray::PaintImageUL (CG16bitImage &Dest, int x, int y, int iTick, int iRotation, bool srcAlpha) const // PaintImageUL // // Paints the image. x,y is the upper-left corner of the destination // // Note: This should not use the rotation offsets { if (m_pImage) { CG16bitImage &Source(*m_pImage->GetImage()); int xSrc = ComputeSourceX(iTick); int ySrc; if (m_iBlending == blendLighten) { Dest.BltLighten(xSrc, m_rcImage.top + (iRotation * RectHeight(m_rcImage)), RectWidth(m_rcImage), RectHeight(m_rcImage), 255, Source, x, y); } else { ySrc = m_rcImage.top + (iRotation * RectHeight(m_rcImage)); Dest.Blt(x, y, Source, xSrc, ySrc, xSrc + RectWidth(m_rcImage), ySrc + RectHeight(m_rcImage), srcAlpha); } } }
void CG16bitSprite::ColorTransBlt (CG16bitImage &Dest, int xDest, int yDest, int xSrc, int ySrc, int cxWidth, int cyHeight) // ColorTransBlt // // Blt the sprite { Dest.Blt(xDest, yDest, m_Img, xSrc, ySrc, xSrc + cxWidth, ySrc + cyHeight); }
void CObjectImageArray::CopyImage (CG16bitImage &Dest, int x, int y, int iFrame, int iRotation) const // CopyImage // // Copies entire image to the destination { if (m_pImage) { CG16bitImage &Source(*m_pImage->GetImage()); int xSrc = m_rcImage.left + (iFrame * RectWidth(m_rcImage)); int ySrc = m_rcImage.top + (iRotation * RectHeight(m_rcImage)); Dest.Blt(x, y, Source, xSrc, ySrc, xSrc + RectWidth(m_rcImage), ySrc + RectHeight(m_rcImage), false); } }
void CPlayerDisplay::Paint (CG16bitImage &Dest) // Paint // // Paints the display { if (m_bInvalid) { PaintBuffer(); m_bInvalid = false; } Dest.Blt(0, 0, RectWidth(m_rcRect), RectHeight(m_rcRect), m_Buffer, m_rcRect.left, m_rcRect.top); }
void CObjectImageArray::PaintImage (CG16bitImage &Dest, int x, int y, int iTick, int iRotation, bool srcAlpha) const // PaintImage // // Paints the image on the destination { if (m_pImage) { CG16bitImage &Source(*m_pImage->GetImage()); int xSrc = ComputeSourceX(iTick); int ySrc; if (m_pRotationOffset) { x += m_pRotationOffset[iRotation % m_iRotationCount].x; y -= m_pRotationOffset[iRotation % m_iRotationCount].y; } if (m_iBlending == blendLighten) { Dest.BltLighten(xSrc, m_rcImage.top + (iRotation * RectHeight(m_rcImage)), RectWidth(m_rcImage), RectHeight(m_rcImage), 255, Source, x - (RectWidth(m_rcImage) / 2), y - (RectHeight(m_rcImage) / 2)); } else { ySrc = m_rcImage.top + (iRotation * RectHeight(m_rcImage)); Dest.Blt(x - (RectWidth(m_rcImage) / 2), y - (RectHeight(m_rcImage) / 2), Source, xSrc, ySrc, xSrc + RectWidth(m_rcImage), ySrc + RectHeight(m_rcImage), srcAlpha); } } }
void CAdventureDesc::CreateIcon (int cxWidth, int cyHeight, CG16bitImage **retpIcon) // CreateIcon // // Creates a cover icon for the adventure. The caller is responsible for // freeing the result. { // Load the image CG16bitImage *pBackground = g_pUniverse->GetLibraryBitmap(GetBackgroundUNID()); if (pBackground == NULL || pBackground->GetWidth() == 0 || pBackground->GetHeight() == 0) { int cxSize = Min(cxWidth, cyHeight); *retpIcon = new CG16bitImage; (*retpIcon)->CreateBlank(cxSize, cxSize, false); return; } // Figure out the dimensions of the icon based on the image size and the // desired output. // // If the background is larger than the icon size then we need to scale it. CG16bitImage *pIcon; if (pBackground->GetWidth() > cxWidth || pBackground->GetHeight() > cyHeight) { Metric rScale = (Metric)cxWidth / pBackground->GetWidth(); if (rScale * pBackground->GetHeight() > (Metric)cyHeight) rScale = (Metric)cyHeight / pBackground->GetHeight(); int cxDest = (int)(rScale * pBackground->GetWidth()); int cyDest = (int)(rScale * pBackground->GetHeight()); // Create the icon pIcon = new CG16bitImage; pIcon->CreateBlank(cxDest, cyDest, false); // Scale DrawBltTransformed(*pIcon, cxDest / 2, cyDest / 2, rScale, rScale, 0.0, *pBackground, 0, 0, pBackground->GetWidth(), pBackground->GetHeight()); } // Otherwise we center the image on the icon else { // Create the icon pIcon = new CG16bitImage; pIcon->CreateBlank(cxWidth, cyHeight, false); // Blt pIcon->Blt(0, 0, pBackground->GetWidth(), pBackground->GetHeight(), *pBackground, (cxWidth - pBackground->GetWidth()) / 2, (cyHeight - pBackground->GetHeight()) / 2); } // Done *retpIcon = pIcon; }