void CIMAGE::plot8CircleLines( int aCx, int aCy, int aX, int aY, unsigned char aValue )
{
    Hline( aCx - aX, aCx + aX, aCy + aY, aValue );
    Hline( aCx - aX, aCx + aX, aCy - aY, aValue );
    Hline( aCx - aY, aCx + aY, aCy + aX, aValue );
    Hline( aCx - aY, aCx + aY, aCy - aX, aValue );
}
Exemple #2
0
static void gr_draw_sunken_border( short x1, short y1, short x2, short y2 )
{
	const uint8_t cgrey = CGREY;
	const uint8_t cbright = CBRIGHT;
	Hline(x1-1, x2+1, y1-1, cgrey);
	Vline( y1-1, y2+1, x1-1, cgrey);

	Hline(x1-1, x2+1, y2+1, cbright);
	Vline( y1, y2+1, x2+1, cbright);
}
Exemple #3
0
void ui_draw_shad( short x1, short y1, short x2, short y2, short c1, short c2 )
{
	gr_setcolor( c1 );

	Hline( x1+0, x2-1, y1+0 );
	Vline( y1+1, y2+0, x1+0 );

	gr_setcolor( c2 );
	Hline( x1+1, x2, y2-0 );
	Vline( y1+0, y2-1, x2-0 );
}
Exemple #4
0
static int ligne(lua_State *L)
{
 unsigned short n = lua_gettop(L);
 short int x,y,y1,x1,page,i,xx,dx,dy,err,sx,sy,e2;
 short int coul;
x = (lua_toint(L, 1)-1);
y = (lua_toint(L, 2)-1);
x1 = (lua_toint(L, 3)-1);
y1 = (lua_toint(L, 4)-1);
if(n>=5) {page= lua_toint(L, 5);if(page<0 || page >5) page = 0;}   //peut representer la couleur ou un numero de buffer
else page = 0;
dx = abs(x1-x), sx = x<x1 ? 1 : -1;
dy = abs(y1-y), sy = y<y1 ? 1 : -1;

if ( !NetB ) {
   if (n==6 || dx == 0 || dy == 0) {

      if (x>x1) {xx=x ; x=max(x1 ,0) ;x1= min(xx,127);}
      if (y>y1) {xx=y ; y=max (y1,0) ;y1= min (xx,63);}      // donc y<=y1 et x<=x1

         if (n == 6) {            // rectangle
         coul = lua_toint(L,6);
             for( i=y ; i<=y1 ; i++){
              Hline(x, x1 , i , coul);
             }

               if (page!=coul) {
               Hline(x,x1,y,page);
               Vline(x1,y,y1,page);
               Hline(x,x1,y1,page);
               Vline(x,y,y1,page);
               }
         }
         else if (dy==0) Hline(x,x1,y1,page);
         else Vline(x,y,y1,page);              //dx == 0
      return 0;
      }
}
     err = (dx>dy ? dx : -dy)/2;
     for(;;){
     if ((x == x&0x007F) && (y == y&0x003F)) // si on est dans les plages de l'écran (tester si pas de pb pour les valeurs négatives)
       {
          if(NetB) ML_pixel(x,y,1,VRAM[page]);
          else draw_write_pix(x,y,page);
         }
     if (x==x1 && y==y1) break;
     e2 = err;
     if (e2 >-dx) { err -= dy; x += sx; }
     if (e2 < dy) { err += dx; y += sy; }
     }
 if (NetB && page==0)ML_display_vram(VRAM[0]);
return 0;

}
Exemple #5
0
void CTrack::Highlight(bool bOn, HDC hDC, bool bHash)
{
	if (!m_pAGDC)
		return;

	m_bIsHighlight = bOn;
	m_bHash = bHash;

	if (!hDC)
		hDC = m_pAGDC->GetHDC();

	CPoint pt[4];
	pt[0] = m_Distort.p[0];
	pt[1] = m_Distort.p[1];
	pt[2] = m_Distort.p[2];
	pt[3] = m_Distort.p[3];

	CAGMatrix Matrix = m_Matrix * m_ViewToDeviceMatrix;

	if (!(m_iWhatCanDo & TR_DRAWASLINE))
	{
		CRect Offset(-1, -1, 0, 0);
		Matrix.Inverse().Transform((CPoint*)&Offset, 2, false);

		pt[0].x += Offset.left;
		pt[0].y += Offset.top;
		pt[1].x += Offset.right;
		pt[1].y += Offset.top;
		pt[2].x += Offset.right;
		pt[2].y += Offset.bottom;
		pt[3].x += Offset.left;
		pt[3].y += Offset.bottom;
	}

	Matrix.Transform(pt[0]);
	Matrix.Transform(pt[1]);
	Matrix.Transform(pt[2]);
	Matrix.Transform(pt[3]);

	// Before drawing the transform border, open up the clipping to include a border pixel
	HRGN hClipRegion = m_pAGDC->SaveClipRegion();
	CRect rClipRect = m_PageRect;	
	rClipRect.InflateRect(1, 1); // Add a border pixel
	rClipRect.InflateRect(H_SIZE, H_SIZE); // Add the tracking handle size
	m_pAGDC->SetClipRect(rClipRect);

	Hline(hDC, pt[0].x, pt[0].y, pt[1].x, pt[1].y, m_bHash);
	Hline(hDC, pt[1].x, pt[1].y, pt[2].x, pt[2].y, m_bHash);
	Hline(hDC, pt[2].x, pt[2].y, pt[3].x, pt[3].y, m_bHash);
	Hline(hDC, pt[3].x, pt[3].y, pt[0].x, pt[0].y, m_bHash);

	m_pAGDC->RestoreClipRegion(hClipRegion);
}
Exemple #6
0
void gr_draw_sunken_border( short x1, short y1, short x2, short y2 )
{

	gr_setcolor( CGREY );
	Hline( x1-1, x2+1, y1-1);
	Vline( y1-1, y2+1, x1-1);

	gr_setcolor( CBRIGHT );
	Hline( x1-1, x2+1, y2+1);
	Vline( y1, y2+1, x2+1);

}
Exemple #7
0
void ui_draw_line_in( short x1, short y1, short x2, short y2 )
{
	gr_setcolor( CGREY );
	Hline( x1, x2, y1 );
	Hline( x1, x2-1, y2-1 );
	Vline( y1+1, y2-2, x1 );
	Vline( y1+1, y2-2, x2-1 );

	gr_setcolor( CBRIGHT );
	Hline( x1+1, x2-1, y1+1 );
	Hline( x1, x2, y2 );
	Vline( y1+2, y2-2, x1+1 );
	Vline( y1+1, y2-1, x2 );

}
Exemple #8
0
static int fill (lua_State *L)
{
 unsigned char y; int color;
if(!NetB) {
  color =  lua_toint(L, 1);
  for (y=0;y<64;y++) {
                     Hline(0,127,y,color);
                     }

 }
 return 0;
}
void Xbar(int x,int y,int lx,int ly,char c){
	Hline(x,y,x+lx-1,c);
	Hline(x,y+ly-1,x+lx-1,c);
	Vline(x,y,y+ly-1,c);
	Vline(x+lx-1,y,y+ly-1,c);
};
Exemple #10
0
void CTrack::Draw(bool bOn, HDC hDC)
{
	if (!m_pAGDC)
		return;

	m_bIsDrawn = bOn;

	if (!hDC)
		hDC = m_pAGDC->GetHDC();

	POINT pt[4];
	pt[0] = m_Distort.p[0];
	pt[1] = m_Distort.p[1];
	pt[2] = m_Distort.p[2];
	pt[3] = m_Distort.p[3];

	CAGMatrix Matrix = m_Matrix * m_ViewToDeviceMatrix;

	// A trick to draw the selection rectangle outside of a transformed object
	if (!(m_iWhatCanDo & TR_DRAWASLINE))
	{
		RECT Offset = {-1, -1, 0, 0};
		Matrix.Inverse().Transform((POINT*)&Offset, 2, false);

		pt[0].x += Offset.left;
		pt[0].y += Offset.top;
		pt[1].x += Offset.right;
		pt[1].y += Offset.top;
		pt[2].x += Offset.right;
		pt[2].y += Offset.bottom;
		pt[3].x += Offset.left;
		pt[3].y += Offset.bottom;
	}

	Matrix.Transform(pt[0]);
	Matrix.Transform(pt[1]);
	Matrix.Transform(pt[2]);
	Matrix.Transform(pt[3]);

	// Before drawing the transform border, open up the clipping to include a border pixel
	HRGN hClipRegion = m_pAGDC->SaveClipRegion();
	RECT rClipRect = m_PageRect;	
	::InflateRect(&rClipRect, 1, 1); // Add a border pixel
	m_pAGDC->SetClipRect(rClipRect, false/*bIncludeRawDC*/);

	if (m_iWhatCanDo & TR_DRAWASLINE)
	{
		Dline(hDC, pt[0].x, pt[0].y, pt[2].x, pt[2].y, bOn);
	}
	else
	{
		Hline(hDC, pt[0].x, pt[0].y, pt[1].x, pt[1].y, bOn);
		Hline(hDC, pt[1].x, pt[1].y, pt[2].x, pt[2].y, bOn);
		Hline(hDC, pt[2].x, pt[2].y, pt[3].x, pt[3].y, bOn);
		Hline(hDC, pt[3].x, pt[3].y, pt[0].x, pt[0].y, bOn);
	}

	DrawHandles(hDC, bOn, pt);

	m_pAGDC->RestoreClipRegion(hClipRegion);
}