summaryrefslogtreecommitdiff
path: root/fxbarcode/oned/BC_OnedUPCAWriter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fxbarcode/oned/BC_OnedUPCAWriter.cpp')
-rw-r--r--fxbarcode/oned/BC_OnedUPCAWriter.cpp132
1 files changed, 45 insertions, 87 deletions
diff --git a/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/fxbarcode/oned/BC_OnedUPCAWriter.cpp
index 87c6db12e1..3d31e2d389 100644
--- a/fxbarcode/oned/BC_OnedUPCAWriter.cpp
+++ b/fxbarcode/oned/BC_OnedUPCAWriter.cpp
@@ -119,13 +119,12 @@ uint8_t* CBC_OnedUPCAWriter::Encode(const CFX_ByteString& contents,
void CBC_OnedUPCAWriter::ShowChars(
const CFX_WideStringC& contents,
- const CFX_RetainPtr<CFX_DIBitmap>& pOutBitmap,
CFX_RenderDevice* device,
const CFX_Matrix* matrix,
int32_t barWidth,
int32_t multiple,
int32_t& e) {
- if (!device && !pOutBitmap) {
+ if (!device) {
e = BCExceptionIllegalArgument;
return;
}
@@ -139,68 +138,53 @@ void CBC_OnedUPCAWriter::ShowChars(
CFX_ByteString tempStr = str.Mid(1, 5);
float strWidth = (float)35 * multiple;
float blank = 0.0;
- CFX_FxgeDevice geBitmap;
- if (pOutBitmap)
- geBitmap.Attach(pOutBitmap, false, nullptr, false);
iLen = tempStr.GetLength();
int32_t iFontSize = (int32_t)fabs(m_fFontSize);
int32_t iTextHeight = iFontSize + 1;
- if (!pOutBitmap) {
- CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
- CFX_FloatRect rect((float)leftPosition, (float)(m_Height - iTextHeight),
- (float)(leftPosition + strWidth - 0.5), (float)m_Height);
- matr.Concat(*matrix);
- matr.TransformRect(rect);
- FX_RECT re = rect.GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
- CFX_Matrix matr1(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
- CFX_FloatRect rect1(
- (float)(leftPosition + 40 * multiple), (float)(m_Height - iTextHeight),
- (float)((leftPosition + 40 * multiple) + strWidth - 0.5),
- (float)m_Height);
- matr1.Concat(*matrix);
- matr1.TransformRect(rect1);
- re = rect1.GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
- float strWidth1 = (float)multiple * 7;
- CFX_Matrix matr2(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
- CFX_FloatRect rect2(0.0, (float)(m_Height - iTextHeight),
- (float)strWidth1 - 1, (float)m_Height);
- matr2.Concat(*matrix);
- matr2.TransformRect(rect2);
- re = rect2.GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
- CFX_Matrix matr3(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
- CFX_FloatRect rect3(
- (float)(leftPosition + 85 * multiple), (float)(m_Height - iTextHeight),
- (float)((leftPosition + 85 * multiple) + strWidth1 - 0.5),
- (float)m_Height);
- matr3.Concat(*matrix);
- matr3.TransformRect(rect3);
- re = rect3.GetOuterRect();
- device->FillRect(&re, m_backgroundColor);
- }
- if (!pOutBitmap)
- strWidth = strWidth * m_outputHScale;
+
+ CFX_Matrix matr(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
+ CFX_FloatRect rect((float)leftPosition, (float)(m_Height - iTextHeight),
+ (float)(leftPosition + strWidth - 0.5), (float)m_Height);
+ matr.Concat(*matrix);
+ matr.TransformRect(rect);
+ FX_RECT re = rect.GetOuterRect();
+ device->FillRect(&re, m_backgroundColor);
+ CFX_Matrix matr1(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
+ CFX_FloatRect rect1((float)(leftPosition + 40 * multiple),
+ (float)(m_Height - iTextHeight),
+ (float)((leftPosition + 40 * multiple) + strWidth - 0.5),
+ (float)m_Height);
+ matr1.Concat(*matrix);
+ matr1.TransformRect(rect1);
+ re = rect1.GetOuterRect();
+ device->FillRect(&re, m_backgroundColor);
+ float strWidth1 = (float)multiple * 7;
+ CFX_Matrix matr2(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
+ CFX_FloatRect rect2(0.0, (float)(m_Height - iTextHeight),
+ (float)strWidth1 - 1, (float)m_Height);
+ matr2.Concat(*matrix);
+ matr2.TransformRect(rect2);
+ re = rect2.GetOuterRect();
+ device->FillRect(&re, m_backgroundColor);
+ CFX_Matrix matr3(m_outputHScale, 0.0, 0.0, 1.0, 0.0, 0.0);
+ CFX_FloatRect rect3((float)(leftPosition + 85 * multiple),
+ (float)(m_Height - iTextHeight),
+ (float)((leftPosition + 85 * multiple) + strWidth1 - 0.5),
+ (float)m_Height);
+ matr3.Concat(*matrix);
+ matr3.TransformRect(rect3);
+ re = rect3.GetOuterRect();
+ device->FillRect(&re, m_backgroundColor);
+ strWidth = strWidth * m_outputHScale;
CalcTextInfo(tempStr, pCharPos + 1, m_pFont, strWidth, iFontSize, blank);
- CFX_Matrix affine_matrix(1.0, 0.0, 0.0, -1.0, 0.0, (float)iFontSize);
- CFX_FxgeDevice ge;
- if (pOutBitmap) {
- ge.Create((int)strWidth, iTextHeight, FXDIB_Argb, nullptr);
- ge.GetBitmap()->Clear(m_backgroundColor);
- ge.DrawNormalText(iLen, pCharPos + 1, m_pFont,
- static_cast<float>(iFontSize), &affine_matrix,
- m_fontColor, FXTEXT_CLEARTYPE);
- geBitmap.SetDIBits(ge.GetBitmap(), leftPosition, m_Height - iTextHeight);
- } else {
+ {
CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0,
(float)leftPosition * m_outputHScale,
(float)(m_Height - iTextHeight + iFontSize));
- if (matrix) {
+ if (matrix)
affine_matrix1.Concat(*matrix);
- }
device->DrawNormalText(iLen, pCharPos + 1, m_pFont,
static_cast<float>(iFontSize), &affine_matrix1,
m_fontColor, FXTEXT_CLEARTYPE);
@@ -208,22 +192,13 @@ void CBC_OnedUPCAWriter::ShowChars(
tempStr = str.Mid(6, 5);
iLen = tempStr.GetLength();
CalcTextInfo(tempStr, pCharPos + 6, m_pFont, strWidth, iFontSize, blank);
- if (pOutBitmap) {
- FX_RECT rect2(0, 0, (int)strWidth, iTextHeight);
- ge.FillRect(&rect2, m_backgroundColor);
- ge.DrawNormalText(iLen, pCharPos + 6, m_pFont,
- static_cast<float>(iFontSize), &affine_matrix,
- m_fontColor, FXTEXT_CLEARTYPE);
- geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 40 * multiple,
- m_Height - iTextHeight);
- } else {
+ {
CFX_Matrix affine_matrix1(
1.0, 0.0, 0.0, -1.0,
(float)(leftPosition + 40 * multiple) * m_outputHScale,
(float)(m_Height - iTextHeight + iFontSize));
- if (matrix) {
+ if (matrix)
affine_matrix1.Concat(*matrix);
- }
device->DrawNormalText(iLen, pCharPos + 6, m_pFont,
static_cast<float>(iFontSize), &affine_matrix1,
m_fontColor, FXTEXT_CLEARTYPE);
@@ -231,22 +206,14 @@ void CBC_OnedUPCAWriter::ShowChars(
tempStr = str.Mid(0, 1);
iLen = tempStr.GetLength();
strWidth = (float)multiple * 7;
- if (!pOutBitmap)
- strWidth = strWidth * m_outputHScale;
+ strWidth = strWidth * m_outputHScale;
CalcTextInfo(tempStr, pCharPos, m_pFont, strWidth, iFontSize, blank);
- if (pOutBitmap) {
- ge.Create((int)strWidth, iTextHeight, FXDIB_Argb, nullptr);
- ge.GetBitmap()->Clear(m_backgroundColor);
- ge.DrawNormalText(iLen, pCharPos, m_pFont, static_cast<float>(iFontSize),
- &affine_matrix, m_fontColor, FXTEXT_CLEARTYPE);
- geBitmap.SetDIBits(ge.GetBitmap(), 0, m_Height - iTextHeight);
- } else {
+ {
CFX_Matrix affine_matrix1(1.0, 0.0, 0.0, -1.0, 0,
(float)(m_Height - iTextHeight + iFontSize));
- if (matrix) {
+ if (matrix)
affine_matrix1.Concat(*matrix);
- }
device->DrawNormalText(iLen, pCharPos, m_pFont,
static_cast<float>(iFontSize), &affine_matrix1,
m_fontColor, FXTEXT_CLEARTYPE);
@@ -254,22 +221,13 @@ void CBC_OnedUPCAWriter::ShowChars(
tempStr = str.Mid(11, 1);
iLen = tempStr.GetLength();
CalcTextInfo(tempStr, pCharPos + 11, m_pFont, strWidth, iFontSize, blank);
- if (pOutBitmap) {
- ge.Create((int)strWidth, iTextHeight, FXDIB_Argb, nullptr);
- ge.GetBitmap()->Clear(m_backgroundColor);
- ge.DrawNormalText(iLen, pCharPos + 11, m_pFont,
- static_cast<float>(iFontSize), &affine_matrix,
- m_fontColor, FXTEXT_CLEARTYPE);
- geBitmap.SetDIBits(ge.GetBitmap(), leftPosition + 85 * multiple,
- m_Height - iTextHeight);
- } else {
+ {
CFX_Matrix affine_matrix1(
1.0, 0.0, 0.0, -1.0,
(float)(leftPosition + 85 * multiple) * m_outputHScale,
(float)(m_Height - iTextHeight + iFontSize));
- if (matrix) {
+ if (matrix)
affine_matrix1.Concat(*matrix);
- }
device->DrawNormalText(iLen, pCharPos + 11, m_pFont,
static_cast<float>(iFontSize), &affine_matrix1,
m_fontColor, FXTEXT_CLEARTYPE);