Fixed SWIM line drawing functions

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Fixed SWIM line drawing functions

3,161 Views
lpcware
NXP Employee
NXP Employee

Content originally posted in LPCWare by wellsk on Fri Jun 17 14:11:34 MST 2011
The SWIM line drawing functions have several issues related to window boundaries and orientation. This fix provided by user (Dave) fixes those issues and improves drawing speed for logical and raw line functions. The file is attached to this forum post.

 

The original thread with more information about the issue can be found here: http://tech.groups.yahoo.com/group/lpc2000/message/53739

 

Note: The individual file has been removed, as the zip file with all the updates is now available.

Original Attachment has been moved to: nxpswim_06232011.zip

Labels (1)
0 Kudos
Reply
10 Replies

2,722 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by qwideman on Wed Feb 20 09:04:37 MST 2013
Thanks, I'll try that.
0 Kudos
Reply

2,722 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Fri Feb 15 16:42:18 MST 2013
Hi qwideman,
If you want to use emWin, you can refer to emWin BSP for this board at
http://www.lpcware.com/content/nxpfile/nxpemwin514mcb1700bsp

---------
Thanks,
NXP Support
0 Kudos
Reply

2,722 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by qwideman on Fri Feb 15 15:25:54 MST 2013
I am using an MCB1700 board with the LPC1768 processor.

I would like to use SWIM (or emWin) to run the display.
My question is in reply to Dave's code, which he posted above. I must be missing my board setup files, I don't know.
(Obviously I didn't set them up yet, if there are any.)

Is there clear documentation somewhere for setting up SWIM?

Thank you for your time,
Quinton
0 Kudos
Reply

2,722 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wellsk on Fri Feb 15 15:09:00 MST 2013
>I can't run that code, i get "error: 'LCD_DISPLAY' undeclared (first use in this function)
This is in regards to one of the SWIM examples in the LPCOpen platform?
LCD_DISPLAY is a definition that's part of the board files that designates the setup parameters for a specific LCD. What this defines may vary per board. From what I remember, this is currently only setup to use with the Keil MCB1800/4300 boards right now.

If you still have the error, can you please let us know the failing project and selected board?
0 Kudos
Reply

2,722 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by qwideman on Fri Feb 15 14:58:59 MST 2013
Yes, I'm a newbie, but where do you declare LCD_DISPLAY ?
I can't run that code, i get "error: 'LCD_DISPLAY' undeclared (first use in this function)"

0 Kudos
Reply

2,722 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Dave on Mon Jul 25 10:28:17 MST 2011
Here's an example using the SWIM functions on the FDI dev. kit for the 1788 (640x480x16bit) - it has a couple extra functions that aren't included in SWIM, but you can get a feeling for the performance - each screen draws 1000 of whatever is being drawn ( random lines, random empty boxes, random filled boxes, random empty circles, random filled circles )...

http://www.youtube.com/watch?v=6qVHKriVS5g



0 Kudos
Reply

2,722 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by wellsk on Wed Jul 20 08:59:52 MST 2011
Nice - thanks for posting this. I'll give it a try and post and snapshot the next time I try SWIM.
I've linked the SWIM project example page over to this post for those that are interested.
0 Kudos
Reply

2,722 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Dave on Tue Jul 19 12:01:53 MST 2011
Nice to see...
0 Kudos
Reply

2,722 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Dave on Tue Jul 19 11:58:09 MST 2011
Here's another function to play with in SWIM.

random circles...

Have fun...

-Dave

<code>
/***********************************************************************************************
**                                                                                             
**                                                                                             
***********************************************************************************************/
void plot4points( SWIM_WINDOW_T *win, INT_32 cx, INT_32 cy, INT_32 x, INT_32 y, INT_32 Filled )
   {
   INT_16 x0, x1, y0, y1;

   y0 = cy + y;
   y1 = cy - y;
   if( Filled )
      {
      for( x0=cx - x; x0<=cx + x; x0++ )
         {
         *(win->fb + x0 + (y0 * win->xpsize)) = win->pen;
         *(win->fb + x0 + (y1 * win->xpsize)) = win->pen;
         }
      }
   else
      {
      x0 = cx + x;
      x1 = cx - x;
      *(win->fb + x0 + (y0 * win->xpsize)) = win->pen;
      if (x != 0)
         *(win->fb + x1 + (y0 * win->xpsize)) = win->pen;
      if (y != 0)
         *(win->fb + x0 + (y1 * win->xpsize)) = win->pen;
      if (x != 0 && y != 0)
         *(win->fb + x1 + (y1 * win->xpsize)) = win->pen;
      }
   }

/***********************************************************************************************
**                                                                                             
**                                                                                             
***********************************************************************************************/
void plot8points( SWIM_WINDOW_T *win, INT_32 cx, INT_32 cy, INT_32 x, INT_32 y, INT_32 Filled )
   {
   plot4points( win, cx, cy, x, y, Filled );
   if (x != y)
      plot4points( win, cx, cy, y, x, Filled );
   }
  
/***********************************************************************************************
**                                                                                             
**                                                                                             
***********************************************************************************************/
void swim_put_circle( SWIM_WINDOW_T *win, INT_32 cx, INT_32 cy, INT_32 radius, INT_32 Filled )
   {
   INT_32 Error = -radius;
   INT_16 x = radius;
   INT_16 y = 0;
  
   while( x >= y )
      {
      plot8points( win, cx, cy, x, y, Filled );
     
      Error += y;
      ++y;
      Error += y;

      if( Error >= 0 )
         {
         --x;
         Error -= x;
         Error -= x;
         }
      }
   }

/***********************************************************************************************
**                                                                                             
**                                                                                             
***********************************************************************************************/
void lcd_randomcircles( void )
   {
   SWIM_WINDOW_T win1;
   INT_32 WinWidth, WinHeight;
   COLOR_T *fblog;
   INT_32 RADIUS;

   /* Set LCD frame buffer address */
   fblog = (COLOR_T *)SDRAM_BASE_ADDR;

   /* Create a SWIM window */
   swim_window_open(&win1, LCD_DISPLAY->iHorizontalPixelsPerLine,
      LCD_DISPLAY->iVerticalLinesPerPanel, fblog, 0, 0,
      (LCD_DISPLAY->iHorizontalPixelsPerLine - 1),
      (LCD_DISPLAY->iVerticalLinesPerPanel - 1),1, WHITE, BLACK, BLACK);
  
   WinWidth = win1.xpsize;
   WinHeight = win1.ypsize;
   while( 1 )
      {
      RADIUS = rand()%50 + 15;
      swim_set_pen_color(&win1, (COLOR_T)(rand()%NUM_COLORS));
      swim_put_circle( &win1, rand()%(WinWidth-RADIUS*2)+RADIUS, rand()%(WinHeight-RADIUS*2)+RADIUS, RADIUS, 1);
      }
  
   }
</code>

0 Kudos
Reply

2,722 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcadmin on Thu Jun 23 13:49:35 MST 2011
The 06232011 update includes the changes and fixes for the line draw functions and clipping fixes for the diamond draw functions.
0 Kudos
Reply