Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming > #6027
| Path | csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | BartC <bc@freeuk.com> |
| Newsgroups | comp.programming |
| Subject | Re: javascript fillrect vs beginpath - why is that so? |
| Date | Mon, 7 Dec 2015 14:20:28 +0000 |
| Organization | A noiseless patient Spider |
| Lines | 25 |
| Message-ID | <n444f7$aco$1@dont-email.me> (permalink) |
| References | <838b34ba-88fb-48a1-964e-67d0954c7ed3@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Mon, 7 Dec 2015 14:18:15 -0000 (UTC) |
| Injection-Info | mx02.eternal-september.org; posting-host="cf45b3961a050227b1103bebc3cbc15a"; logging-data="10648"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19FCPIPSGaBDRisbgie+Rl3" |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 |
| In-Reply-To | <838b34ba-88fb-48a1-964e-67d0954c7ed3@googlegroups.com> |
| Cancel-Lock | sha1:AVbj3pQ1y4OKM5hQDRTRpbTBKL8= |
| Xref | csiph.com comp.programming:6027 |
Show key headers only | View raw
On 29/11/2015 13:27, fir wrote: > afail in js/canvas there is no call to fillrect, fillcircle etc method but instead something like > > ctx.beginPath(); > ctx.rect(brickX, brickY, brickWidth, brickHeight); > ctx.fillStyle = "#0095DD"; > ctx.fill(); > ctx.closePath(); > > is used... it seems overal a bit weird decision.. dont you think so? (or maybe not?) at least it wonders me a bit, Why is that so - is there some rationale under it? Why? It seems they decided to use a consistent approach to area fill: define an outline path first, then apply fill. Because in general, areas to be filled can be arbitrarily complex (maybe the rectangle is a hole within a bigger shape, or is an island within a hole). There's nothing to stop you creating your own dedicated rectangle fill routine based around the above. (Your sequence above doesn't seem quite right: you're filling the shape /then/ closing the path!) -- Bartc
Back to comp.programming | Previous | Next — Previous in thread | Find similar | Unroll thread
javascript fillrect vs beginpath - why is that so? fir <profesor.fir@gmail.com> - 2015-11-29 05:27 -0800
Re: javascript fillrect vs beginpath - why is that so? Julio Di Egidio <julio@diegidio.name> - 2015-11-29 12:34 -0800
Re: javascript fillrect vs beginpath - why is that so? fir <profesor.fir@gmail.com> - 2015-12-03 07:20 -0800
Re: javascript fillrect vs beginpath - why is that so? Öö Tiib <ootiib@hot.ee> - 2015-12-06 08:08 -0800
Re: javascript fillrect vs beginpath - why is that so? BartC <bc@freeuk.com> - 2015-12-07 14:20 +0000
csiph-web