MicroController Pros Home Page My Account  Cart Contents  Checkout  

****Note: We no longer process and ship international orders. Only orders from USA and Canada are now accepted.****
You can place international orders for our products on E-Bay. Just copy the item's title description from our website and paste it into the search box on E-Bay and place your order there.

  Store » emWin Multi layer/multi display My Account  |  Cart Contents  |  Checkout   
Quick Find
 
Enter keywords to find the product you are looking for in the Quick Find field above

or use
Advanced Search
Categories
Accessory Boards->
8051->
ADI Blackfin
Arduino->
ARM->
Atmel AVR->
Cypress PSoC
Freescale->
FTDI->
Locktronics
Microchip PIC->
MIPS
Parallax->
Renesas
Silicon Labs
ST Microelectronics->
Texas Instruments->
Tibbo->
Books->
Displays->
E-Blocks->
EEPROM/EPROM/FLASH
Embedded Ethernet->
Embedded Software->
I/O Modules->
Parts & Components->
Pick & Place Tools
Programmable Logic (PLD)
Prototype PCBs->
Robotics
ROM/Flash Emulators
Test & Measurement->
Tutorial Software
Universal Programmers->
Wireless->
Information
Intro to Embedded Tools
Embedded News Digest
Useful Resources
Shipping & Returns
Warranty & Liability
Privacy Notice
Conditions of Use
Contact Us
emWin: Multi layer/multi display support emWin: Multi layer/multi display support

Windows can be placed in any layer or display, drawing operations can be used on any layer or display. Since there are really only smaller differences from this point of view, multiple layers and multiple displays are handled the same way (Using the same API routines) and are simply referred to as multiple layers, even if the particular embedded system uses multiple displays. The emWin viewer allows you to look at every individual layer (display), but in the case of multiple layer systems also to look at the actual output (the composite view). Currently systems with multiple displays and multiple layers can be used, but not simulated.

Limitations

Currently systems with multiple displays and multiple layers can be used, but not simulated. Currently systems with a total of max 5 displays / layers are supported.

Selecting a layer for drawing operations

When drawing directly, per default layer 0 is used. An other layer can be selected by using GUI_SelLayer().

Sample

The following sample shows how to select a layer for drawing operations:

void MainTask(void) {
GUI_Init();
/* Draw something on default layer 0 */
GUI_SetBkColor(GUI_GREEN);
GUI_Clear();
GUI_DispStringHCenterAt("Layer 0", 100, 46);
/* Draw something on layer 1 */
GUI_SelLayer(1); /* Select layer 1 */
GUI_SetBkColor(GUI_RED);
GUI_Clear();
GUI_SetColor(GUI_BLUE);
GUI_FillRect(20, 20, 179, 79);
GUI_SetColor(GUI_WHITE);
GUI_SetTextMode(GUI_TM_TRANS);
GUI_DispStringHCenterAt("Layer 1", 100, 46);
while(1) {
GUI_Delay(100);
}
}

Screenshot of above sample

Selecting a layer for a window

The window manager automatically keeps track of which window is located in which layer. This is done in a fairly easy way: If the window manager is used, every layer has a top level (desktop) window. Any other window in this layer is visible only if it is a descendent (a child or grand- child or ...) of one of these desktop windows. Which layer a window is in depends solely on which desktop window it is a descendent of.

Sample

The following sample shows how to create 3 windows on 2 different desktop windows:

hWin0 = WM_CreateWindowAsChild( 10, 20, 80, 70,WM_GetDesktopWindowEx(0), WM_CF_SHOW, _cbWin0, 0);
/* Create 2 child windows on destop 1 */
hWin1 = WM_CreateWindowAsChild( 10, 20, 80, 70,WM_GetDesktopWindowEx(1), WM_CF_SHOW, _cbWin1, 0);
hWin2 = WM_CreateWindowAsChild(110, 20, 80, 70,WM_GetDesktopWindowEx(1), WM_CF_SHOW, _cbWin2, 0);

Screenshot of above sample

Screenshot Window hierarchy

Moving a window from one layer to an other

This can sometime be very desireable and can easily be accomplished: If a window is detached from its parent (The desktop window of one layer or any descenedent of this ldesktop window) and attached to a window which lies in an other layer, this win- dow actually moves from one layer to an other layer.

Sample

The following sample shows how to detach a window from its parent window and how to attach it to a new parent window:

/* Create 1 child window on destop 0 */
hWin0 = WM_CreateWindowAsChild( 10, 20, 80, 70,WM_GetDesktopWindowEx(0), WM_CF_SHOW, _cbWin0, 0);
/* Create 2 child windows on destop 1 */
hWin1 = WM_CreateWindowAsChild( 10, 20, 80, 70,WM_GetDesktopWindowEx(1), WM_CF_SHOW, _cbWin1, 0);
hWin2 = WM_CreateWindowAsChild(110, 20, 80, 70,WM_GetDesktopWindowEx(1), WM_CF_SHOW, _cbWin2, 0);
GUI_Delay(1000);
/* Detach window 2 from desktop 1 and attach it to desktop 0 */
WM_AttachWindow(hWin2, WM_GetDesktopWindowEx(0));

