The difference between cavas fill () and fillrect ()


            var odiv1=document.getElementById("csn")
            var ctx=odiv1.getContext("2d")
            ctx.rect(20,20,150,100);
            ctx.fill();
            ctx.fillRect(40,40,100,100);
            
        </script>
    </body>

ask the gods the difference between fill () and fillrect () except for calling the display on the canvas. What"s the difference? You"d better give an example.

Jan.08,2022

fillRect (x, y, width, height)
draw a filled rectangle
fill ()
to generate a solid graph by filling the content area of the path.

reference:
https://developer.mozilla.org.


fillRect can be decomposed into
rect (x br y, width, height)
fill ();

).

fill () is a lower-level method. FillRect is only used to draw filled rectangles, and fill is used to fill any closed path. For example, arc () circles can also be drawn

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e5d1cf-441df.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e5d1cf-441df.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?