~ubuntu-branches/ubuntu/vivid/golang/vivid

« back to all changes in this revision

Viewing changes to doc/articles/image_package.html

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-08-20 14:06:23 UTC
  • mfrom: (14.1.23 saucy-proposed)
  • Revision ID: package-import@ubuntu.com-20130820140623-b414jfxi3m0qkmrq
Tags: 2:1.1.2-2ubuntu1
* Merge from Debian unstable (LP: #1211749, #1202027). Remaining changes:
  - 016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.
  - d/control,control.cross: Update Breaks/Replaces for Ubuntu
    versions to ensure smooth upgrades, regenerate control file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
dstr, dstg, dstb, dsta := dst.RGBA()
46
46
srcr, srcg, srcb, srca := src.RGBA()
47
47
_, _, _, m := mask.RGBA()
48
 
const M = 1<<16 - 1
 
48
const M = 1&lt;&lt;16 - 1
49
49
// The resultant red value is a blend of dstr and srcr, and ranges in [0, M].
50
50
// The calculation for green, blue and alpha is similar.
51
51
dstr = (dstr*(M-m) + srcr*m) / M
130
130
A <code>Rectangle</code> is inclusive at the top-left and exclusive at the
131
131
bottom-right. For a <code>Point p</code> and a <code>Rectangle r</code>,
132
132
<code>p.In(r)</code> if and only if
133
 
<code>r.Min.X <= p.X && p.X < r.Max.X</code>, and similarly for <code>Y</code>. This is analagous to how
 
133
<code>r.Min.X &lt;= p.X &amp;&amp; p.X &lt; r.Max.X</code>, and similarly for <code>Y</code>. This is analogous to how
134
134
a slice <code>s[i0:i1]</code> is inclusive at the low end and exclusive at the
135
135
high end. (Unlike arrays and slices, a <code>Rectangle</code> often has a
136
136
non-zero origin.)
193
193
 
194
194
<pre>
195
195
b := m.Bounds()
196
 
for y := b.Min.Y; y < b.Max.Y; y++ {
197
 
        for x := b.Min.X; y < b.Max.X; x++ {
 
196
for y := b.Min.Y; y &lt; b.Max.Y; y++ {
 
197
        for x := b.Min.X; x &lt; b.Max.X; x++ {
198
198
                doStuffWith(m.At(x, y))
199
199
        }
200
200
}
236
236
The slice-based <code>Image</code> implementations also provide a
237
237
<code>SubImage</code> method, which returns an <code>Image</code> backed by the
238
238
same array. Modifying the pixels of a sub-image will affect the pixels of the
239
 
original image, analagous to how modifying the contents of a sub-slice
 
239
original image, analogous to how modifying the contents of a sub-slice
240
240
<code>s[i0:i1]</code> will affect the contents of the original slice
241
241
<code>s</code>.
242
242
</p>