is there a reason why Rect and Point can't be defined outside exp/draw? then image ...
13 years, 10 months ago
(2010-07-15 08:24:22 UTC)
#3
is there a reason why Rect and Point can't be defined outside
exp/draw? then image could use Rect rather
than X0, X1, Y0, Y1 etc. and Image.At could be Image.At(Point)
rather than Image.At(int, int).
BTW, not to denigrate this change, but it does not provide the same
functionality
as the plan 9 images, which allowed the *external* coordinates
of an image to be an arbitrary rectangle.
the Image interface presupposes that all addressable
pixels lie inside ((0, 0), (width, height))
to remove that restriction, Image would need to be defined something like this:
type Image interface {
ColorModel() ColorModel
Rect() (x0, x1, y0, y1 int)
At(x, y) Color
}
or if Rectangle was defined outside exp/draw (perhaps in image itself):
type Image interface {
ColorModel() ColorModel
Rect() Rectangle
At(Point) Color
}
On 15 July 2010 18:24, roger peppe <rogpeppe@gmail.com> wrote: > BTW, not to denigrate this ...
13 years, 10 months ago
(2010-07-15 11:56:52 UTC)
#4
On 15 July 2010 18:24, roger peppe <rogpeppe@gmail.com> wrote:
> BTW, not to denigrate this change, but it does not provide the same
> functionality
> as the plan 9 images, which allowed the *external* coordinates
> of an image to be an arbitrary rectangle.
> the Image interface presupposes that all addressable
> pixels lie inside ((0, 0), (width, height))
Three things:
I'm not sure what you mean exactly by *external* coordinates. Can you elaborate?
There is a difference between the Image interface and the RGBA type.
You can copy an RGBA and/or fiddle with its X0, Y0, X1, and Y1 fields
to reslice (in two dimensions) an RGBA.
A struct isn't restricted to implementing only one interface. Perhaps
not all Images are subsettable, but you could declare:
type SubImage interface {
Image
Rect() (x0, y0, x1, y1 int)
}
and some Images could also be SubImages.
On 15 July 2010 12:56, Nigel Tao <nigel.tao.gnome@gmail.com> wrote: > I'm not sure what you ...
13 years, 10 months ago
(2010-07-15 15:43:53 UTC)
#5
On 15 July 2010 12:56, Nigel Tao <nigel.tao.gnome@gmail.com> wrote:
> I'm not sure what you mean exactly by *external* coordinates. Can you
elaborate?
by external coordinates, i mean the coordinates as
passed to Image.At.
currently, the top left pixel of an image is always at (0, 0)
and the bottom right at (i.Width()-1, i.Height()-1).
it is useful to be able to break that invariant; for
instance so that the image being drawn to
stores pixels for only a small subset of a virtual
image. it's convenient way to implement scrolling.
it can also be used along with subsettable images to ensure
that drawing is clipped to a given rectangle.
subsettable images don't cater for this functionality AFAICS.
On Jul 15, 2010, at 8:43 AM, roger peppe wrote: > On 15 July 2010 ...
13 years, 10 months ago
(2010-07-15 16:35:10 UTC)
#6
On Jul 15, 2010, at 8:43 AM, roger peppe wrote:
> On 15 July 2010 12:56, Nigel Tao <nigel.tao.gnome@gmail.com> wrote:
>> I'm not sure what you mean exactly by *external* coordinates. Can
>> you elaborate?
>
> by external coordinates, i mean the coordinates as
> passed to Image.At.
>
> currently, the top left pixel of an image is always at (0, 0)
> and the bottom right at (i.Width()-1, i.Height()-1).
>
> it is useful to be able to break that invariant; for
> instance so that the image being drawn to
> stores pixels for only a small subset of a virtual
> image. it's convenient way to implement scrolling.
> it can also be used along with subsettable images to ensure
> that drawing is clipped to a given rectangle.
>
> subsettable images don't cater for this functionality AFAICS.
nigel, i mentioned this issue in our chat the other day. i can provide
more detail in a higher-bandwidth medium.
-rob
http://codereview.appspot.com/1849041/diff/17001/10007 File src/pkg/image/image.go (right): http://codereview.appspot.com/1849041/diff/17001/10007#newcode20 src/pkg/image/image.go:20: // Buf[0] is the origin of the image's backing ...
13 years, 9 months ago
(2010-08-10 02:00:03 UTC)
#7
*** Submitted as http://code.google.com/p/go/source/detail?r=31e80f0b0959 *** image: change image representation from slice-of-slices to linear buffer, stride ...
13 years, 9 months ago
(2010-08-10 06:35:01 UTC)
#10
Issue 1849041: code review 1849041: image: change image representation from slice-of-slices...
(Closed)
Created 13 years, 10 months ago by nigeltao
Modified 13 years, 9 months ago
Reviewers:
Base URL:
Comments: 7