MCPcopy Create free account
hub / github.com/kiibohd/controller / Pixel_pixelTweenInterpolation

Function Pixel_pixelTweenInterpolation

Macro/PixelMap/pixel.c:1775–2013  ·  view source on GitHub ↗

Basic interpolation Pixel Pixel Function TODO - Only works with Colummn and Row fill currently

Source from the content-addressed store, hash-verified

1773// Basic interpolation Pixel Pixel Function
1774// TODO - Only works with Colummn and Row fill currently
1775void Pixel_pixelTweenInterpolation( const uint8_t *frame, AnimationStackElement *stack_elem )
1776{
1777 // Iterate over all of the Pixel Modifier elements of the Animation Frame
1778 uint16_t pos = 0;
1779 PixelModElement *prev = 0;
1780 PixelModElement *mod = (PixelModElement*)&frame[pos];
1781 while ( mod->type != PixelAddressType_End )
1782 {
1783 // By default, no interpolation
1784 int32_t start = mod->index;
1785 int32_t end = mod->index;
1786
1787 // Calculate interpolation position
1788 // TODO Depends on addressing type
1789 // TODO Work with dis-similar PixelModElement address types
1790 switch ( mod->type )
1791 {
1792 case PixelAddressType_ColumnFill:
1793 // If this is the first pixel, just set start at the same spot
1794 start = prev != 0 ? prev->rect.col : mod->rect.col;
1795 end = mod->rect.col;
1796 break;
1797
1798 case PixelAddressType_RowFill:
1799 // If this is the first pixel, just set start at the same spot
1800 start = prev != 0 ? prev->rect.row : mod->rect.row;
1801 end = mod->rect.row;
1802 break;
1803
1804 case PixelAddressType_Rect:
1805 // TODO - This is not correct (just a quick and dirty hack)
1806 if ( prev != 0 )
1807 {
1808 // TODO - Diagonal interpolation?
1809 if ( prev->rect.col != mod->rect.col )
1810 {
1811 start = prev->rect.col;
1812 }
1813 if ( prev->rect.row != mod->rect.row )
1814 {
1815 start = prev->rect.row;
1816 }
1817 }
1818 else
1819 {
1820 start = mod->rect.col;
1821 }
1822 //end = ( mod->rect.col + mod->rect.row ) / 2;
1823 end = mod->rect.col;
1824 break;
1825
1826 case PixelAddressType_ScanCode:
1827 // If this is the first pixel, just set start at the same spot
1828 start = prev != 0 ? prev->index : mod->index;
1829 end = mod->index;
1830 break;
1831
1832 case PixelAddressType_Index:

Callers 1

Pixel_frameTweenStandardFunction · 0.85

Calls 6

Pixel_fillPixelLookupFunction · 0.85
printInt8Function · 0.85
Pixel_8bitInterpolationFunction · 0.85
Pixel_pixelEvaluationFunction · 0.85
Pixel_pixelTweenNextPosFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…