Any other window in this layer is visible only if it is a descendent (a child or grand- child or ...) of one of these desktop windows. Which layer a window is in depends solely on which desktop window it is a descendent of.

Screenshot Window hierarchy

The next table shows the screenshot and the window hierarchy of the above sample after attaching the window to the new parent:

Screenshot Window hierarchy

Using multi layer support

emWin does not distinguish between multiple layers or multiple displays. When using multiple layers normally the size and the driver for each layer is the same. The viewer shows each layer in a separate window. The composite window of the viewer shows the layers one above the other:

 

Using the viewer with multiple layers

The emWin viewer treats pixels with index 0 in a layer above layer 0 as transparent. This means in the composite view the pixels of the layers below are visible.

Using transparency

The following sample shows how to draw transparent and non transparent:

GUI_SelLayer(1);
GUI_SetBkColor(GUI_WHITE); /* Select white for the background */
GUI_Clear();
GUI_SetColor(GUI_BLACK); /* Select black for the text */
GUI_SetFont(&GUI_FontComic24B_ASCII);
GUI_DispStringHCenterAt("Layer#:1",XSize / 2, 5);
GUI_SetColorIndex(0); /* Select transparency */
GUI_FillCircle(LCD_GetXSize() / 2,YSize / 2 + 15,YSize / 2 - 20); /* A transparent circle will be drawn */

Multi layer sample

The sample below contains a screenshot of the viewer with 2 layers. The simulated LCD-controller is the integrated LCD-controller of a Toshiba TMPR3916 (Capricorn 2). Layer 0(E) shows color bars with a high color configuration. Layer 1(B) shows a transparent circle on a white background with colored rectangles. The composite win- dow shows the result which is actually visible on the display:

Layer 0

 

 

 

 

Layer 1

Composite view
(layer 0 + layer 1)

 

 

 

 

 

Pitfalls

Since for all but layer 0 Index 0 means transparency, Index 0 can not be used to dis- play colors. This also means that the color conversion should never yield 0 as best match for a color, since this would result in a transparent pixel. This means that only some fixed palette modes should be used and that you need to be careful when defining you own palette. You need to make sure that the color conversion (24 bit RGB -> Index) never yields 0 as result.

Fixed palette modes

8666_1 is currently the only available mode. For details please take a look at chapter colors.

Custom palette mode

If a custom palette should be used in a layer > 0, the first color should not be used from the color conversion routines. The following shows a sample definition for a cus- tom palette with 15 gray scales:

#define LCD_FIXEDPALETTE_1 0
#define LCD_PHYSCOLORS_1 0x000000, /* Transparency, not black */ \
0x000000, 0x222222, 0x333333, \
0x444444, 0x555555, 0x666666, 0x777777, \
0x888888, 0x999999, 0xAAAAAA, 0xBBBBBB, \
0xCCCCCC, 0xDDDDDD, 0xEEEEEE, 0xFFFFFF

If you need to draw some black items with this palette you can not use GUI_SetColor(0x000000). The result from the color conversion routines would be index 0 (transparent). You should use GUI_SetColorIndex(1).

Using multi display support

Each display can be accessed with its own driver and with its own settings. You can define up to 5 different displays.

Multi display sample

The sample below shows a screenshot of the simulation with 2 displays. The fist dis- play is a 8bpp color display with a size of 320 x 240 pixel. The driver is LCD13XX.c configured for an Epson S1D13705 LCD-controller. The second display is a 1bpp bw- display with a size of 240 x 128 pixels. The driver is LCDSlin.c configured for a Toshiba T6963 LCD-controller:

 

 

Shopping Cart more
0 items
What's New? more
Level Shifter Board, 1.8V/3.3V/5V, 2 Circuits, I2C or SMBus
Level Shifter Board, 1.8V/3.3V/5V, 2 Circuits, I2C or SMBus
US$10.00
Bestsellers
01. 2x5 (10-pin) 0.05" pitch IDC Connector Flat Ribbon Cable, 20cm
02. 2x5 (10-pin) 0.05" pitch IDC Connector Flat Ribbon Cable, 12cm
03. 5-pin Press-Fit Header Strip, Breakaway Pins, 2.54mm Pitch
04. Parallel to USB Adapter: Connect USB printer to LPT port
05. 2x10 (20-pin) 0.1" pitch IDC Connector Flat Ribbon Cable, 15cm
06. 8-pin Press-Fit Header Strip, Breakaway Pins, 2.54mm Pitch
07. USB Universal In-Circuit Programmer PIC AVR ARM MSP 8051 EEPROM
08. 2x5 (10-pin) 0.1" pitch IDC Connector Flat Ribbon Cable, 15cm
09. ARM JTAG Debugger & Programmer, parallel port
10. Power Supply 3-12V DC, U.S. plug, 6 connection tips
Reviews more
This is .8mm spacing, so be aware of that when ordering. ..
4 of 5 Stars!
  Thursday 25 April, 2024   List of all our Products

Copyright © 2003-2017 MicroController Pros LLC
Powered by osCommerce