Commit 9a7fd098 authored by Oleg.Korshul's avatar Oleg.Korshul Committed by Alexander Trofimov

git-svn-id:...

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@54927 954022d7-b5bf-4e40-9824-e11837661b57
parent 1522ea30
#ifndef AGG_SPAN_HATCH_INCLUDED
#define AGG_SPAN_HATCH_INCLUDED
#include <stdlib.h>
#include <string>
#include "agg_math.h"
#include "agg_array.h"
#include "agg_trans_affine.h"
namespace agg
{
#define HATCH_TX_SIZE 8
#define HATCH_TX_COUNT 54
// 8 * 8 * 54
#define HATCH_RESOURCE_SIZE 3456
static const BYTE c_resource_hatches[HATCH_RESOURCE_SIZE] = {
/* cross */
0,0,0,0,0,0,0,0,
0,1,1,1,0,1,1,1,
0,1,1,1,0,1,1,1,
0,1,1,1,0,1,1,1,
0,0,0,0,0,0,0,0,
0,1,1,1,0,1,1,1,
0,1,1,1,0,1,1,1,
0,1,1,1,0,1,1,1,
/* dashDnDiag */
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,
0,1,1,1,0,1,1,1,
1,0,1,1,1,0,1,1,
1,1,0,1,1,1,0,1,
1,1,1,0,1,1,1,0,
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,
/* dashHorz */
0,0,0,0,1,1,1,1,
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,
1,1,1,1,0,0,0,0,
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,
/* dashUpDiag */
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,
1,1,1,0,1,1,1,0,
1,1,0,1,1,1,0,1,
1,0,1,1,1,0,1,1,
0,1,1,1,0,1,1,1,
1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,
/* dashVert */
0,1,1,1,1,1,1,1,
0,1,1,1,1,1,1,1,
0,1,1,1,1,1,1,1,
0,1,1,1,1,1,1,1,
1,1,1,1,0,1,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cross",
L"dashDnDiag",
L"dashHorz",
L"dashUpDiag",
L"dashVert",
L"diagBrick",
L"diagCross",
L"divot",
L"dkDnDiag",
L"dkHorz",
L"dkUpDiag",
L"dkVert",
L"dnDiag",
L"dotDmnd",
L"dotGrid",
L"horz",
L"horzBrick",
L"lgCheck",
L"lgConfetti",
L"lgGrid",
L"ltDnDiag",
L"ltHorz",
L"ltUpDiag",
L"ltVert",
L"narHorz",
L"narVert",
L"openDmnd",
L"pct10",
L"pct20",
L"pct25",
L"pct30",
L"pct40",
L"pct5",
L"pct50",
L"pct60",
L"pct70",
L"pct75",
L"pct80",
L"pct90",
L"plaid",
L"shingle",
L"smCheck",
L"smConfetti",
L"smGrid",
L"solidDmnd",
L"sphere",
L"trellis",
L"upDiag",
L"vert",
L"wave",
L"wdDnDiag",
L"wdUpDiag",
L"weave",
L"zigZag"
};
template<class ColorT>
class agg_span_hatch
{
public:
typedef ColorT color_type;
private:
enum
{
StateInit = 0,
StateReady = 1,
};
private:
int m_state;
agg::trans_affine m_trans;
int m_offset;
color_type m_color1;
color_type m_color2;
public:
agg_span_hatch()
: m_state( StateInit ),
m_offset( 0 ),
{
}
void SetDirection(const std::wstring& name, const agg::trans_affine& trans)
{
m_trans = trans;
for (int i = 0; i < HATCH_TX_COUNT; ++i)
{
if (c_resource_hatches_names[i] == name)
{
m_offset = i * HATCH_TX_SIZE * HATCH_TX_SIZE;
break;
}
}
}
void prepare()
{
if( m_state != StateReady )
{
m_state = StateReady;
memset( m_valid_table, 0, sizeof m_valid_table );
}
}
void generate( color_type* span, int x, int y, unsigned len)
{
for( unsigned count = 0; count < len; ++count, ++x )
{
double _x = x;
double _y = y;
m_trans.transform(&_x, &_y);
// TODO:
}
}
};
}
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment