本文整理汇总了C++中CBitmap::Blit方法的典型用法代码示例。如果您正苦于以下问题:C++ CBitmap::Blit方法的具体用法?C++ CBitmap::Blit怎么用?C++ CBitmap::Blit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBitmap
的用法示例。
在下文中一共展示了CBitmap::Blit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ShowFrame
void CMovie::ShowFrame (ubyte* buf, uint bufw, uint bufh, uint sx, uint sy, uint w, uint h, uint dstx, uint dsty)
{
CBitmap bmFrame;
bmFrame.Init (BM_LINEAR, 0, 0, bufw, bufh, 1, buf);
bmFrame.SetPalette (movieManager.m_palette);
TRANSPARENCY_COLOR = 0;
if (gameOpts->movies.bFullScreen) {
double r = (double) bufh / (double) bufw;
int dh = (int) (CCanvas::Current ()->Width () * r);
int yOffs = (CCanvas::Current ()->Height () - dh) / 2;
ogl.SetBlending (false);
bmFrame.Render (CCanvas::Current (), 0, yOffs, CCanvas::Current ()->Width (), dh, sx, sy, bufw, bufh, 1, 0, gameOpts->movies.nQuality);
ogl.SetBlending (true);
}
else {
int xOffs = (CCanvas::Current ()->Width () - 640) / 2;
int yOffs = (CCanvas::Current ()->Height () - 480) / 2;
if (xOffs < 0)
xOffs = 0;
if (yOffs < 0)
yOffs = 0;
dstx += xOffs;
dsty += yOffs;
bmFrame.Blit (CCanvas::Current (), dstx, dsty, bufw, bufh, sx, sy, 1);
if ((CCanvas::Current ()->Width () > 640) || (CCanvas::Current ()->Height () > 480)) {
CCanvas::Current ()->SetColorRGBi (RGB_PAL (0, 0, 32));
OglDrawEmptyRect (dstx - 1, dsty, dstx + w, dsty + h + 1);
}
}
TRANSPARENCY_COLOR = DEFAULT_TRANSPARENCY_COLOR;
bmFrame.SetBuffer (NULL);
}
示例2: rcClient
/*virtual*/ void CWndTuner::OnPaint() {
static int nLastNote = -1;
static int nLastCents = -999;
CRect rcClient(m_rcClient);
rcClient.top += 74;
// BIOS::LCD::Bar(rcClient, RGB565(FFFFFF));
if (!m_bWave) {
BIOS::LCD::Bar(m_rcClient, RGB565(FFFFFF));
BIOS::LCD::Bar(m_rcClient.left, m_rcClient.bottom - 16, m_rcClient.right,
m_rcClient.bottom, RGB565(b0b0b0));
CBitmap bmp;
bmp.Load(bitmapTuner);
bmp.Blit(70, 32);
DrawPiano();
DrawScale();
CRect rcScale(200, 120, 340, 132);
BIOS::LCD::Print(rcScale.CenterX() - 5 * 4, rcScale.bottom + 2,
RGB565(000000), RGBTRANS, "cents");
BIOS::LCD::Print(240, BIOS::LCD::LcdHeight - 41, RGB565(ff0000), RGBTRANS,
"Spectrum");
}
float fBestFreq = GetFundamental();
if (fBestFreq == 0) {
BIOS::LCD::Bar(m_rcClient.left, m_rcClient.bottom - 16, m_rcClient.right,
m_rcClient.bottom, RGB565(b0b0b0));
BIOS::LCD::Print(4, BIOS::LCD::LcdHeight - 16, RGB565(000000),
RGB565(b0b0b0), "No signal detected");
if (nLastNote >= 0) {
DrawKey(nLastNote, false);
nLastNote = -1;
}
if (nLastCents != -999) {
DrawCents(nLastCents, false);
nLastCents = -999;
}
return;
}
float fNote =
log(fBestFreq / 440.0f) / log(2.0f) * 12.0f + 9 + 12 * 4; // 440Hz -> A4
int nBaseNote = (int)floor(fNote + 0.5f); // +50 cents
int nOctave = nBaseNote / 12;
int nNote = nBaseNote % 12;
int nCents = (int)((fNote - nBaseNote) * 100.0f);
if (nNote < 0) {
BIOS::LCD::Bar(m_rcClient.left, m_rcClient.bottom - 16, m_rcClient.right,
m_rcClient.bottom, RGB565(b0b0b0));
BIOS::LCD::Print(4, BIOS::LCD::LcdHeight - 16, RGB565(000000),
RGB565(b0b0b0), "Invalid signal");
if (nLastNote >= 0) {
DrawKey(nLastNote, false);
nLastNote = -1;
}
if (nLastCents != -999) {
DrawCents(nLastCents, false);
nLastCents = -999;
}
return;
}
const char *notes[] = {"C-", "C#", "D-", "D#", "E-", "F-",
"F#", "G-", "G#", "A-", "A#", "B-"};
BIOS::LCD::Printf(4, BIOS::LCD::LcdHeight - 16, RGB565(000000),
RGB565(b0b0b0), "%1f Hz -> Note: %s%d %c%d cents ",
fBestFreq, notes[nNote], nOctave, nCents >= 0 ? '+' : '-',
ABS(nCents));
if (nLastNote > -1) DrawKey(nLastNote, false);
nLastNote = nNote;
DrawKey(nNote, true);
if (nLastCents != -999) DrawCents(nLastCents, false);
nLastCents = nCents;
DrawCents(nLastCents, true);
}