MCPcopy Create free account
hub / github.com/a-e-k/canvas_ity / get_image_data

Function get_image_data

test/test.cpp:1800–1830  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1798}
1799
1800void get_image_data( canvas &that, float width, float height )
1801{
1802 for ( int index = 0; index < 100; ++index )
1803 {
1804 that.set_color( fill_style,
1805 static_cast< float >( index / 2 % 2 ),
1806 static_cast< float >( index / 4 % 2 ),
1807 static_cast< float >( index / 8 % 2 ),
1808 static_cast< float >( index / 16 % 2 ) );
1809 that.fill_rectangle( 3.0f * static_cast< float >( index % 10 ),
1810 3.0f * static_cast< float >( index / 10 ),
1811 3.0f, 3.0f );
1812 }
1813 unsigned char data[ 4939 ];
1814 data[ 0 ] = 150;
1815 for ( int index = 1; index < 4939; ++index )
1816 data[ index ] = static_cast< unsigned char >(
1817 ( data[ index - 1 ] * 137 + 53 ) & 255 );
1818 that.get_image_data( data + 2, 35, 35, 141, -10, -10 );
1819 unsigned hash = 0;
1820 for ( int index = 0; index < 4939; ++index )
1821 hash = ( ( ( hash & 0x1ffff ) << 15 ) | ( hash >> 17 ) ) ^ data[ index ];
1822 unsigned const expected = 0xf53f9792;
1823 that.set_color( fill_style, hash != expected, hash == expected, 0.0f, 1.0f );
1824 that.fill_rectangle( 30.0f, 0.0f, width, 30.0f );
1825 that.set_linear_gradient( fill_style, 0.0f, 0.0f, width, 0.0f );
1826 that.add_color_stop( fill_style, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f );
1827 that.add_color_stop( fill_style, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f );
1828 that.fill_rectangle( 0.0f, 0.45f * height, width, 0.1f * height );
1829 that.get_image_data( 0, 32, 32, 128, 0, 0 );
1830}
1831
1832void put_image_data( canvas &that, float width, float height )
1833{

Callers

nothing calls this directly

Calls 5

set_colorMethod · 0.80
fill_rectangleMethod · 0.80
get_image_dataMethod · 0.80
set_linear_gradientMethod · 0.80
add_color_stopMethod · 0.80

Tested by

no test coverage detected