@@ -1537,6 +1537,153 @@ pub unsafe extern "C" fn processing_image_readback(
15371537 } ) ;
15381538}
15391539
1540+ /// Set the tint color applied to images.
1541+ ///
1542+ /// SAFETY:
1543+ /// - graphics_id is a valid ID returned from graphics_create.
1544+ /// - This is called from the same thread as init.
1545+ #[ unsafe( no_mangle) ]
1546+ pub extern "C" fn processing_tint ( graphics_id : u64 , color : Color ) {
1547+ error:: clear_error ( ) ;
1548+ let graphics_entity = Entity :: from_bits ( graphics_id) ;
1549+ error:: check ( || {
1550+ let mode = graphics_get_color_mode ( graphics_entity) ?;
1551+ graphics_record_command ( graphics_entity, DrawCommand :: Tint ( color. resolve ( & mode) ) )
1552+ } ) ;
1553+ }
1554+
1555+ /// Remove the image tint.
1556+ ///
1557+ /// SAFETY:
1558+ /// - graphics_id is a valid ID returned from graphics_create.
1559+ /// - This is called from the same thread as init.
1560+ #[ unsafe( no_mangle) ]
1561+ pub extern "C" fn processing_no_tint ( graphics_id : u64 ) {
1562+ error:: clear_error ( ) ;
1563+ let graphics_entity = Entity :: from_bits ( graphics_id) ;
1564+ error:: check ( || graphics_record_command ( graphics_entity, DrawCommand :: NoTint ) ) ;
1565+ }
1566+
1567+ /// Set how image() interprets its coordinates (CORNER/CORNERS/CENTER/RADIUS).
1568+ ///
1569+ /// SAFETY:
1570+ /// - graphics_id is a valid ID returned from graphics_create.
1571+ /// - This is called from the same thread as init.
1572+ #[ unsafe( no_mangle) ]
1573+ pub extern "C" fn processing_image_mode ( graphics_id : u64 , mode : u8 ) {
1574+ error:: clear_error ( ) ;
1575+ let graphics_entity = Entity :: from_bits ( graphics_id) ;
1576+ error:: check ( || {
1577+ graphics_record_command (
1578+ graphics_entity,
1579+ DrawCommand :: ImageMode ( processing:: prelude:: ShapeMode :: from ( mode) ) ,
1580+ )
1581+ } ) ;
1582+ }
1583+
1584+ /// Draw an image at (dx, dy) at its native size.
1585+ ///
1586+ /// SAFETY:
1587+ /// - graphics_id and image_id are valid IDs from graphics_create/image_create.
1588+ /// - This is called from the same thread as init.
1589+ #[ unsafe( no_mangle) ]
1590+ pub extern "C" fn processing_image ( graphics_id : u64 , image_id : u64 , dx : f32 , dy : f32 ) {
1591+ error:: clear_error ( ) ;
1592+ let graphics_entity = Entity :: from_bits ( graphics_id) ;
1593+ let image_entity = Entity :: from_bits ( image_id) ;
1594+ error:: check ( || {
1595+ graphics_record_command (
1596+ graphics_entity,
1597+ DrawCommand :: Image {
1598+ entity : image_entity,
1599+ dx,
1600+ dy,
1601+ d_width : None ,
1602+ d_height : None ,
1603+ sx : None ,
1604+ sy : None ,
1605+ s_width : None ,
1606+ s_height : None ,
1607+ } ,
1608+ )
1609+ } ) ;
1610+ }
1611+
1612+ /// Draw an image at (dx, dy) scaled to (d_width, d_height).
1613+ ///
1614+ /// SAFETY:
1615+ /// - graphics_id and image_id are valid IDs from graphics_create/image_create.
1616+ /// - This is called from the same thread as init.
1617+ #[ unsafe( no_mangle) ]
1618+ pub extern "C" fn processing_image_scaled (
1619+ graphics_id : u64 ,
1620+ image_id : u64 ,
1621+ dx : f32 ,
1622+ dy : f32 ,
1623+ d_width : f32 ,
1624+ d_height : f32 ,
1625+ ) {
1626+ error:: clear_error ( ) ;
1627+ let graphics_entity = Entity :: from_bits ( graphics_id) ;
1628+ let image_entity = Entity :: from_bits ( image_id) ;
1629+ error:: check ( || {
1630+ graphics_record_command (
1631+ graphics_entity,
1632+ DrawCommand :: Image {
1633+ entity : image_entity,
1634+ dx,
1635+ dy,
1636+ d_width : Some ( d_width) ,
1637+ d_height : Some ( d_height) ,
1638+ sx : None ,
1639+ sy : None ,
1640+ s_width : None ,
1641+ s_height : None ,
1642+ } ,
1643+ )
1644+ } ) ;
1645+ }
1646+
1647+ /// Draw the (sx, sy, s_width, s_height) source region of an image into the
1648+ /// (dx, dy, d_width, d_height) destination rectangle.
1649+ ///
1650+ /// SAFETY:
1651+ /// - graphics_id and image_id are valid IDs from graphics_create/image_create.
1652+ /// - This is called from the same thread as init.
1653+ #[ unsafe( no_mangle) ]
1654+ pub extern "C" fn processing_image_region (
1655+ graphics_id : u64 ,
1656+ image_id : u64 ,
1657+ dx : f32 ,
1658+ dy : f32 ,
1659+ d_width : f32 ,
1660+ d_height : f32 ,
1661+ sx : f32 ,
1662+ sy : f32 ,
1663+ s_width : f32 ,
1664+ s_height : f32 ,
1665+ ) {
1666+ error:: clear_error ( ) ;
1667+ let graphics_entity = Entity :: from_bits ( graphics_id) ;
1668+ let image_entity = Entity :: from_bits ( image_id) ;
1669+ error:: check ( || {
1670+ graphics_record_command (
1671+ graphics_entity,
1672+ DrawCommand :: Image {
1673+ entity : image_entity,
1674+ dx,
1675+ dy,
1676+ d_width : Some ( d_width) ,
1677+ d_height : Some ( d_height) ,
1678+ sx : Some ( sx) ,
1679+ sy : Some ( sy) ,
1680+ s_width : Some ( s_width) ,
1681+ s_height : Some ( s_height) ,
1682+ } ,
1683+ )
1684+ } ) ;
1685+ }
1686+
15401687#[ unsafe( no_mangle) ]
15411688pub extern "C" fn processing_mode_3d ( graphics_id : u64 ) {
15421689 error:: clear_error ( ) ;
0 commit comments