CircleOS  1
Functions
dma2d_graphic.c File Reference

Specific API functions used for the STM32F42x DMA2D controller. More...

Go to the source code of this file.

Functions

NODEBUG u32 DRAW_DMA2D_Dispatch (u32 fct, u32 param1, u32 param2, u32 param3)
 
NODEBUG void DMA2D_ScreenInit (void)
 
NODEBUG void DMA2D_ScreenSetDirty (unsigned int screen)
 
NODEBUG void DMA2D_ScreenSelect (unsigned int screen, enum SELECT_MODE mode)
 
NODEBUG void DMA2D_ScreenClear (unsigned int screen, int del)
 
NODEBUG void DMA2D_ScreenRedraw (unsigned int screen)
 
NODEBUG color32_t DMA2D_ObjectGetPixel (tDMA2D_pObject obj, int x, int y)
 
NODEBUG u32 DMA2D_ObjectGetIntersection (unsigned int scrn, tDMA2D_pObject obj1, tDMA2D_pObject obj2)
 
NODEBUG void DMA2D_ScreenCopy (unsigned int dest, unsigned int src)
 
NODEBUG tDMA2D_pObject DMA2D_ObjectCreate (int max_width, int max_height, int rdonly)
 
NODEBUG void DMA2D_ObjectDelete (tDMA2D_pObject obj)
 
NODEBUG int DMA2D_ObjectSetToScreen (tDMA2D_pObject obj, unsigned int screen)
 
NODEBUG int DMA2D_ObjectAssignBitmap (tDMA2D_pObject obj, void *pbitmap, int fbitmap0constant1)
 
NODEBUG int DMA2D_ObjectSetPartial (tDMA2D_pObject obj, int width, int height)
 
NODEBUG int DMA2D_ObjectSetOffset (tDMA2D_pObject obj, int offsX, int offsY)
 
NODEBUG int DMA2D_ObjectMove (tDMA2D_pObject obj, int x, int y)
 
NODEBUG void DMA2D_ObjectSetVisible (tDMA2D_pObject obj, int mode)
 
NODEBUG int DMA2D_ObjectSelect (tDMA2D_pObject obj)
 
NODEBUG void DMA2D_ObjectSetTransparency (tDMA2D_pObject obj, int transparency)
 
NODEBUG tDMA2D_pObject DMA2D_ObjectFind (unsigned int screen, int x, int y)
 
NODEBUG u32 DMA2D_ObjectGetImage (tDMA2D_pObject obj)
 
NODEBUG int DMA2D_ObjectGetPos (tDMA2D_pObject obj, unsigned int screen)
 
NODEBUG int DMA2D_ObjectGetSize (tDMA2D_pObject obj)
 
NODEBUG int DMA2D_ObjectPopZ (tDMA2D_pObject obj, unsigned int scr)
 
NODEBUG int DMA2D_ObjectPushZ (tDMA2D_pObject obj, unsigned int scr)
 
NODEBUG int DMA2D_ObjectSetForeground (tDMA2D_pObject obj, unsigned int scr)
 
NODEBUG int DMA2D_ObjectSetBackground (tDMA2D_pObject obj, unsigned int scr)
 
NODEBUG void DMA2D_ScreenRotate (Rotate_H12_V_Match_TypeDef old_orientation, Rotate_H12_V_Match_TypeDef new_orientation)
 
NODEBUG u32 DMA2D_ObjectTransform (tDMA2D_pObject obj_dest, tDMA2D_pObject obj_src, tTrans *trsf)
 
NODEBUG void DMA2D_SetTransform (tFctXY fct_X, tFctXY fct_Y)
 
NODEBUG u32 DMA2D_ObjectTransformReverse (tDMA2D_pObject obj_dest, tDMA2D_pObject obj_src, tFctObjXY fct)
 

Detailed Description

Author
FL
Date
07/2013
Note
Platform = Open4 STM3242x Daughter Board

Definition in file dma2d_graphic.c.

Function Documentation

NODEBUG int DMA2D_ObjectAssignBitmap ( tDMA2D_pObject  obj,
void *  pbitmap,
int  fbitmap0constant1 
)

For a "rd only" object, assign the image bitmap.

