CommandDrawTextCHAR

so far, just black dots appear at the places of the letters
This commit is contained in:
Kulikova Svetlana
2021-01-26 17:05:36 +03:00
parent cd92c0d30a
commit d9d815fc13
2 changed files with 76 additions and 2 deletions

View File

@ -207,10 +207,12 @@ void CGraphics::reset()
}
void CGraphics::FreeFont()
{
std::cout << "FreeFont " << std::endl;
m_pRenderer->CloseFont();
}
void CGraphics::ClearLastFont()
{
std::cout << "ClearLastFont " << std::endl;
m_pRenderer->ClearInstallFont();
}
void CGraphics::drawImage(const std::wstring& img, double x, double y, double w, double h, BYTE alpha)
@ -221,10 +223,12 @@ void CGraphics::drawImage(const std::wstring& img, double x, double y, double w,
}
std::wstring CGraphics::GetFont()
{
std::cout << "GetFont " << std::endl;
return m_pRenderer->GetFontManager()->GetName();
}
void CGraphics::SetFont(const std::wstring& name, int face, double size, int style)
{
std::wcout << L"SetFont " << name << std::endl;
double DpiX, DpiY;
m_pRenderer->get_DpiX(&DpiX);
m_pRenderer->get_DpiY(&DpiY);
@ -253,10 +257,12 @@ void CGraphics::tg(int text, double x, double y)
}
void CGraphics::SetIntegerGrid(bool param)
{
std::cout << "SetIntegerGrid " << param << std::endl;
m_pRenderer->put_IntegerGrid(param);
}
bool CGraphics::GetIntegerGrid()
{
std::cout << "GetIntegerGrid " << std::endl;
return m_pRenderer->get_IntegerGrid();
}
void CGraphics::DrawStringASCII (const std::wstring& text, double x, double y)
@ -301,6 +307,7 @@ void CGraphics::DrawStringASCII2(const std::wstring& text, double x, double y)
}
void CGraphics::DrawHeaderEdit(double yPos)
{
std::cout << "DrawHeaderEdit " << std::endl;
m_pRenderer->PathCommandEnd();
Aggplus::CMatrix* pFull = m_pRenderer->GetFullTransform();
@ -341,6 +348,7 @@ void CGraphics::DrawHeaderEdit(double yPos)
}
void CGraphics::DrawFooterEdit(double yPos)
{
std::cout << "DrawFooterEdit " << std::endl;
m_pRenderer->PathCommandEnd();
Aggplus::CMatrix* pFull = m_pRenderer->GetFullTransform();
@ -381,6 +389,7 @@ void CGraphics::DrawFooterEdit(double yPos)
}
void CGraphics::DrawLockParagraph (double x, double y1, double y2)
{
std::cout << "DrawLockParagraph " << std::endl;
m_pRenderer->PathCommandEnd();
Aggplus::CMatrix* pFull = m_pRenderer->GetFullTransform();
@ -450,6 +459,7 @@ void CGraphics::DrawLockParagraph (double x, double y1, double y2)
}
void CGraphics::DrawLockObjectRect(double x, double y, double w, double h)
{
std::cout << "DrawLockObjectRect " << std::endl;
m_pRenderer->PathCommandEnd();
double dPenSize = 0.0;
@ -473,6 +483,7 @@ void CGraphics::DrawLockObjectRect(double x, double y, double w, double h)
}
void CGraphics::DrawEmptyTableLine(double x1, double y1, double x2, double y2)
{
std::cout << "DrawEmptyTableLine " << std::endl;
m_pRenderer->PathCommandEnd();
Aggplus::CMatrix* pFull = m_pRenderer->GetFullTransform();
@ -555,6 +566,7 @@ void CGraphics::DrawEmptyTableLine(double x1, double y1, double x2, double y2)
}
void CGraphics::DrawSpellingLine (double y0, double x0, double x1, double w)
{
std::cout << "DrawSpellingLine " << std::endl;
Aggplus::CMatrix* pMatrix = m_pRenderer->GetTransformMatrix();
if (!m_pRenderer->get_IntegerGrid())
{
@ -909,6 +921,7 @@ void CGraphics::RestorePenBrush()
}
void CGraphics::SaveGrState()
{
std::cout << "SaveGrState " << std::endl;
CGrStateState* pState = new CGrStateState();
pState->IsIntegerGrid = m_pRenderer->get_IntegerGrid();
pState->Clips = m_oGrState.Clips;
@ -922,6 +935,7 @@ void CGraphics::SaveGrState()
}
void CGraphics::RestoreGrState()
{
std::cout << "RestoreGrState " << std::endl;
if (m_oGrState.States.empty())
return;
@ -983,10 +997,12 @@ void CGraphics::RestoreGrState()
}
void CGraphics::StartClipPath()
{
std::cout << "StartClipPath " << std::endl;
m_pRenderer->BeginCommand(c_nClipType);
}
void CGraphics::EndClipPath()
{
std::cout << "EndClipPath " << std::endl;
m_pRenderer->EndCommand(c_nClipType);
}
bool CGraphics::StartCheckTableDraw()
@ -1048,6 +1064,7 @@ std::string CGraphics::toDataURL(std::wstring type)
{
size_t nSl = type.find(L'/');
std::wstring sPath = m_sApplicationImagesDirectory + L"/img" + std::to_wstring(nImage++) + L'.' + type.substr(nSl + 1);
std::wcout << "toDataURL " << sPath << std::endl;
m_oFrame.SaveFile(sPath, _CXIMAGE_FORMAT_PNG);
NSFile::CFileBinary oReader;
@ -1088,45 +1105,55 @@ CColor CGraphics::GetBrushColor()
}
void CGraphics::put_brushTexture(std::wstring src)
{
std::wstring strImage = (0 == src.find(L"theme") ? m_sApplicationThemesDirectory : m_sApplicationImagesDirectory) + L'/' + src;
std::wcout << L"put_brushTexture " << strImage << std::endl;
m_pRenderer->put_BrushType(c_BrushTypeTexture);
m_pRenderer->put_BrushTexturePath(strImage);
m_pRenderer->put_BrushTextureMode(0);
}
void CGraphics::put_brushTextureMode(int mode)
{
std::cout << "put_brushTextureMode " << std::endl;
m_pRenderer->put_BrushTextureMode(mode);
}
void CGraphics::put_BrushTextureAlpha(int a)
{
std::cout << "put_BrushTextureAlpha " << std::endl;
m_pRenderer->put_BrushTextureAlpha(a == 0 ? 255 : a);
}
void CGraphics::put_BrushGradient(int* pColors, double* pPositions, size_t nCount)
{
std::cout << "put_BrushGradient " << std::endl;
m_pRenderer->put_BrushGradientColors((LONG *)pColors, pPositions, nCount);
}
double CGraphics::TransformPointX(double x, double y)
{
std::cout << "TransformPointX " << std::endl;
m_pRenderer->GetFullTransform()->TransformPoint(x, y);
return x;
}
double CGraphics::TransformPointY(double x, double y)
{
std::cout << "TransformPointY " << std::endl;
m_pRenderer->GetFullTransform()->TransformPoint(x, y);
return y;
}
void CGraphics::put_LineJoin(int nJoin)
{
std::cout << "put_LineJoin " << std::endl;
m_pRenderer->put_PenLineJoin(nJoin);
}
int CGraphics::GetLineJoin()
{
std::cout << "GetLineJoin " << std::endl;
BYTE nRes;
m_pRenderer->get_PenLineJoin(&nRes);
return nRes;
}
void CGraphics::put_TextureBounds(double x, double y, double w, double h)
{
std::cout << "put_TextureBounds " << std::endl;
if(m_pRenderer->get_IntegerGrid())
{
double r = x + w;
@ -1140,6 +1167,7 @@ void CGraphics::put_TextureBounds(double x, double y, double w, double h)
}
double CGraphics::GetlineWidth()
{
std::cout << "GetlineWidth " << std::endl;
double nRes;
m_pRenderer->get_PenSize(&nRes);
return nRes;

View File

@ -2,9 +2,56 @@
var MyGraphics = new CNativeGraphics();
// Задаём размеры холста
MyGraphics.init(null, 181.151, 172.606, 47, 45);
MyGraphics.init(null, 200, 149, 52.9167, 39.4229);
// Проверка FillTextCode
MyGraphics.CoordTransformOffset(-187.936, -66.5134);
MyGraphics.transform(1, 0, 0, 1, 0, 0);
MyGraphics.SetIntegerGrid(false);
MyGraphics.transform(1, 0, 0, 1, 50.2979, 18.1354);
MyGraphics.p_width(1058.31);
MyGraphics._s();
MyGraphics._m(0, 0);
MyGraphics._l(51.8583, 0);
MyGraphics._l(51.8583, 38.3646);
MyGraphics._l(0, 38.3646);
MyGraphics._z();
MyGraphics.p_color(67, 115, 158, 255);
MyGraphics.b_color1(91, 155, 213, 255);
MyGraphics.drawpath(256 + 1);
MyGraphics._e();
MyGraphics.p_dash(null);
MyGraphics.SetIntegerGrid(false);
MyGraphics.transform(1, 0, 0, 1, 50.2979, 18.1354);
MyGraphics._s();
MyGraphics._m(-1.6, 0.199153);
MyGraphics._l(51.8583, 0.199153);
MyGraphics._l(51.8583, 36.5654);
MyGraphics._l(-1.6, 36.5654);
MyGraphics._l(-1.6, 0.199153);
MyGraphics.SetIntegerGrid(false);
MyGraphics.transform(1, 0, 0, 1, 53.3671, 32.988);
MyGraphics.b_color1(0, 0, 0, 255);
MyGraphics.p_color(0, 0, 0, 255);
MyGraphics.SetFont({FontFamily : {Name : "Arial", Index : -1}, FontSize : 16, Italic : true, Bold : true});
MyGraphics.FillTextCode(12.2943, 3.63992, 72);
MyGraphics.FillTextCode(15.0967, 3.63992, 101);
MyGraphics.FillTextCode(17.2548, 3.63992, 108);
MyGraphics.FillTextCode(18.117, 3.63992, 108);
MyGraphics.FillTextCode(18.9791, 3.63992, 111);
MyGraphics.FillTextCode(22.2153, 3.63992, 87);
MyGraphics.FillTextCode(25.8779, 3.63992, 111);
MyGraphics.FillTextCode(28.0361, 3.63992, 114);
MyGraphics.FillTextCode(29.3283, 3.63992, 108);
MyGraphics.FillTextCode(30.1904, 3.63992, 100);
MyGraphics.FillTextCode(32.3486, 3.63992, 33);
MyGraphics.SetIntegerGrid(true);
MyGraphics.reset();
MyGraphics.toDataURL("image/png");
// Рисование шейпа с треугольником
/*
MyGraphics.SetIntegerGrid(false);
MyGraphics.transform(1, 0, 0, 1, 0, 0);//0.617492, -0.786577, 0.786577, 0.617492, 123.177, 40.1987);
MyGraphics.ArrayPoints = null;
@ -24,7 +71,6 @@ MyGraphics.reset();
MyGraphics.toDataURL("image/png");
// Рисование картинки с помощью brush
/*
MyGraphics.SetIntegerGrid(false);
MyGraphics.transform(1, 0, 0, 1, 0, 0);
MyGraphics.ArrayPoints = null;