KiCad PCB EDA Suite
test_gal_pixel_alignment.cpp File Reference

Go to the source code of this file.

Classes

class  MY_DRAWING
 
class  MY_PCB_TEST_FRAME
 

Functions

const VECTOR2D xform2 (const MATRIX3x3D &minv, const VECTOR2D &p)
 
void screenSpaceLine (KIGFX::GAL *gal, const VECTOR2D &p0, const VECTOR2D &p1, double w)
 
void screenSpaceCircle (KIGFX::GAL *gal, const VECTOR2D &p0, double r, double w)
 
wxFrame * CreateMainFrame (const std::string &aFileName)
 

Function Documentation

◆ CreateMainFrame()

wxFrame* CreateMainFrame ( const std::string &  aFileName)

Definition at line 213 of file test_gal_pixel_alignment.cpp.

214 {
215  auto frame = new MY_PCB_TEST_FRAME( nullptr, wxT( "Test PCB Frame" ) );
216 
217  if( aFileName != "" )
218  {
219  frame->LoadAndDisplayBoard( aFileName );
220  }
221 
222  return frame;
223 }

Referenced by GAL_TEST_APP::OnInit().

◆ screenSpaceCircle()

void screenSpaceCircle ( KIGFX::GAL gal,
const VECTOR2D p0,
double  r,
double  w 
)

Definition at line 46 of file test_gal_pixel_alignment.cpp.

47 {
48  auto minv = gal->GetScreenWorldMatrix();
49 
50  auto pa = xform2 ( minv, p0 );
51 
52  gal->SetLineWidth( w * minv.GetScale().x );
53  gal->DrawCircle( pa, r * minv.GetScale().x );
54 
55 }
const MATRIX3x3D & GetScreenWorldMatrix() const
Get the screen <-> world transformation matrix.
const VECTOR2D xform2(const MATRIX3x3D &minv, const VECTOR2D &p)
virtual void SetLineWidth(float aLineWidth)
Set the line width.
virtual void DrawCircle(const VECTOR2D &aCenterPoint, double aRadius)
Draw a circle using world coordinates.

References KIGFX::GAL::DrawCircle(), KIGFX::GAL::GetScreenWorldMatrix(), KIGFX::GAL::SetLineWidth(), and xform2().

◆ screenSpaceLine()

void screenSpaceLine ( KIGFX::GAL gal,
const VECTOR2D p0,
const VECTOR2D p1,
double  w 
)

Definition at line 17 of file test_gal_pixel_alignment.cpp.

18 {
19  auto minv = gal->GetScreenWorldMatrix();
20 
21  auto pa = xform2 ( minv, p0 );
22  auto pb = xform2 ( minv, p1 );
23 
24 #if 0
25  //shader->Deactivate();
26 
27  currentManager->Reserve( 6 );
28  currentManager->Shader( SHADER_NONE );
29  currentManager->Color( strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a );
30 
31  currentManager->Shader( SHADER_NONE ); currentManager->Vertex( pa.x, pa.y, layerDepth );
32  currentManager->Shader( SHADER_NONE ); currentManager->Vertex( pb.x, pb.y, layerDepth );
33  currentManager->Shader( SHADER_NONE ); currentManager->Vertex( pc.x, pc.y, layerDepth );
34  currentManager->Shader( SHADER_NONE ); currentManager->Vertex( pa.x, pa.y, layerDepth );
35  currentManager->Shader( SHADER_NONE ); currentManager->Vertex( pc.x, pc.y, layerDepth );
36  currentManager->Shader( SHADER_NONE ); currentManager->Vertex( pd.x, pd.y, layerDepth );
37  shader->Use();
38 #endif
39 
40  gal->SetLineWidth( w * minv.GetScale().x );
41  gal->DrawLine( pa, pb );
42 
43 
44 }
const MATRIX3x3D & GetScreenWorldMatrix() const
Get the screen <-> world transformation matrix.
const VECTOR2D xform2(const MATRIX3x3D &minv, const VECTOR2D &p)
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
virtual void SetLineWidth(float aLineWidth)
Set the line width.

References KIGFX::GAL::DrawLine(), KIGFX::GAL::GetScreenWorldMatrix(), KIGFX::GAL::SetLineWidth(), KIGFX::SHADER_NONE, and xform2().

Referenced by MY_DRAWING::ViewDraw().

◆ xform2()

const VECTOR2D xform2 ( const MATRIX3x3D minv,
const VECTOR2D p 
)

Definition at line 11 of file test_gal_pixel_alignment.cpp.

12 {
13  auto t = minv * p;
14  return VECTOR2D((float)t.x, (float)t.y);
15 }
VECTOR2< double > VECTOR2D
Definition: vector2d.h:593

Referenced by screenSpaceCircle(), and screenSpaceLine().