Parameters
[in]obj,:object to be added on the screen
[in]pbitmap,:pointer to the bitmap or to a 32bit ARGB value for a colored rectangle
[in]fbitmap0constant1,:0 for a bitmap, and 1 for a constant (colored rectangle).

Definition at line 1137 of file dma2d_graphic.c.

NODEBUG tDMA2D_pObject DMA2D_ObjectCreate ( int  max_width,
int  max_height,
int  rdonly 
)

Allocate memory for the object (and the graphic area when rdonly=0) Reset memory and position. The return value should be tested (ok is non-zero).

Parameters
[in]max_width,:width of the overall bitmap
[in]max_height,:height of the overall bitmap
[in]rdonly,:1 if FLASH (read only) or 0 if RAM (rw)
Returns
: a pointer to the created object. 0 if there is not enough memory.

Definition at line 1011 of file dma2d_graphic.c.

NODEBUG void DMA2D_ObjectDelete ( tDMA2D_pObject  obj)

Remove the object from all screens and mark as dirty these screens. Free the memory of the object.

Parameters
[in]obj,:object to delete

Definition at line 1084 of file dma2d_graphic.c.

NODEBUG tDMA2D_pObject DMA2D_ObjectFind ( unsigned int  screen,
int  x,
int  y 
)

Search for an object (upper Z-order) that has a visible pixel on the point specified by the coordinates (x,y).

Parameters
[in]screen,:Id of the screen to be scanned
[in]x,:Absolute X position on the screen
[in]y,:Absolute Y position on the screen

Definition at line 1412 of file dma2d_graphic.c.

NODEBUG u32 DMA2D_ObjectGetImage ( tDMA2D_pObject  obj)

Return a pointer to the image

Parameters
[in]obj,:Pointer to the object

Definition at line 1448 of file dma2d_graphic.c.

NODEBUG u32 DMA2D_ObjectGetIntersection ( unsigned int  scrn,
tDMA2D_pObject  obj1,
tDMA2D_pObject  obj2 
)

Find the intersection between two objects. Ignore the pixel when one is fully transparent. The return value quantifies the intensity of the intersection on a 32 bit number. Note that this function is quite long (in execution time) because it could make many calls to DMA2D_ObjectGetPixel

Parameters
[in]scrnScreen that contains the object
[in]obj1Pointer to the first object
[in]obj2Pointer to the first object
Returns
the sum of the MIN_alpha values of all the pixels that belong to both objects. MIN_alpha is the smaller alpha value of the pixels of each objects.

Definition at line 865 of file dma2d_graphic.c.

NODEBUG color32_t DMA2D_ObjectGetPixel ( tDMA2D_pObject  obj,
int  x,
int  y 
)

Get a pixel within an object

Parameters
[in]objThe reference of the object to read.
[in]xX coordinates inside the object
[in]yY coordinates inside the object

Definition at line 791 of file dma2d_graphic.c.

NODEBUG int DMA2D_ObjectGetPos ( tDMA2D_pObject  obj,
unsigned int  screen 
)

Return the current position of an object.

Parameters
[in]obj,:Pointer to the object to draw.
[in]screen,:id of the screen.
Returns
: a 32 bit value. The upper 16 bit half-word contains Y, and the lower 16-bit contains X.

Definition at line 1475 of file dma2d_graphic.c.

NODEBUG int DMA2D_ObjectGetSize ( tDMA2D_pObject  obj)

Return the size of an object.

Parameters
[in]obj,:Pointer to the object to draw.
Returns
: a 32 bit value. The upper 16 bit half-word contains the height, and the lower 16-bit contains the width.

Definition at line 1494 of file dma2d_graphic.c.

NODEBUG int DMA2D_ObjectMove ( tDMA2D_pObject  obj,
int  x,
int  y 
)

Move an object for the selected screen.

Parameters
[in]obj,:Pointer to the object
[in]x,:New column for the left corners
[in]y,:New row for the lower corners.

Definition at line 1313 of file dma2d_graphic.c.

NODEBUG int DMA2D_ObjectPopZ ( tDMA2D_pObject  obj,
unsigned int  scr 
)

Pop the object to one layer upper (heading to the foreground)

