Ejemplo n.º 1
0
void
_WinDrawPixel(Coord x, Coord y)
{
	if (hires)
		HRWinDrawPixel(hires, x, y);
	else
		WinDrawPixel(x, y);
}
Ejemplo n.º 2
0
/*****************************************************************************
* Function: GadgetDrawTimeline
*
* Description: Draws a line for the current time
*****************************************************************************/
void
GadgetDrawTimeline(GadgetTimelineDrawType drawType)
{
  DateTimeType dt;
  TimeType now;

  TimSecondsToDateTime(TimGetSeconds(), &dt);

  if (drawType == gtDraw) {
    now.hours=dt.hour;
    now.minutes=dt.minute;
    gGadgetLastTimeline.hours=now.hours;
    gGadgetLastTimeline.minutes=now.minutes;
    GadgetDrawWeekdays();
  } else {
    now.hours=gGadgetLastTimeline.hours;
    now.minutes=gGadgetLastTimeline.minutes;
  }

  if ( ((gGadgetCurScreen == GADGET_SCREEN_DAY) && (now.hours >= 8) && (now.hours < 20)) ||
       ((gGadgetCurScreen == GADGET_SCREEN_NIGHT) && ((now.hours < 8) || (now.hours >= 20))) ) {

    UInt8 y, gadgetWidth;
    UInt16 gadgetIndex;
    FormType *frm;
    RectangleType bounds;
    RGBColorType red={0x00, 0xFF, 0x00, 0x00}, old;

    y = GadgetCalcTimeTop(now);

    frm = FrmGetActiveForm();
    gadgetIndex = FrmGetObjectIndex(frm, gGadgetID);
    FrmGetObjectBounds(frm, gadgetIndex, &bounds);
    gadgetWidth=gGadgetDaysNum * gGadgetDaysWidth + gGadgetDaysNum - 1;

    WinInvertLine(bounds.topLeft.x+GADGET_BASELEFT+GADGET_LEFT, bounds.topLeft.y+GADGET_TOP+y,
                  bounds.topLeft.x+GADGET_BASELEFT+GADGET_LEFT+gadgetWidth-1, bounds.topLeft.y+GADGET_TOP+y);

    if (drawType == gtDraw) {
      TNSetForeColorRGB(&red, &old);
      WinDrawPixel(bounds.topLeft.x+GADGET_BASELEFT+GADGET_LEFT+gGadgetDaysNum*gGadgetDaysWidth+gGadgetDaysNum+1, bounds.topLeft.y+GADGET_TOP+y);
      WinDrawLine(bounds.topLeft.x+GADGET_BASELEFT+GADGET_LEFT+gGadgetDaysNum*gGadgetDaysWidth+gGadgetDaysNum+2, bounds.topLeft.y+GADGET_TOP+y-1,
                  bounds.topLeft.x+GADGET_BASELEFT+GADGET_LEFT+gGadgetDaysNum*gGadgetDaysWidth+gGadgetDaysNum+2, bounds.topLeft.y+GADGET_TOP+y+1);
      WinDrawLine(bounds.topLeft.x+GADGET_BASELEFT+GADGET_LEFT+gGadgetDaysNum*gGadgetDaysWidth+gGadgetDaysNum+3, bounds.topLeft.y+GADGET_TOP+y-2,
                  bounds.topLeft.x+GADGET_BASELEFT+GADGET_LEFT+gGadgetDaysNum*gGadgetDaysWidth+gGadgetDaysNum+3, bounds.topLeft.y+GADGET_TOP+y+2);
      TNSetForeColorRGB(&old, NULL);
    } else if (drawType == gtErase) {
      RectangleType rect;
      RctSetRectangle(&rect,
                      bounds.topLeft.x+GADGET_BASELEFT+GADGET_LEFT+gGadgetDaysNum*gGadgetDaysWidth+gGadgetDaysNum+1, bounds.topLeft.y+GADGET_TOP+y-2,
                      bounds.topLeft.x+GADGET_BASELEFT+GADGET_LEFT+gGadgetDaysNum*gGadgetDaysWidth+gGadgetDaysNum+3, bounds.topLeft.y+GADGET_TOP+y+2);
      WinEraseRectangle(&rect, 0);
    }
  }
}
Ejemplo n.º 3
0
void drawFern(int n) // n = steps
// ifs pretty and test floating point numbers
{
   int i;
   int ix,iy;
   double x,y,dx,dy,dxborder,dyborder;
   static double xmin=1e32,xmax=-1e32,ymin=1e32,ymax=-1e32,scale,xmid,ymid;
   double xmaxy=0, xminy=0, ymaxx=0, yminx=0; 

//void WinPaintPixel (Coord x, Coord y) Coord = Int16
//void WinDrawPixel (Coord x, Coord y)
// MIN -> min, rand() -> SysRandom(0) 
//Int16         SysRandom(Int32 newSeed)

   if (xmin == 1e32) {
      for (i=0;i<200;i++) {
         nextIFS(&x,&y);
 
         if (x < xmin) { xmin = x; xminy = y; }
         if (y < ymin) { ymin = y; yminx = x; }
         if (x > xmax) { xmax = x; xmaxy = y; }
         if (y > ymax) { ymax = y; ymaxx = x; }
      }

      dx = xmax - xmin; dxborder = dx*0.1; xmin-=dxborder; xmax+=dxborder;
      dy = ymax - ymin; dyborder = dy*0.2; ymin-=dyborder; ymax+=dyborder;

      scale = min( NX/dx, NY/dy );
      xmid = (xmin + xmax) / 2;
      ymid = (ymin + ymax) / 2;
   }

   for (i=0;i<n;i++) {
      nextIFS(&x,&y);

      ix = NX / 2 + (x - xmid) * scale;
      iy = NY / 2 + (ymid - y) * scale;
      WinDrawPixel(ix,iy);
   }

   debugDumpFern(scale, 
      xmin, xmax, dx, xmid,
      ymin, ymax, dy, ymid,
      xminy, xmaxy, yminx, ymaxx );

}
Ejemplo n.º 4
0
void drawSierpenski(int n)
{
   int x=0;
   int y=0;
   int tx[3],ty[3];
   int i,r;

   tx[1]=3;ty[1]=3; //init apex
   tx[2]=3;ty[2]=NY-3;
   tx[0]=NX-3;ty[0]=NY-3;

   x=tx[1]; y=ty[1];
   for(i=0;i<n;i++){
      WinDrawPixel(x,y);
      r=SysRandom(0) % 3;
      x=x+(tx[r]-x)/2;  // midpoint
      y=y+(ty[r]-y)/2;
   }
 }
Ejemplo n.º 5
0
static void
TableDrawSelection(void *table, Int16 row, Int16 column, RectangleType *bounds)
{
  RGBColorType red={0x00, 0xFF, 0x00, 0x00};
  RectangleType r;

  RctSetRectangle(&r, bounds->topLeft.x, bounds->topLeft.y+(bounds->extent.y/2)-3, 4, 7);

  if (gExamsSelRow == row) {
    TNSetForeColorRGB(&red, NULL);
    // WinDrawRectangle(&r,0);    
    WinDrawPixel(r.topLeft.x, r.topLeft.y+3);
    WinDrawLine(r.topLeft.x+1, r.topLeft.y+2, r.topLeft.x+1, r.topLeft.y+4);
    WinDrawLine(r.topLeft.x+2, r.topLeft.y+1, r.topLeft.x+2, r.topLeft.y+5);
    WinDrawLine(r.topLeft.x+3, r.topLeft.y, r.topLeft.x+3, r.topLeft.y+6);
  } else {
    WinEraseRectangle(&r, 0);    
  }

}