本文整理汇总了C++中CFX_ByteTextBuf类的典型用法代码示例。如果您正苦于以下问题:C++ CFX_ByteTextBuf类的具体用法?C++ CFX_ByteTextBuf怎么用?C++ CFX_ByteTextBuf使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CFX_ByteTextBuf类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetSelectAppearanceStream
CFX_ByteString IFX_Edit::GetSelectAppearanceStream(
IFX_Edit* pEdit,
const CPDF_Point& ptOffset,
const CPVT_WordRange* pRange) {
CFX_ByteTextBuf sRet;
if (pRange && pRange->IsExist()) {
if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) {
pIterator->SetAt(pRange->BeginPos);
while (pIterator->NextWord()) {
CPVT_WordPlace place = pIterator->GetAt();
if (pRange && place.WordCmp(pRange->EndPos) > 0)
break;
CPVT_Word word;
CPVT_Line line;
if (pIterator->GetWord(word) && pIterator->GetLine(line)) {
sRet << word.ptWord.x + ptOffset.x << " "
<< line.ptLine.y + line.fLineDescent << " " << word.fWidth << " "
<< line.fLineAscent - line.fLineDescent << " re\nf\n";
}
}
}
}
return sRet.GetByteString();
}
示例2: GetImageAppStream
CFX_ByteString CPWL_Image::GetImageAppStream() {
CFX_ByteTextBuf sAppStream;
CFX_ByteString sAlias = GetImageAlias();
CFX_FloatRect rcPlate = GetClientRect();
CFX_Matrix mt;
mt.SetReverse(GetImageMatrix());
FX_FLOAT fHScale = 1.0f;
FX_FLOAT fVScale = 1.0f;
GetScale(fHScale, fVScale);
FX_FLOAT fx = 0.0f;
FX_FLOAT fy = 0.0f;
GetImageOffset(fx, fy);
if (m_pPDFStream && sAlias.GetLength() > 0) {
sAppStream << "q\n";
sAppStream << rcPlate.left << " " << rcPlate.bottom << " "
<< rcPlate.right - rcPlate.left << " "
<< rcPlate.top - rcPlate.bottom << " re W n\n";
sAppStream << fHScale << " 0 0 " << fVScale << " " << rcPlate.left + fx
<< " " << rcPlate.bottom + fy << " cm\n";
sAppStream << mt.GetA() << " " << mt.GetB() << " " << mt.GetC() << " "
<< mt.GetD() << " " << mt.GetE() << " " << mt.GetF() << " cm\n";
sAppStream << "0 g 0 G 1 w /" << sAlias.AsStringC() << " Do\n"
<< "Q\n";
}
return sAppStream.MakeString();
}
示例3: ASSERT
FX_BOOL Document::mailForm(IFXJS_Context* cc, const CJS_Parameters& params, CJS_Value& vRet, CFX_WideString& sError)
{
ASSERT(m_pDocument != NULL);
if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS)) return FALSE;
int iLength = params.size();
FX_BOOL bUI = iLength > 0 ? params[0].ToBool() : TRUE;
CFX_WideString cTo = iLength > 1 ? params[1].ToCFXWideString() : L"";
CFX_WideString cCc = iLength > 2 ? params[2].ToCFXWideString() : L"";
CFX_WideString cBcc = iLength > 3 ? params[3].ToCFXWideString() : L"";
CFX_WideString cSubject = iLength > 4 ? params[4].ToCFXWideString() : L"";
CFX_WideString cMsg = iLength > 5 ? params[5].ToCFXWideString() : L"";
CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)m_pDocument->GetInterForm();
ASSERT(pInterForm != NULL);
CFX_ByteTextBuf textBuf;
if (!pInterForm->ExportFormToFDFTextBuf(textBuf))
return FALSE;
CJS_Context* pContext = (CJS_Context*)cc;
ASSERT(pContext != NULL);
CPDFDoc_Environment* pEnv = pContext->GetReaderApp();
ASSERT(pEnv != NULL);
CJS_Runtime* pRuntime = pContext->GetJSRuntime();
ASSERT(pRuntime != NULL);
pRuntime->BeginBlock();
pEnv->JS_docmailForm(textBuf.GetBuffer(), textBuf.GetLength(), bUI, cTo.c_str(), cSubject.c_str(), cCc.c_str(), cBcc.c_str(), cMsg.c_str());
pRuntime->EndBlock();
return TRUE;
}
示例4: SetGraphState
void CFX_PSRenderer::SetGraphState(const CFX_GraphStateData* pGraphState)
{
CFX_ByteTextBuf buf;
if (!m_bGraphStateSet || m_CurGraphState.m_LineCap != pGraphState->m_LineCap) {
buf << pGraphState->m_LineCap << FX_BSTRC(" J\n");
}
if (!m_bGraphStateSet || m_CurGraphState.m_DashCount != pGraphState->m_DashCount ||
FXSYS_memcmp32(m_CurGraphState.m_DashArray, pGraphState->m_DashArray, sizeof(FX_FLOAT)*m_CurGraphState.m_DashCount)) {
buf << FX_BSTRC("[");
for (int i = 0; i < pGraphState->m_DashCount; i ++) {
buf << pGraphState->m_DashArray[i] << FX_BSTRC(" ");
}
buf << FX_BSTRC("]") << pGraphState->m_DashPhase << FX_BSTRC(" d\n");
}
if (!m_bGraphStateSet || m_CurGraphState.m_LineJoin != pGraphState->m_LineJoin) {
buf << pGraphState->m_LineJoin << FX_BSTRC(" j\n");
}
if (!m_bGraphStateSet || m_CurGraphState.m_LineWidth != pGraphState->m_LineWidth) {
buf << pGraphState->m_LineWidth << FX_BSTRC(" w\n");
}
if (!m_bGraphStateSet || m_CurGraphState.m_MiterLimit != pGraphState->m_MiterLimit) {
buf << pGraphState->m_MiterLimit << FX_BSTRC(" M\n");
}
m_CurGraphState.Copy(*pGraphState);
m_bGraphStateSet = TRUE;
if (buf.GetSize()) {
m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize());
}
}
示例5: FXGETFLAG_COLORTYPE
void CFX_PSRenderer::SetColor(FX_DWORD color, int alpha_flag, void* pIccTransform)
{
if (!CFX_GEModule::Get()->GetCodecModule() || !CFX_GEModule::Get()->GetCodecModule()->GetIccModule()) {
pIccTransform = NULL;
}
FX_BOOL bCMYK = FALSE;
if (pIccTransform) {
ICodec_IccModule* pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
color = FXGETFLAG_COLORTYPE(alpha_flag) ? FXCMYK_TODIB(color) : FXARGB_TODIB(color);
FX_LPBYTE pColor = (FX_LPBYTE)&color;
pIccModule->TranslateScanline(pIccTransform, pColor, pColor, 1);
color = m_bCmykOutput ? FXCMYK_TODIB(color) : FXARGB_TODIB(color);
bCMYK = m_bCmykOutput;
} else {
bCMYK = FXGETFLAG_COLORTYPE(alpha_flag);
}
if (bCMYK != m_bCmykOutput || !m_bColorSet || m_LastColor != color) {
CFX_ByteTextBuf buf;
if (bCMYK) {
buf << FXSYS_GetCValue(color) / 255.0 << FX_BSTRC(" ") << FXSYS_GetMValue(color) / 255.0 << FX_BSTRC(" ")
<< FXSYS_GetYValue(color) / 255.0 << FX_BSTRC(" ") << FXSYS_GetKValue(color) / 255.0 << FX_BSTRC(" k\n");
} else {
buf << FXARGB_R(color) / 255.0 << FX_BSTRC(" ") << FXARGB_G(color) / 255.0 << FX_BSTRC(" ")
<< FXARGB_B(color) / 255.0 << FX_BSTRC(" rg\n");
}
if (bCMYK == m_bCmykOutput) {
m_bColorSet = TRUE;
m_LastColor = color;
}
m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize());
}
}
示例6: GetName
void CXML_Parser::GetName(CFX_ByteString& space, CFX_ByteString& name) {
m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex;
if (IsEOF()) {
return;
}
CFX_ByteTextBuf buf;
uint8_t ch;
do {
while (m_dwIndex < m_dwBufferSize) {
ch = m_pBuffer[m_dwIndex];
if (ch == ':') {
space = buf.AsStringC();
buf.Clear();
} else if (g_FXCRT_XML_IsNameChar(ch)) {
buf.AppendChar(ch);
} else {
break;
}
m_dwIndex++;
}
m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex;
if (m_dwIndex < m_dwBufferSize || IsEOF()) {
break;
}
} while (ReadNextBlock());
name = buf.AsStringC();
}
示例7: StartRendering
FX_BOOL CFX_PSRenderer::DrawPath(const CFX_PathData* pPathData,
const CFX_AffineMatrix* pObject2Device,
const CFX_GraphStateData* pGraphState,
FX_DWORD fill_color,
FX_DWORD stroke_color,
int fill_mode,
int alpha_flag,
void* pIccTransform
)
{
StartRendering();
int fill_alpha = FXGETFLAG_COLORTYPE(alpha_flag) ? FXGETFLAG_ALPHA_FILL(alpha_flag) : FXARGB_A(fill_color);
int stroke_alpha = FXGETFLAG_COLORTYPE(alpha_flag) ? FXGETFLAG_ALPHA_STROKE(alpha_flag) : FXARGB_A(stroke_color);
if (fill_alpha && fill_alpha < 255) {
return FALSE;
}
if (stroke_alpha && stroke_alpha < 255) {
return FALSE;
}
if (fill_alpha == 0 && stroke_alpha == 0) {
return FALSE;
}
if (stroke_alpha) {
SetGraphState(pGraphState);
if (pObject2Device) {
CFX_ByteTextBuf buf;
buf << FX_BSTRC("mx Cm [") << pObject2Device->a << FX_BSTRC(" ") << pObject2Device->b << FX_BSTRC(" ") <<
pObject2Device->c << FX_BSTRC(" ") << pObject2Device->d << FX_BSTRC(" ") << pObject2Device->e <<
FX_BSTRC(" ") << pObject2Device->f << FX_BSTRC("]cm ");
m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize());
}
}
OutputPath(pPathData, stroke_alpha ? NULL : pObject2Device);
if (fill_mode && fill_alpha) {
SetColor(fill_color, alpha_flag, pIccTransform);
if ((fill_mode & 3) == FXFILL_WINDING) {
if (stroke_alpha) {
OUTPUT_PS("q f Q ");
} else {
OUTPUT_PS("f");
}
} else if ((fill_mode & 3) == FXFILL_ALTERNATE) {
if (stroke_alpha) {
OUTPUT_PS("q F Q ");
} else {
OUTPUT_PS("F");
}
}
}
if (stroke_alpha) {
SetColor(stroke_color, alpha_flag, pIccTransform);
if (pObject2Device) {
OUTPUT_PS("s sm");
} else {
OUTPUT_PS("s");
}
}
OUTPUT_PS("\n");
return TRUE;
}
示例8: SubmitForm
FX_BOOL CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination,
FX_BOOL bUrlEncoded) {
if (sDestination.IsEmpty())
return FALSE;
if (!m_pDocument || !m_pInterForm)
return FALSE;
CPDFSDK_Environment* pEnv = m_pDocument->GetEnv();
CFX_WideString wsPDFFilePath = m_pDocument->GetPath();
CFDF_Document* pFDFDoc =
m_pInterForm->ExportToFDF(wsPDFFilePath.AsStringC(), false);
if (!pFDFDoc)
return FALSE;
CFX_ByteTextBuf FdfBuffer;
FX_BOOL bRet = pFDFDoc->WriteBuf(FdfBuffer);
delete pFDFDoc;
if (!bRet)
return FALSE;
uint8_t* pBuffer = FdfBuffer.GetBuffer();
FX_STRSIZE nBufSize = FdfBuffer.GetLength();
if (bUrlEncoded && !FDFToURLEncodedData(pBuffer, nBufSize))
return FALSE;
pEnv->JS_docSubmitForm(pBuffer, nBufSize, sDestination.c_str());
if (bUrlEncoded)
FX_Free(pBuffer);
return TRUE;
}
示例9: WriteFile
FX_BOOL CFDF_Document::WriteFile(IFX_FileWrite *pFile) const
{
CFX_ByteTextBuf buf;
WriteBuf(buf);
FX_BOOL bRet = pFile->WriteBlock(buf.GetBuffer(), buf.GetSize());
if (bRet) {
pFile->Flush();
}
return bRet;
}
示例10: GetTextAppearanceStream
CFX_ByteString CPWL_Edit::GetTextAppearanceStream(
const CFX_PointF& ptOffset) const {
CFX_ByteTextBuf sRet;
CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(m_pEdit.get(), ptOffset);
if (sEdit.GetLength() > 0) {
sRet << "BT\n"
<< CPWL_Utils::GetColorAppStream(GetTextColor()).AsStringC()
<< sEdit.AsStringC() << "ET\n";
}
return sRet.MakeString();
}
示例11: GetTextAppearanceStream
CFX_ByteString CPWL_Label::GetTextAppearanceStream(
const CFX_FloatPoint& ptOffset) const {
CFX_ByteTextBuf sRet;
CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(m_pEdit, ptOffset);
if (sEdit.GetLength() > 0) {
sRet << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()) << sEdit
<< "ET\n";
}
return sRet.GetByteString();
}
示例12: ptOffset
void CPWL_ListBox::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
CPWL_Wnd::GetThisAppearanceStream(sAppStream);
CFX_ByteTextBuf sListItems;
if (m_pList) {
CFX_FloatRect rcPlate = m_pList->GetPlateRect();
for (int32_t i = 0, sz = m_pList->GetCount(); i < sz; i++) {
CFX_FloatRect rcItem = m_pList->GetItemRect(i);
if (rcItem.bottom > rcPlate.top || rcItem.top < rcPlate.bottom)
continue;
CFX_FloatPoint ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f);
if (m_pList->IsItemSelected(i)) {
sListItems << CPWL_Utils::GetRectFillAppStream(rcItem,
PWL_DEFAULT_SELBACKCOLOR)
.AsStringC();
CFX_ByteString sItem =
CPWL_Utils::GetEditAppStream(m_pList->GetItemEdit(i), ptOffset);
if (sItem.GetLength() > 0) {
sListItems << "BT\n"
<< CPWL_Utils::GetColorAppStream(PWL_DEFAULT_SELTEXTCOLOR)
.AsStringC()
<< sItem.AsStringC() << "ET\n";
}
} else {
CFX_ByteString sItem =
CPWL_Utils::GetEditAppStream(m_pList->GetItemEdit(i), ptOffset);
if (sItem.GetLength() > 0) {
sListItems << "BT\n"
<< CPWL_Utils::GetColorAppStream(GetTextColor())
.AsStringC()
<< sItem.AsStringC() << "ET\n";
}
}
}
}
if (sListItems.GetLength() > 0) {
CFX_ByteTextBuf sClip;
CFX_FloatRect rcClient = GetClientRect();
sClip << "q\n";
sClip << rcClient.left << " " << rcClient.bottom << " "
<< rcClient.right - rcClient.left << " "
<< rcClient.top - rcClient.bottom << " re W n\n";
sClip << sListItems << "Q\n";
sAppStream << "/Tx BMC\n" << sClip << "EMC\n";
}
}
示例13: GetFontSetString
static CFX_ByteString GetFontSetString(IFX_Edit_FontMap* pFontMap,
int32_t nFontIndex,
FX_FLOAT fFontSize) {
CFX_ByteTextBuf sRet;
if (pFontMap) {
CFX_ByteString sFontAlias = pFontMap->GetPDFFontAlias(nFontIndex);
if (sFontAlias.GetLength() > 0 && fFontSize > 0)
sRet << "/" << sFontAlias << " " << fFontSize << " Tf\n";
}
return sRet.GetByteString();
}
示例14: ParseStyle
CFX_ByteString ParseStyle(FX_LPCSTR pStyle, int iLen, int iIndex)
{
CFX_ByteTextBuf buf;
if (!iLen || iLen <= iIndex) {
return buf.GetByteString();
}
while (iIndex < iLen) {
if (pStyle[iIndex] == ',') {
break;
}
buf.AppendChar(pStyle[iIndex]);
++iIndex;
}
return buf.GetByteString();
}
示例15: OutputPath
void CFX_PSRenderer::OutputPath(const CFX_PathData* pPathData, const CFX_AffineMatrix* pObject2Device)
{
int nPoints = pPathData->GetPointCount();
CFX_ByteTextBuf buf;
buf.EstimateSize(nPoints * 10);
for (int i = 0; i < nPoints; i ++) {
FX_BYTE flag = pPathData->GetFlag(i);
FX_FLOAT x = pPathData->GetPointX(i);
FX_FLOAT y = pPathData->GetPointY(i);
if (pObject2Device) {
pObject2Device->Transform(x, y);
}
buf << x << FX_BSTRC(" ") << y;
switch (flag & FXPT_TYPE) {
case FXPT_MOVETO:
buf << FX_BSTRC(" m ");
break;
case FXPT_LINETO:
if (flag & FXPT_CLOSEFIGURE) {
buf << FX_BSTRC(" l h ");
} else {
buf << FX_BSTRC(" l ");
}
break;
case FXPT_BEZIERTO: {
FX_FLOAT x1 = pPathData->GetPointX(i + 1);
FX_FLOAT x2 = pPathData->GetPointX(i + 2);
FX_FLOAT y1 = pPathData->GetPointY(i + 1);
FX_FLOAT y2 = pPathData->GetPointY(i + 2);
if (pObject2Device) {
pObject2Device->Transform(x1, y1);
pObject2Device->Transform(x2, y2);
}
buf << FX_BSTRC(" ") << x1 << FX_BSTRC(" ") << y1 << FX_BSTRC(" ") << x2 << FX_BSTRC(" ") << y2;
if (flag & FXPT_CLOSEFIGURE) {
buf << FX_BSTRC(" c h\n");
} else {
buf << FX_BSTRC(" c\n");
}
i += 2;
break;
}
}
}
m_pOutput->OutputPS((FX_LPCSTR)buf.GetBuffer(), buf.GetSize());
}