Parameters
[in]obj,:Pointer to the object to draw.
[in]scr,:Index of the screen.
Returns
: current Z order after the operation. -1 if the object is not assigned to the screen.

Definition at line 1514 of file dma2d_graphic.c.

NODEBUG int DMA2D_ObjectPushZ ( tDMA2D_pObject  obj,
unsigned int  scr 
)

Push the object to one layer deeper (heading to the background)

Parameters
[in]obj,:Pointer to the object to draw.
[in]scr,:Index of the screen.
Returns
: current Z order after the operation. -1 if the object is not assigned to the screen.

Definition at line 1552 of file dma2d_graphic.c.

NODEBUG int DMA2D_ObjectSelect ( tDMA2D_pObject  obj)

Select the current object. The DRAW_xx functions can be applied either to a screen or to a simple object. DMA2D_ObjectSelect select an object, and DMA2D_ScreenSelect will unselect it. It could be also unselected by selecting another object...

Parameters
[in]obj,:The reference of the object to draw.

Definition at line 1360 of file dma2d_graphic.c.

NODEBUG int DMA2D_ObjectSetBackground ( tDMA2D_pObject  obj,
unsigned int  scr 
)

Push the object to layer 0 (the background)

Parameters
[in]obj,:Pointer to the object to draw.
[in]scr,:Index of the screen.
Returns
: current Z order after the operation. -1 if the object is not assigned to the screen.

Definition at line 1626 of file dma2d_graphic.c.

NODEBUG int DMA2D_ObjectSetForeground ( tDMA2D_pObject  obj,
unsigned int  scr 
)

Pop the object to the top layer (the foreground)

Parameters
[in]obj,:Pointer to the object to draw.
[in]scr,:Index of the screen.
Returns
: current Z order after the operation. -1 if the object is not assigned to the screen.

Definition at line 1590 of file dma2d_graphic.c.

NODEBUG int DMA2D_ObjectSetOffset ( tDMA2D_pObject  obj,
int  offsX,
int  offsY 
)

Specify an offset (from the low left corner) for the display of an object. This function is used to reduce the part of the image that will be displayed. It has to be combined with a call to DMA2D_ObjectSetPartial.

Parameters
[in]obj,:A pointer to the object to be modified.
[in]offsX,:The new offset on the X axis.
[in]offsY,:The new offset on the Y axis.

Definition at line 1275 of file dma2d_graphic.c.

NODEBUG int DMA2D_ObjectSetPartial ( tDMA2D_pObject  obj,
int  width,
int  height 
)

Resize an object. This function is used with DMA2D_ObjectSetOffset to display just a part of an object.

Parameters
[in]objPointer to the object to be modified.
[in]widthPartial width to be displayed (from the offset)
[in]heightPartial height to be displayed (from the offset)

Definition at line 1236 of file dma2d_graphic.c.

NODEBUG int DMA2D_ObjectSetToScreen ( tDMA2D_pObject  obj,
unsigned int  screen 
)

Attach an object to a screen.

Parameters
[in]screen,:reference of the screen.
[in]obj,:object to be added on the screen

Definition at line 1103 of file dma2d_graphic.c.

NODEBUG void DMA2D_ObjectSetTransparency ( tDMA2D_pObject  obj,
int  transparency 
)

Modify the transparency for the current object. The DRAW_ functions will agglomerate this transparency information to build the 32-bit pixel.

Parameters
[in]obj,:Pointer to the object to draw.
[in]transparency,:New global alpha constant for the object. Must be in the range [0,255].

Definition at line 1387 of file dma2d_graphic.c.

NODEBUG void DMA2D_ObjectSetVisible ( tDMA2D_pObject  obj,
int  mode 
)

Make an object visible/not visible

Parameters
[in]obj,:Pointer to the object
[in]mode,:1 to see the object, 0 to hide it.

Definition at line 1339 of file dma2d_graphic.c.

NODEBUG u32 DMA2D_ObjectTransform ( tDMA2D_pObject  obj_dest,
tDMA2D_pObject  obj_src,
tTrans trsf 
)

