//----------------------------------------------------------------------------- // Name: // Desc: //----------------------------------------------------------------------------- HRESULT CDisplay::Blt( DWORD x, DWORD y, CSurface* pSurface, RECT* prc ) { if( NULL == pSurface ) return E_INVALIDARG; if( pSurface->IsColorKeyed() ) return Blt( x, y, pSurface->GetDDrawSurface(), prc, DDBLTFAST_SRCCOLORKEY ); else return Blt( x, y, pSurface->GetDDrawSurface(), prc, 0L ); }
void BlendBlt(int pno, int dx, int dy, int ar, int ag, int ab, int br, int bg, int bb) { #if SDL_USE_OPENGL glColor4ub(255, 255, 255, ar); Blt(pno, dx, dy); glColor4ub(255, 255, 255, 255); #else if ( s_pYGSTexture[pno] == NULL ) return; SDL_SetAlpha(s_pYGSTexture[pno], SDL_SRCALPHA | SDL_RLEACCEL, 128); Blt(pno, dx, dy); SDL_SetAlpha(s_pYGSTexture[pno], SDL_SRCALPHA | SDL_RLEACCEL, 255); #endif }
// 이미지의 일부분만 서피스로 만드는 버전 xRESULT XSurfaceOpenGL::Create( const int memSrcx, const int memSrcy, const int memSrcw, const int memSrch, const float surfaceDstw, const float surfaceDsth, const float adjx, const float adjy, void *_pSrcImg, const int bpp, BOOL bSrcKeep ) { if( XBREAK( bpp == 2 ) ) return xFAIL; // 빈 텍스쳐 만듬. // m_nWidth = dstw; // m_nHeight = dsth; SetAdjust( adjx, adjy ); // m_AdjustX = adjx; // m_AdjustY = adjy; // w,h값을 2^단위로 정렬한다. int memDstw = ConvertToMemSize( surfaceDstw ); int memDsth = ConvertToMemSize( surfaceDsth ); GLsizei alignedW = memDstw; GLsizei alignedH = memDsth; GRAPHICS->AlignPowSize( &alignedW, &alignedH ); // 정렬된 크기로 버텍스버퍼생성. CreateVertexBuffer( surfaceDstw, surfaceDsth, adjx, adjy, memDstw, memDsth, alignedW, alignedH ); m_nAlignedWidth = alignedW; m_nAlignedHeight = alignedH; // pImg내용을 this로 옮김. // int areaw = ConvertToMemSize( surfaceDstw ); // int areah = ConvertToMemSize( surfaceDsth ); RECT rect = { memSrcx, memSrcy, memSrcx+memDstw-1, memSrcy+memDsth-1 }; Blt( (DWORD *)_pSrcImg, &rect, bpp, xNO_ALPHA, memSrcw, memSrch, 0, bSrcKeep ); return xSUCCESS; }
// pImg로 버텍스/텍스쳐버퍼 생성. xRESULT XSurfaceOpenGL::Create( const float surfaceW, const float surfaceH, const float adjx, const float adjy, xAlpha alpha, const void *pImg, int bytePerPixel, XCOLOR dwKeyColor, BOOL bSrcKeep ) { // 빈 텍스쳐 만듬. float memSrcw = ConvertToMemSize( surfaceW ); float memSrch = ConvertToMemSize( surfaceH ); // m_nWidth = width; // m_nHeight = height; SetAdjust( adjx, adjy ); GLsizei alignedW = memSrcw; GLsizei alignedH = memSrch; // m_AdjustX = adjx; // m_AdjustY = adjy; // w,h값을 2^단위로 정렬한다. GRAPHICS->AlignPowSize( &alignedW, &alignedH ); // 정렬된 크기로 버텍스버퍼생성. // CreateVertexBuffer( alignedW, alignedH, adjx, adjy ); CreateVertexBuffer( surfaceW, surfaceH, adjx, adjy, memSrcw, memSrch, alignedW, alignedH ); m_nAlignedWidth = alignedW; m_nAlignedHeight = alignedH; // pImg내용을 this로 옮김. Blt( (DWORD *)pImg, NULL, bytePerPixel, alpha, memSrcw, memSrch, dwKeyColor, bSrcKeep ); return xSUCCESS; }
void DibBitmap::Scroll(Rect *prcSrc, int xDst, int yDst) { // Some implementations do blts differently (such as rotated dibs). // That is why this method - essentially a blt from and to the // destination - exists. Blt(this, prcSrc, xDst, yDst); }
void DibBitmap::BltTiles(DibBitmap *pbmSrc, UpdateMap *pupd, int yTopDst) { bool fFirst = true; Rect rc; while (pupd->EnumUpdateRects(fFirst, NULL, &rc)) { fFirst = false; Blt(pbmSrc, &rc, rc.left, rc.top + yTopDst); } }
STDMETHODIMP CFACE::SpritePaste( LONG FromID , LONG ToID , LONG x , LONG y ){ CHECK_MODE( dwDrawMode ); CHECK_RANGE_STR( FromID , 0 , dwSpriteNum , "Draw系関数(SpritePaste)->Sprite ID" ); CHECK_RANGE_STR( ToID , 0 , dwSpriteNum , "Draw系関数(SpritePaste)->Sprite ID" ); CHECK_EMPTY_STR( Sprites, FromID , "Draw系関数(SpritePaste)->Sprite" ); Blt( FromID , 0 , 0 , EXPAND_SIZE( Sprites[ FromID ].Size ) , ToID , x , y ); return S_OK; }
void DDSpriteBuffer_BltImg(int pX, int pY, int graphic, int sync_frame) { struct GraphicInfo_SP g; if (NoDisplayFlag) return; getGraphicSource_SP(&g, graphic, sync_frame, -1, -1); Blt(pX, pY, g.bitmap, g.src_x, g.src_y); }
STDMETHODIMP CFACE::SpriteCopy( LONG FromID , LONG ToID ){ CHECK_MODE( dwDrawMode ); CHECK_RANGE_STR( FromID , 0 , dwSpriteNum , "Draw系関数(SpriteCopy)->Sprite ID" ); CHECK_RANGE_STR( ToID , 0 , dwSpriteNum , "Draw系関数(SpriteCopy)->Sprite ID" ); CHECK_EMPTY_STR( Sprites, FromID , "Draw系関数(SpriteCopy)->Sprite" ); /* -- ブリッティング(コピー ) -- */ Blt( FromID , 0 , 0 , EXPAND_SIZE( Sprites[ FromID ].Size ) , ToID , 0 , 0 ); return S_OK; }
void DibBitmap::BltTiles(DibBitmap *pbmSrc, UpdateMap *pupd, int yTopDst) { // OS5 path usually not executed if (IsOS50Compat()) { bool fFirst = true; Rect rc; while (pupd->EnumUpdateRects(fFirst, NULL, &rc)) { fFirst = false; Blt(pbmSrc, &rc, rc.left, rc.top + yTopDst); } return; } // Init bool *pfMap = pupd->GetInvalidMap(); MapInfo *pmnfo = pupd->GetMapInfo(); Size sizMap; pupd->GetMapSize(&sizMap); dword cbOffset = yTopDst * (dword)m_siz.cx; byte *pbSrc = pbmSrc->GetBits(); byte *pbDst = m_pb + cbOffset; switch (gcxTile) { case 16: UpdateScreen816(pfMap, sizMap.cx, sizMap.cy, pbSrc, pbDst, m_siz.cx, pmnfo->cxLeftTile, pmnfo->cyTopTile, pmnfo->cxRightTile, pmnfo->cyBottomTile, pmnfo->ctxInside, pmnfo->ctyInside); break; case 24: UpdateScreen824(pfMap, sizMap.cx, sizMap.cy, pbSrc, pbDst, m_siz.cx, pmnfo->cxLeftTile, pmnfo->cyTopTile, pmnfo->cxRightTile, pmnfo->cyBottomTile, pmnfo->ctxInside, pmnfo->ctyInside); break; } }
void ExBlt(int pno, int dx, int dy) { Blt(pno, dx * zoomRate, dy * zoomRate); }
void BltFast(int pno, int dx, int dy) { Blt(pno, dx, dy); }
void DibBitmap::BltTiles(DibBitmap *pbmSrc, UpdateMap *pupd, int yTopDst) { MapInfo *pmnfo = pupd->GetMapInfo(); bool *pfInvalid = pupd->GetInvalidMap(); Size sizMap; pupd->GetMapSize(&sizMap); int cbReturn = sizMap.cx - ((pmnfo->cxLeftTile != 0 ? 1 : 0) + pmnfo->ctxInside + (pmnfo->cxRightTile != 0 ? 1 : 0)); Rect rcSrc; int xT = 0; int yDst = yTopDst; int ySrc = 0; if (pmnfo->cyTopTile != 0) { // Upper left corner if (pmnfo->cxLeftTile != 0 && *pfInvalid++) { rcSrc.Set(xT, ySrc, xT + pmnfo->cxLeftTile, ySrc + pmnfo->cyTopTile); Blt(pbmSrc, &rcSrc, xT, yDst); } xT += pmnfo->cxLeftTile; // Upper edge for (int tx = 0; tx < pmnfo->ctxInside; tx++) { if (*pfInvalid++) { rcSrc.Set(xT, ySrc, xT + gcxTile, ySrc + pmnfo->cyTopTile); Blt(pbmSrc, &rcSrc, xT, yDst); } xT += gcxTile; } // Upper right corner if (pmnfo->cxRightTile != 0 && *pfInvalid++) { rcSrc.Set(xT, ySrc, xT + pmnfo->cxRightTile, ySrc + pmnfo->cyTopTile); Blt(pbmSrc, &rcSrc, xT, yDst); } xT = 0; yDst += pmnfo->cyTopTile; ySrc += pmnfo->cyTopTile; pfInvalid += cbReturn; } // Inside for (int ty = 0; ty < pmnfo->ctyInside; ty++) { // Inside left if (pmnfo->cxLeftTile != 0 && *pfInvalid++) { rcSrc.Set(xT, ySrc, xT + pmnfo->cxLeftTile, ySrc + gcyTile); Blt(pbmSrc, &rcSrc, xT, yDst); } xT += pmnfo->cxLeftTile; // Inside for (int tx = 0; tx < pmnfo->ctxInside; tx++) { if (*pfInvalid++) { rcSrc.Set(xT, ySrc, xT + gcxTile, ySrc + gcyTile); Blt(pbmSrc, &rcSrc, xT, yDst); } xT += gcxTile; } // Inside right if (pmnfo->cxRightTile != 0 && *pfInvalid++) { rcSrc.Set(xT, ySrc, xT + pmnfo->cxRightTile, ySrc + gcyTile); Blt(pbmSrc, &rcSrc, xT, yDst); } xT = 0; yDst += gcyTile; ySrc += gcyTile; pfInvalid += cbReturn; } if (pmnfo->cyBottomTile != 0) { // Bottom left tile if (pmnfo->cxLeftTile != 0 && *pfInvalid++) { rcSrc.Set(xT, ySrc, xT + pmnfo->cxLeftTile, ySrc + pmnfo->cyBottomTile); Blt(pbmSrc, &rcSrc, xT, yDst); } xT += pmnfo->cxLeftTile; // Bottom edge for (int tx = 0; tx < pmnfo->ctxInside; tx++) { if (*pfInvalid++) { rcSrc.Set(xT, ySrc, xT + gcxTile, ySrc + pmnfo->cyBottomTile); Blt(pbmSrc, &rcSrc, xT, yDst); } xT += gcxTile; } // Bottom right corner if (pmnfo->cxRightTile != 0 && *pfInvalid++) { rcSrc.Set(xT, ySrc, xT + pmnfo->cxRightTile, ySrc + pmnfo->cyBottomTile); Blt(pbmSrc, &rcSrc, xT, yDst); } } }