void CBarShader::FillRect(CDC *dc, LPRECT rectSpan, float fRed, float fGreen, float fBlue, bool bFlat) { if(bFlat) { COLORREF color = RGB((int)(fRed + .5f), (int)(fGreen + .5f), (int)(fBlue + .5f)); dc->FillRect(rectSpan, &CBrush(color)); } else { if (m_Modifiers == NULL || (m_used3dlevel!=thePrefs.Get3DDepth() && !m_bIsPreview) ) BuildModifiers(); RECT rect = *rectSpan; int iTop = rect.top; int iBot = rect.bottom; int iMax = HALF(m_iHeight); for(int i = 0; i < iMax; i++) { CBrush cbNew(RGB((int)(fRed * m_Modifiers[i] + .5f), (int)(fGreen * m_Modifiers[i] + .5f), (int)(fBlue * m_Modifiers[i] + .5f))); rect.top = iTop + i; rect.bottom = iTop + i + 1; dc->FillRect(&rect, &cbNew); rect.top = iBot - i - 1; rect.bottom = iBot - i; dc->FillRect(&rect, &cbNew); } } }
/* Main program */ int main(int argc, char *argv[]) { dnaCtx mainDnaCtx = NULL; long value; /* Extract program name */ progname = strrchr(argv[0], '/'); if (progname == NULL) { progname = strrchr(argv[0], '\\'); } progname = (progname == NULL) ? argv[0] : progname + 1; argc--; argv++; value = setjmp(mark); if (value == -1) { return 1; } /* Initialize */ cb_dna_memcb.ctx = mainDnaCtx; cb_dna_memcb.manage = cb_manage; mainDnaCtx = dnaNew(&cb_dna_memcb, DNA_CHECK_ARGS); cbctx = cbNew(progname, convert.dir.pfb, convert.dir.otf, convert.dir.cmap, convert.dir.feat, mainDnaCtx); script.buf = NULL; dnaINIT(mainDnaCtx, script.args, 100, 500); convert.dir.pfb[0] = '\0'; convert.dir.otf[0] = '\0'; convert.dir.cmap[0] = '\0'; convert.dir.feat[0] = '\0'; convert.features = NULL; convert.hCMap = NULL; convert.vCMap = NULL; convert.flags = 0; convert.otherflags = 0; convert.os2_version = 0; convert.fsSelectionMask_on = -1; convert.fsSelectionMask_off = -1; /* Process args. Call convFont at end. */ parseArgs(argc, argv, 0); fprintf(stderr, "\n"); /* Terminate progress line */ /* Clean up */ cbMemFree(cbctx, script.buf); dnaFREE(script.args); cbFree(cbctx); return 0; }