Jim
[Sorry for not responding earlier - this message just dropped down the list too fast and I found it again when actually looking for a different message]
In theory, the origin of a BitmapFillStyle (or any OrientedFillStyle) should be relative to the origin of the shape it fills. However, in an attempt to make these fill styles work in Morphic and be compatible with the already existing InfiniteForms (stored, of course, in the instVar #color - ouch!) this definition was screwed up so that there is a significant difference in how the origin is interpreted in other-than-flash-morphs. For the common morph (Morphus ordinarius?!), the origin is really the global origin, so that a BitmapFillStyle starting at the filled morph's upper left corner has an origin equal to the morph's boundingBox origin.
Note that the above also requires to fix up a Morph's fill style if it is moved since the origin of the fill style has to move as well to stay in sync with the origin. This happens in Morph>>privateMoveBy: and is a pretty ugly hack (but the only way to keep the InfiniteForms working, since they are always relative to 0@0). It's likely that your problem is coming from this - assuming that you have two fill styles it's possible that one gets actually adjusted (if it was installed using #fillStyle:) and the other one not (only the #fillStyle is adjusted). To check this out you could just assign the origin in the #drawOn: method to make sure both fill styles are positioned accordingly, e.g.,
MyMorph>>drawOn: aCanvas self fillStyle1 origin: (self origin). self fillStyle2 origin: (self origin + (1@1)). aCanvas fillRectangle: self bounds fillStyle: self fillStyle1. aCanvas fillRectangle: self bounds fillStyle: self fillStyle2.
If the above doesn't help, feel free to send the code around that you're actually working on - the solution is probably simple.
- Andreas
-----Original Message----- From: Jim Benson [mailto:jb@speed.net] Sent: Wednesday, March 29, 2000 8:50 PM To: Squeak Cc: recipient list not shown Subject: BitmapFillStyles
Hi,
My question is how does the #origin: in a BitmapFillStyle work? Let's say that I have two identical patterned bitmaps that I way to keep registered in relationship to each other. In other words, when I lay one on top of the other, I want the pattern to appear seemless. From what I've seen in the code, people seem to put the origin at the bounding box origin. However, the only way that I've been able to get it to work is to set the origin to 1@1. And I have to reset the origin to 1@1 to get it to line up correctly after I move it.
I guess I don't understand how to use #origin:
Jim Benson
squeak-dev@lists.squeakfoundation.org