Generic transform function use to copy, rotate, resize an object. The destination and the source objects could be the same. This function takes every pixel of the SOURCE, and calculate its destination. Note that when an offset or/and a partial size is specified, they will be used. This function is a bit complex (comparing with ObjectTransformReverse) because it properly manages the case of identical SOURCE/DESTINATION.

Parameters
[in]obj_dest,:Destination object.
[in]obj_src,:Source object
[in]trsf,:Definition of the transform functions
Returns
: 0 is ok, error code

Definition at line 1725 of file dma2d_graphic.c.

NODEBUG u32 DMA2D_ObjectTransformReverse ( tDMA2D_pObject  obj_dest,
tDMA2D_pObject  obj_src,
tFctObjXY  fct 
)

Generic transform function use to copy, rotate, resize, modify the color of an object.... This function takes every pixel of the DESTINATION, and calculate its new value. If the destination and the source are the same, some issues could happen depending on how the object is read (order). For example, it cannot be used to rotate an image on itself (the direct DMA2D_ObjectTransform must be used).

Parameters
[in]obj_dest,:Destination object
[in]obj_src,:Source object
[in]fct,:Definition of the transform function (return the pixel new contents for (x,y)
Returns
: 0 is ok, error code

Definition at line 1885 of file dma2d_graphic.c.

NODEBUG void DMA2D_ScreenClear ( unsigned int  screen,
int  del 
)
Parameters
[in]screenThe reference of the new screen to delete.
[in]delwhen 1, the referenced objects will be deleted as well

Definition at line 674 of file dma2d_graphic.c.

NODEBUG void DMA2D_ScreenCopy ( unsigned int  dest,
unsigned int  src 
)

Copy a screen into another.

Parameters
[in]destThe reference of the destination screen.
[in]srcThe reference of the source screen.

Definition at line 963 of file dma2d_graphic.c.

NODEBUG void DMA2D_ScreenInit ( void  )

Enable DMA/DMA2D mode Clear all screens, select screen0, Create generic home page for the application on screen0 Update screen0

< Enable DMA, DMA2D and SDRAM

Definition at line 586 of file dma2d_graphic.c.

NODEBUG void DMA2D_ScreenRedraw ( unsigned int  screen)

Rebuild the screen.

Parameters
[in]screenThe reference of the new screen to activate.

Definition at line 710 of file dma2d_graphic.c.

NODEBUG void DMA2D_ScreenRotate ( Rotate_H12_V_Match_TypeDef  old_orientation,
Rotate_H12_V_Match_TypeDef  new_orientation 
)

Rotate the screen in the memory...

Parameters
[in]old_orientation,:Orientation before the rotate action
[in]new_orientation,:Orientation after the rotate action
Returns
: none

Definition at line 1663 of file dma2d_graphic.c.

NODEBUG void DMA2D_ScreenSelect ( unsigned int  screen,
enum SELECT_MODE  mode 
)

Select the current screen.

Parameters
[in]screenThe reference of the new screen to activate.
[in]modeSpecifies if the selection is for the display or the addressing (or both)

Definition at line 643 of file dma2d_graphic.c.

NODEBUG void DMA2D_ScreenSetDirty ( unsigned int  screen)
inline

Set the dirty flag to trigger an update.

Parameters
[in]screenThe reference of the new screen to declare dirty.

Definition at line 624 of file dma2d_graphic.c.

NODEBUG void DMA2D_SetTransform ( tFctXY  fct_X,
tFctXY  fct_Y 
)

Define the transform function before calling DMA2D_ObjectTransform

Parameters
[in]fct_X,:Transform function for X
[in]fct_Y,:Transform function for Y
Returns
: none

Definition at line 1861 of file dma2d_graphic.c.

NODEBUG u32 DRAW_DMA2D_Dispatch ( u32  fct,
u32  param1,
u32  param2,
u32  param3 
)

Dispatcher. Because the number of entries in the main jumptable is limited, a second-level redirection is done from a single entry at the main level.

Parameters
[in]fctId of the function to be called
[in]param1First parameter (depends on fct); Casted when fct is called.
[in]param2Second parameter (depends on fct); Casted when fct is called.
[in]param3Third parameter (depends on fct); Casted when fct is called.

Definition at line 457 of file dma2d_graphic.c.