<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>LPC FAQsのトピックWhy are all my colors wrong in SWIM?</title>
    <link>https://community.nxp.com/t5/LPC-FAQs/Why-are-all-my-colors-wrong-in-SWIM/m-p/463451#M36</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="color: #646464; font-family: Arial, sans-serif; font-size: 12px;"&gt;The SWM graphics library supports varying color depths but can only be staically compiled for one color depth that must be defined before SWIM is compiled. SWIM supoprts any frame buffer that has 8-bit, 16-bit, or 32-bit addressable pixel color data. Packed pixel formats such as 2 pixels/byte (16 colors/pixel) are not supported.&lt;BR /&gt; &lt;BR /&gt;Before compiling SWIM, several defines need to be setup in the lpc_colors.h file. These defines specify the size of the basic pixel in bits/bytes, maximum number of colors, red/green/blue color masks, and pre-defined color defines for basic colors. Pre-defined values for color depths of 256 colors (8-bits stored in a byte), 4096 colors (12-bits stored in a half-word), 32768 colors (15-bits stored in a half-word), and 65536 colors (16-bits stored in a half-word) are already defined. You can pick one of these pre-defined color configurations by setting the COLORS_DEF definition in the lpc_colors.h file to the number of color bits - either 8, 12, 15, or 16. Optionally, you can setup the define in your compiler arguments and avoid changing the lpc_colors.h file.&lt;BR /&gt; &lt;BR /&gt;#ifndef COLORS_DEF&lt;BR /&gt;#define COLORS_DEF 16 /* 16-bit 565 color mode */&lt;BR /&gt;//#define COLORS_DEF 15 /* 15-bit 555 color mode */&lt;BR /&gt;//#define COLORS_DEF 12 /* 12-bit 444 color mode */&lt;BR /&gt;//#define COLORS_DEF 8 /* 8-bit color mode */&lt;BR /&gt;#endif&lt;/P&gt;&lt;P style="color: #646464; font-family: Arial, sans-serif; font-size: 12px;"&gt;If you are using one of the pre-defined color depths, the definitions for BLACK, WHITE, RED, GREEN will be selected for you. This also applies to the color masks and number of colors.&lt;BR /&gt; &lt;/P&gt;&lt;P style="color: #646464; font-family: Arial, sans-serif; font-size: 12px;"&gt;/* Black color, 565 mode */&lt;BR /&gt;#define BLACK&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x0000&lt;BR /&gt;/* Light gray color, 565 mode */&lt;BR /&gt;#define LIGHTGRAY&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0X7BEF&lt;BR /&gt;/* Dark gray color, 565 mode */&lt;BR /&gt;#define DARKGRAY&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x39E7&lt;BR /&gt;/* White color, 565 mode */&lt;BR /&gt;#define WHITE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x7fff&lt;BR /&gt;...&lt;BR /&gt;...&lt;BR /&gt;/* Red color mask, 565 mode */&lt;BR /&gt;#define REDMASK&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xF800&lt;BR /&gt;/* Red shift value, 565 mode */&lt;BR /&gt;#define REDSHIFT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11&lt;BR /&gt;/* Green color mask, 565 mode */&lt;BR /&gt;#define GREENMASK&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x07E0&lt;BR /&gt;/* Green shift value, 565 mode */&lt;BR /&gt;#define GREENSHIFT&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&lt;BR /&gt;/* Blue color mask, 565 mode */&lt;BR /&gt;#define BLUEMASK&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x001F&lt;BR /&gt;/* Blue shift value, 565 mode */&lt;BR /&gt;#define BLUESHIFT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;BR /&gt;/* Number of colors in 565 mode */&lt;BR /&gt;#define NUM_COLORS&amp;nbsp;&amp;nbsp;&amp;nbsp; 65536&lt;BR /&gt;/* Number of red colors in 565 mode */&lt;BR /&gt;#define RED_COLORS&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x20&lt;BR /&gt;/* Number of green colors in 565 mode */&lt;BR /&gt;#define GREEN_COLORS&amp;nbsp; 0x40&lt;BR /&gt;/* Number of blue colors in 565 mode */&lt;BR /&gt;#define BLUE_COLORS&amp;nbsp;&amp;nbsp; 0x20&lt;/P&gt;&lt;P style="color: #646464; font-family: Arial, sans-serif; font-size: 12px;"&gt; &lt;BR /&gt;If you need to customize your colors or want to use a custom color palette, you will need to add your own values or change the existing values. For 32-bit colors stored as a single 32-bit word in memory in ARGB888 format, data is stored for a pixel as 8-bits of Alpha data in the high 8-bits of the word, red data in the next 8-bits, green data in the next 8-bits, and blue data in the lower 8-bits. For this to work, I might change my entries to appear as below. (Not all possible colors or choices are shown).&lt;BR /&gt; &lt;/P&gt;&lt;P style="color: #646464; font-family: Arial, sans-serif; font-size: 12px;"&gt;#define COLORS_DEF 24&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* 32-bit 888 color mode */&lt;BR /&gt;/* White color, 888 mode */&lt;BR /&gt;#define WHITE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xFFFFFF&lt;BR /&gt;/* Red color, 888 mode */&lt;BR /&gt;#define RED&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xFF0000&lt;BR /&gt;/* Green color, 888 mode */&lt;BR /&gt;#define GREEN&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x00FF00&lt;BR /&gt;/* Blue color, 888 mode */&lt;BR /&gt;#define BLUE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x0000FF&lt;BR /&gt;...&lt;BR /&gt;...&lt;BR /&gt;/* Red color mask, 888 mode */&lt;BR /&gt;#define REDMASK&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xFF0000&lt;BR /&gt;/* Red shift value, 888 mode */&lt;BR /&gt;#define REDSHIFT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 16&lt;BR /&gt;/* Green color mask, 888 mode */&lt;BR /&gt;#define GREENMASK&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x00FF00&lt;BR /&gt;/* Green shift value, 888 mode */&lt;BR /&gt;#define GREENSHIFT&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&lt;BR /&gt;/* Blue color mask, 888 mode */&lt;BR /&gt;#define BLUEMASK&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x0000FF&lt;BR /&gt;/* Blue shift value, 888 mode */&lt;BR /&gt;#define BLUESHIFT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;BR /&gt;/* Number of colors in 888 mode */&lt;BR /&gt;#define NUM_COLORS&amp;nbsp;&amp;nbsp;&amp;nbsp; 16777216&lt;BR /&gt;/* Number of red colors in 888 mode */&lt;BR /&gt;#define RED_COLORS&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x100&lt;BR /&gt;/* Number of green colors in 888 mode */&lt;BR /&gt;#define GREEN_COLORS&amp;nbsp; 0x100&lt;BR /&gt;/* Number of blue colors in 888 mode */&lt;BR /&gt;#define BLUE_COLORS&amp;nbsp;&amp;nbsp; 0x100&lt;/P&gt;&lt;P style="color: #646464; font-family: Arial, sans-serif; font-size: 12px;"&gt; &lt;BR /&gt;The last thing that needs to be done is to define the basic color type used for storing pixel data. This type must match the size of the pixel data. For 32-bit pixel data, this would be a 32-bit word.&lt;BR /&gt; &lt;BR /&gt;/* Color type is a 32-bit value */&lt;BR /&gt;typedef UNS_32 COLOR_T;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 31 Mar 2016 01:06:59 GMT</pubDate>
    <dc:creator>lpcware-support</dc:creator>
    <dc:date>2016-03-31T01:06:59Z</dc:date>
    <item>
      <title>Why are all my colors wrong in SWIM?</title>
      <link>https://community.nxp.com/t5/LPC-FAQs/Why-are-all-my-colors-wrong-in-SWIM/m-p/463451#M36</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="color: #646464; font-family: Arial, sans-serif; font-size: 12px;"&gt;The SWM graphics library supports varying color depths but can only be staically compiled for one color depth that must be defined before SWIM is compiled. SWIM supoprts any frame buffer that has 8-bit, 16-bit, or 32-bit addressable pixel color data. Packed pixel formats such as 2 pixels/byte (16 colors/pixel) are not supported.&lt;BR /&gt; &lt;BR /&gt;Before compiling SWIM, several defines need to be setup in the lpc_colors.h file. These defines specify the size of the basic pixel in bits/bytes, maximum number of colors, red/green/blue color masks, and pre-defined color defines for basic colors. Pre-defined values for color depths of 256 colors (8-bits stored in a byte), 4096 colors (12-bits stored in a half-word), 32768 colors (15-bits stored in a half-word), and 65536 colors (16-bits stored in a half-word) are already defined. You can pick one of these pre-defined color configurations by setting the COLORS_DEF definition in the lpc_colors.h file to the number of color bits - either 8, 12, 15, or 16. Optionally, you can setup the define in your compiler arguments and avoid changing the lpc_colors.h file.&lt;BR /&gt; &lt;BR /&gt;#ifndef COLORS_DEF&lt;BR /&gt;#define COLORS_DEF 16 /* 16-bit 565 color mode */&lt;BR /&gt;//#define COLORS_DEF 15 /* 15-bit 555 color mode */&lt;BR /&gt;//#define COLORS_DEF 12 /* 12-bit 444 color mode */&lt;BR /&gt;//#define COLORS_DEF 8 /* 8-bit color mode */&lt;BR /&gt;#endif&lt;/P&gt;&lt;P style="color: #646464; font-family: Arial, sans-serif; font-size: 12px;"&gt;If you are using one of the pre-defined color depths, the definitions for BLACK, WHITE, RED, GREEN will be selected for you. This also applies to the color masks and number of colors.&lt;BR /&gt; &lt;/P&gt;&lt;P style="color: #646464; font-family: Arial, sans-serif; font-size: 12px;"&gt;/* Black color, 565 mode */&lt;BR /&gt;#define BLACK&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x0000&lt;BR /&gt;/* Light gray color, 565 mode */&lt;BR /&gt;#define LIGHTGRAY&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0X7BEF&lt;BR /&gt;/* Dark gray color, 565 mode */&lt;BR /&gt;#define DARKGRAY&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x39E7&lt;BR /&gt;/* White color, 565 mode */&lt;BR /&gt;#define WHITE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x7fff&lt;BR /&gt;...&lt;BR /&gt;...&lt;BR /&gt;/* Red color mask, 565 mode */&lt;BR /&gt;#define REDMASK&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xF800&lt;BR /&gt;/* Red shift value, 565 mode */&lt;BR /&gt;#define REDSHIFT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 11&lt;BR /&gt;/* Green color mask, 565 mode */&lt;BR /&gt;#define GREENMASK&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x07E0&lt;BR /&gt;/* Green shift value, 565 mode */&lt;BR /&gt;#define GREENSHIFT&amp;nbsp;&amp;nbsp;&amp;nbsp; 5&lt;BR /&gt;/* Blue color mask, 565 mode */&lt;BR /&gt;#define BLUEMASK&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x001F&lt;BR /&gt;/* Blue shift value, 565 mode */&lt;BR /&gt;#define BLUESHIFT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;BR /&gt;/* Number of colors in 565 mode */&lt;BR /&gt;#define NUM_COLORS&amp;nbsp;&amp;nbsp;&amp;nbsp; 65536&lt;BR /&gt;/* Number of red colors in 565 mode */&lt;BR /&gt;#define RED_COLORS&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x20&lt;BR /&gt;/* Number of green colors in 565 mode */&lt;BR /&gt;#define GREEN_COLORS&amp;nbsp; 0x40&lt;BR /&gt;/* Number of blue colors in 565 mode */&lt;BR /&gt;#define BLUE_COLORS&amp;nbsp;&amp;nbsp; 0x20&lt;/P&gt;&lt;P style="color: #646464; font-family: Arial, sans-serif; font-size: 12px;"&gt; &lt;BR /&gt;If you need to customize your colors or want to use a custom color palette, you will need to add your own values or change the existing values. For 32-bit colors stored as a single 32-bit word in memory in ARGB888 format, data is stored for a pixel as 8-bits of Alpha data in the high 8-bits of the word, red data in the next 8-bits, green data in the next 8-bits, and blue data in the lower 8-bits. For this to work, I might change my entries to appear as below. (Not all possible colors or choices are shown).&lt;BR /&gt; &lt;/P&gt;&lt;P style="color: #646464; font-family: Arial, sans-serif; font-size: 12px;"&gt;#define COLORS_DEF 24&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* 32-bit 888 color mode */&lt;BR /&gt;/* White color, 888 mode */&lt;BR /&gt;#define WHITE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xFFFFFF&lt;BR /&gt;/* Red color, 888 mode */&lt;BR /&gt;#define RED&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xFF0000&lt;BR /&gt;/* Green color, 888 mode */&lt;BR /&gt;#define GREEN&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x00FF00&lt;BR /&gt;/* Blue color, 888 mode */&lt;BR /&gt;#define BLUE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x0000FF&lt;BR /&gt;...&lt;BR /&gt;...&lt;BR /&gt;/* Red color mask, 888 mode */&lt;BR /&gt;#define REDMASK&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xFF0000&lt;BR /&gt;/* Red shift value, 888 mode */&lt;BR /&gt;#define REDSHIFT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 16&lt;BR /&gt;/* Green color mask, 888 mode */&lt;BR /&gt;#define GREENMASK&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x00FF00&lt;BR /&gt;/* Green shift value, 888 mode */&lt;BR /&gt;#define GREENSHIFT&amp;nbsp;&amp;nbsp;&amp;nbsp; 8&lt;BR /&gt;/* Blue color mask, 888 mode */&lt;BR /&gt;#define BLUEMASK&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x0000FF&lt;BR /&gt;/* Blue shift value, 888 mode */&lt;BR /&gt;#define BLUESHIFT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0&lt;BR /&gt;/* Number of colors in 888 mode */&lt;BR /&gt;#define NUM_COLORS&amp;nbsp;&amp;nbsp;&amp;nbsp; 16777216&lt;BR /&gt;/* Number of red colors in 888 mode */&lt;BR /&gt;#define RED_COLORS&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x100&lt;BR /&gt;/* Number of green colors in 888 mode */&lt;BR /&gt;#define GREEN_COLORS&amp;nbsp; 0x100&lt;BR /&gt;/* Number of blue colors in 888 mode */&lt;BR /&gt;#define BLUE_COLORS&amp;nbsp;&amp;nbsp; 0x100&lt;/P&gt;&lt;P style="color: #646464; font-family: Arial, sans-serif; font-size: 12px;"&gt; &lt;BR /&gt;The last thing that needs to be done is to define the basic color type used for storing pixel data. This type must match the size of the pixel data. For 32-bit pixel data, this would be a 32-bit word.&lt;BR /&gt; &lt;BR /&gt;/* Color type is a 32-bit value */&lt;BR /&gt;typedef UNS_32 COLOR_T;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 31 Mar 2016 01:06:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-FAQs/Why-are-all-my-colors-wrong-in-SWIM/m-p/463451#M36</guid>
      <dc:creator>lpcware-support</dc:creator>
      <dc:date>2016-03-31T01:06:59Z</dc:date>
    </item>
  </channel>
</rss>

