[Cuis-dev] tiled background image
Juan Vuletich
juan at cuis.st
Tue Oct 1 18:18:58 PDT 2024
On 10/1/2024 8:04 PM, Mark Volkmann via Cuis-dev wrote:
> In the current code the WorldMorph drawOn: method sends
> aCanvas image: backgroundImage at: `0 at 0`
> if backgroundImage is set.
> That can be set with code like the following:
>
> filePath := '/Users/volkmannm/Pictures/images/altitude1600.jpg'.
> byteArray := (filePath asFileEntry readStream) binary
> contentsOfEntireFile.
> self runningWorld backgroundImageData: byteArray.
>
> The backgroundImageData: method is defined in PasteUpMorph which is
> the superclass of WorldMorph.
> That method sends #buildMagnifiedBackgroundImage to self.
> That method contains this line:
>
> backgroundImage := image magnifyTo: extent.
>
> That stretches the image to fit the size of the WorldMorph which is
> the size of the whole window.
> It does not maintain the aspect ratio of the image.
>
> That seems fine for images that are patterns, but not for images that
> contain recognizable things like people, animals, buildings, cars, ...
>
> I think it would be great to have three options for how a background
> image is used,
> 1) stretch as is done currently
> 2) change size to cover WorldMorph without changing the aspect ratio
> (right or bottom of image could be cut off)
> 3) tile the image over the window
>
> I have learned how to modify WorldMorph and PasteUpMorph to tile the
> image and the cover option wouldn't be difficult to implement.
> If I were to submit a change set that modifies WorldMorph and
> PasteMorph to support all three options, would it be considered?
Yes!
Cheers,
>
>
> On Mon, Sep 30, 2024 at 8:23 PM Juan Vuletich <juan at cuis.st
> <mailto:juan at cuis.st>> wrote:
>
> On 9/30/2024 8:21 PM, Mark Volkmann via Cuis-dev wrote:
>> I see the Squeak has the class BackgroundMorph that supports
>> tiling an image over the World background, but that class is not
>> in Cuis. Is there another way to tile an image over the World
>> background that is in the base Cuis image?
>>
>> --
>> R. Mark Volkmann
>> Object Computing, Inc.
>
> Yes. You need to create your own morph, and in its #drawOn: method
> do whatever you need. You can also modify WorldMorph so it tiles.
> Go Smalltalk go!
>
> Cheers,
>
> --
> Juan Vuletich
> cuis.st <http://cuis.st>
> github.com/jvuletich <http://github.com/jvuletich>
> researchgate.net/profile/Juan-Vuletich <http://researchgate.net/profile/Juan-Vuletich>
> independent.academia.edu/JuanVuletich <http://independent.academia.edu/JuanVuletich>
> patents.justia.com/inventor/juan-manuel-vuletich <http://patents.justia.com/inventor/juan-manuel-vuletich>
> linkedin.com/in/juan-vuletich-75611b3 <http://linkedin.com/in/juan-vuletich-75611b3>
> twitter.com/JuanVuletich <http://twitter.com/JuanVuletich>
>
>
>
> --
> R. Mark Volkmann
> Object Computing, Inc.
--
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20241001/e1473585/attachment-0001.htm>
More information about the Cuis-dev
mailing list