Dear Squeakers,
Not much Squeak related ones between GSoC ideas, which are slowly
coming, 14 so far, but this is way below the 30+ in previous years. So,
stretch your brain, come with some more ideas, which will be interesting
for potential students and of course useful for our community. Students
you are again welcome to propose such idea by your own. One student idea
for now!
Ideas so far: http://gsoc2013.esug.org/ideas
To propose an idea just respond to this post by fulfilling this idea
template:
Title:
Level: (beginner, intermediate, advanced)
Possible mentor: (if already known)
Possible second mentor: (if already known)
Description
Technical Details
Benefits to the Student
Benefits to the Community
Best regards
Serge and Janko,
your this year GSoC admins
--
Janko Mivšek
Aida/Web
Smalltalk Web Application Server
http://www.aidaweb.si
Thanks very much Chris, I'll give this a whirl.
Indeed, my _primary_ goal is to run things headless, which requires
decent error reporting to stdout/stderr.
However, I do really like REPLs (I use Clojure's, Python's and Ruby's
just about every day), and having such a thing for Smalltalk would
make me very happy. It would aid my ambassadorship greatly as well.
frank
On 26 March 2013 21:40, Chris Muller <asqueaker(a)gmail.com> wrote:
> Forwarding to your personal email as I have a feeling squeak-dev is
> going to bounce my message due to being a whopping 130K attachment.
>
>
> ---------- Forwarded message ----------
> From: Chris Muller <asqueaker(a)gmail.com>
> Date: Tue, Mar 26, 2013 at 4:38 PM
> Subject: Re: [squeak-dev] The Trunk: Graphics-tpr.205.mcz
> To: The general-purpose Squeak developers list
> <squeak-dev(a)lists.squeakfoundation.org>
>
>
> Here is my little wrapper for handling running .st scripts from the
> command-line and outputting Notifications and SyntaxErrors to stdOut
> and Errors to stdErr. I use this every day, at one time I had wanted
> to integrate this into the trunk.
>
> I've never found interacting back-and-forth with an image via
> command-line in the style of Camillo's tool useful. I don't know when
> one would want to do that. However certainly I do need to kick off
> Smalltalk jobs from the command-line, headless or not, by passing in
> .st scripts and that sounds like what you're wanting to do with a
> build server.
>
> MaCommandLineProcessor in the attached package is 11 methods total --
> it thinly wraps Squeaks existing capability so that some of the
> "gotcha's" are taken care of -- for example like the fact that if you
> try to print an Error's signalerContext's longStack, it's full of CR's
> rather than the platform line-ending making it unreadable in the host
> OS. MaCommandLineProcessor in the attached package fixes that.
>
> Comments welcome -- maybe you'll see some tips at least..
>
>
>
> On Tue, Mar 26, 2013 at 1:49 AM, Frank Shearar <frank.shearar(a)gmail.com> wrote:
>> On 26 March 2013 00:27, tim Rowledge <tim(a)rowledge.org> wrote:
>>> Starting from a fresh image from the Jenkins server that claimed to be completely clean and up to date
>>
>> That's going to be the best we have, for the moment. Mainly because
>> * we never have a green build,
>> * Squeak has very limited command line support
>> ** you need to feed it a chunk-formatted startup script, or a script
>> with no !s in it
>> ** exceptions mean debuggers pop up, rather than dumping stack traces to stdout
>>
>> But otherwise, if the resulting image is _not_ completely clean & up
>> to date, it's my fault, and please yell at me. Preferably in the form
>> of a nice bug report :)
>>
>> frank
>>
>>>, making the changes to get rid of the obsolete 'BitBlt current' idiom for everything visible, I have now committed about half-a-dozen packages that seem to be correct.
>>>
>>> I also committed a VMMaker change to
>>> a) move BitBltSImulation under SmartSyntaxPlugin
>>> b) move the pixel-peeker primitive into BitBltSimulation
>>> c) update the comment a bit to include some combination rules added about ten years ago
>>>
>>> A VM built from this passes the BitBltTests in TestRunner and appears to run everything normally.
>>>
>>> tim
>>> --
>>> tim Rowledge; tim(a)rowledge.org; http://www.rowledge.org/tim
>>> Strange OpCodes: SD: Self Destruct
>>>
>>>
>>>
>>
On Sun, Mar 24, 2013 at 05:33:13AM +0000, commits(a)source.squeak.org wrote:
> tim Rowledge uploaded a new version of Graphics to project The Trunk:
> http://source.squeak.org/trunk/Graphics-tpr.205.mcz
>
> ==================== Summary ====================
>
> Name: Graphics-tpr.205
> Author: tpr
> Time: 23 March 2013, 10:32:54.898 pm
> UUID: a16cf25b-36b7-4a5e-b3e9-3786b5f7c92d
> Ancestors: Graphics-tpr.204
>
> A somewhat involved pile of changes that I'm not 10% sure my use of MC has correctly caught; revert this if you find bugs!
> For example, MC claims that AbstractFont is very different but visual inspection says not.
Indeed, it looks like this update removes a number of AbstractFont methods.
I tried loading it and it hangs my image.
Dave
I've just noticed that the latest-from-jenkins image that I added VMMaker to this morning is 30Mb bigger than when it started. That seems a little excessive. There certainly isn't 30Mb worth of code involved.
SpaceTally says there is 29Mb of ByteStrings in the image, which seems rather a lot. In fact, I'll just attach the space report - it really is a bit alarming
tim
--
tim Rowledge; tim(a)rowledge.org; http://www.rowledge.org/tim
Strange OpCodes: YVR: Branch to Vancouver
tim Rowledge uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-tpr.208.mcz
==================== Summary ====================
Name: Graphics-tpr.208
Author: tpr
Time: 26 March 2013, 11:19:24.327 am
UUID: 565062f6-2335-4484-bfb9-44a91a9e32eb
Ancestors: Graphics-tpr.207
Correct some idiotic bugs in Graphics-tpr.206
- the method intended to call the new pixel peeker bitblt prim wasn't doing so
- several places where pixelAt: was used should have been pixelValueAt: (and how stupid we have two variants to get confused)
=============== Diff against Graphics-tpr.206 ===============
Item was changed:
----- Method: Form>>floodFill2:at: (in category 'filling') -----
floodFill2: aColor at: interiorPoint
"Fill the shape (4-connected) at interiorPoint. The algorithm is based on Paul Heckbert's 'A Seed Fill Algorithm', Graphic Gems I, Academic Press, 1990.
NOTE: This is a less optimized variant for flood filling which is precisely along the lines of Heckbert's algorithm. For almost all cases #floodFill:at: will be faster (see the comment there) but this method is left in both as reference and as a fallback if such a strange case is encountered in reality."
| poker stack old new x y top x1 x2 dy left goRight |
poker := BitBlt bitPokerToForm: self.
stack := OrderedCollection new: 50.
"read old pixel value"
+ old := self pixelValueAt: interiorPoint.
- old := self pixelAt: interiorPoint.
"compute new value"
new := self pixelValueFor: aColor.
old = new ifTrue:[^self]. "no point, is there?!!"
x := interiorPoint x.
y := interiorPoint y.
(y >= 0 and:[y < height]) ifTrue:[
stack addLast: {y. x. x. 1}. "y, left, right, dy"
stack addLast: {y+1. x. x. -1}].
[stack isEmpty] whileFalse:[
top := stack removeLast.
y := top at: 1. x1 := top at: 2. x2 := top at: 3. dy := top at: 4.
y := y + dy.
"Segment of scanline (y-dy) for x1 <= x <= x2 was previously filled.
Now explore adjacent pixels in scanline y."
x := x1.
+ [x >= 0 and:[(self pixelValueAt: x@y) = old]] whileTrue:[
- [x >= 0 and:[(self pixelAt: x@y) = old]] whileTrue:[
poker pixelAt: x@y put: new.
x := x - 1].
goRight := x < x1.
left := x+1.
(left < x1 and:[y-dy >= 0 and:[y-dy < height]])
ifTrue:[stack addLast: {y. left. x1-1. 0-dy}].
goRight ifTrue:[x := x1 + 1].
[
goRight ifTrue:[
+ [x < width and:[(self pixelValueAt: x@y) = old]] whileTrue:[
- [x < width and:[(self pixelAt: x@y) = old]] whileTrue:[
poker pixelAt: x@y put: new.
x := x + 1].
(y+dy >= 0 and:[y+dy < height])
ifTrue:[stack addLast: {y. left. x-1. dy}].
(x > (x2+1) and:[y-dy >= 0 and:[y-dy >= 0]])
ifTrue:[stack addLast: {y. x2+1. x-1. 0-dy}]].
+ [(x := x + 1) <= x2 and:[(self pixelValueAt: x@y) ~= old]] whileTrue.
- [(x := x + 1) <= x2 and:[(self pixelAt: x@y) ~= old]] whileTrue.
left := x.
goRight := true.
x <= x2] whileTrue.
].
!
Item was changed:
----- Method: Form>>primPixelValueAtX:y: (in category 'pixel access') -----
primPixelValueAtX: x y: y
"Return the raw pixel value at the given point. This pixel value depends on the receiver's depth. Typical clients use colorAt: to get a Color. Make sure the colorMap is nil for ColorForms "
+ <primitive: 'primitivePixelValueAt' module:'BitBltPlugin'>
- <primitive: 'primitivePixelValueAt' module:'PixelValuePeekPlugin'>
^(BitBlt bitPeekerFromForm: self) colorMap: nil; pixelAt: x@y!
Item was changed:
----- Method: PNMReadWriter>>nextPutGray: (in category 'writing') -----
nextPutGray: aForm
| myType val |
cols := aForm width.
rows := aForm height.
depth := aForm depth.
"stream position: 0."
aForm depth = 1 ifTrue:[myType := $4] ifFalse:[myType := $5].
self writeHeader: myType.
0 to: rows-1 do: [:y |
0 to: cols-1 do: [:x |
+ val := aForm pixelValueAt: x@y.
- val := aForm pixelAt: x@y.
stream nextPut: val.
]
].
!
Item was changed:
----- Method: PNMReadWriter>>nextPutRGB: (in category 'writing') -----
nextPutRGB: aForm
| myType f shift mask |
cols := aForm width.
rows := aForm height.
depth := aForm depth.
f := aForm.
depth < 16 ifTrue:[
f := aForm asFormOfDepth: 32.
depth := 32.
].
myType := $6.
"stream position: 0."
self writeHeader: myType.
depth = 32 ifTrue:[shift := 8. mask := 16rFF] ifFalse:[shift := 5. mask := 16r1F].
0 to: rows-1 do: [:y |
0 to: cols-1 do: [:x | | p r g b |
+ p := f pixelValueAt: x@y.
- p := f pixelAt: x@y.
b := p bitAnd: mask. p := p >> shift.
g := p bitAnd: mask. p := p >> shift.
r := p bitAnd: mask.
stream nextPut: r.
stream nextPut: g.
stream nextPut: b.
]
].
!
Item was changed:
----- Method: Pen>>print:withFont: (in category 'operations') -----
print: str withFont: font
"Print the given string in the given font at the current heading"
| lineStart scale wasDown |
scale := sourceForm width.
wasDown := penDown.
lineStart := location.
str do:
[:char |
char = Character cr ifTrue:
[self place: lineStart; up; turn: 90; go: font height*scale; turn: -90; down]
ifFalse:
[ | charStart pix rowStart form backgroundCode |
form := font characterFormAt: char.
backgroundCode := 1<< (form depth // 3 * 3) - 1.
charStart := location.
wasDown ifTrue: [
self up; turn: -90; go: font descent*scale; turn: 90; down.
0 to: form height-1 do:
[:y |
rowStart := location.
pix := RunArray newFrom:
+ ((0 to: form width-1) collect: [:x | form pixelValueAt: x@y]).
- ((0 to: form width-1) collect: [:x | form pixelAt: x@y]).
pix runs with: pix values do:
[:run :value |
value = backgroundCode
ifTrue: [self up; go: run*scale; down]
ifFalse: [self go: run*scale]].
self place: rowStart; up; turn: 90; go: scale; turn: -90; down].
].
self place: charStart; up; go: form width*scale; down].
].
wasDown ifFalse: [self up]
"
Display restoreAfter:
[Pen new squareNib: 2; color: Color red; turn: 45;
print: 'The owl and the pussycat went to sea
in a beautiful pea green boat.' withFont: TextStyle defaultFont]
"!
Item was changed:
----- Method: WarpBlt>>warpBitsSmoothing:sourceMap: (in category 'primitives') -----
warpBitsSmoothing: n sourceMap: sourceMap
| deltaP12 deltaP43 pA pB deltaPAB sp fixedPtOne poker pix nSteps |
<primitive: 'primitiveWarpBits' module: 'BitBltPlugin'>
"Check for compressed source, destination or halftone forms"
((sourceForm isForm) and: [sourceForm unhibernate])
ifTrue: [^ self warpBitsSmoothing: n sourceMap: sourceMap].
((destForm isForm) and: [destForm unhibernate])
ifTrue: [^ self warpBitsSmoothing: n sourceMap: sourceMap].
((halftoneForm isForm) and: [halftoneForm unhibernate])
ifTrue: [^ self warpBitsSmoothing: n sourceMap: sourceMap].
(width < 1) | (height < 1) ifTrue: [^ self].
fixedPtOne := 16384. "1.0 in fixed-pt representation"
n > 1 ifTrue:
[(destForm depth < 16 and: [colorMap == nil])
ifTrue: ["color map is required to smooth non-RGB dest"
^ self primitiveFail].
pix := Array new: n*n].
nSteps := height-1 max: 1.
deltaP12 := (self deltaFrom: p1x to: p2x nSteps: nSteps)
@ (self deltaFrom: p1y to: p2y nSteps: nSteps).
pA := (self startFrom: p1x to: p2x offset: nSteps*deltaP12 x)
@ (self startFrom: p1y to: p2y offset: nSteps*deltaP12 y).
deltaP43 := (self deltaFrom: p4x to: p3x nSteps: nSteps)
@ (self deltaFrom: p4y to: p3y nSteps: nSteps).
pB := (self startFrom: p4x to: p3x offset: nSteps*deltaP43 x)
@ (self startFrom: p4y to: p3y offset: nSteps*deltaP43 y).
poker := BitBlt bitPokerToForm: destForm.
poker clipRect: self clipRect.
nSteps := width-1 max: 1.
destY to: destY+height-1 do:
[:y |
deltaPAB := (self deltaFrom: pA x to: pB x nSteps: nSteps)
@ (self deltaFrom: pA y to: pB y nSteps: nSteps).
sp := (self startFrom: pA x to: pB x offset: nSteps*deltaPAB x)
@ (self startFrom: pA y to: pB y offset: nSteps*deltaPAB x).
destX to: destX+width-1 do:
[:x |
n = 1
ifTrue:
[poker pixelAt: x@y
+ put: (sourceForm pixelValueAt: sp // fixedPtOne asPoint)]
- put: (sourceForm pixelAt: sp // fixedPtOne asPoint)]
ifFalse:
[0 to: n-1 do:
[:dx | 0 to: n-1 do:
[:dy |
pix at: dx*n+dy+1 put:
+ (sourceForm pixelValueAt: sp
- (sourceForm pixelAt: sp
+ (deltaPAB*dx//n)
+ (deltaP12*dy//n)
// fixedPtOne asPoint)]].
poker pixelAt: x@y put: (self mixPix: pix
sourceMap: sourceMap
destMap: colorMap)].
sp := sp + deltaPAB].
pA := pA + deltaP12.
pB := pB + deltaP43]!
Hi Ken,
Installer is a Squeak utility for loading code. It can install code
from changesets and other things, and I recently extended it to allow
it to install code hosted on GitHub. A wrinkle was that GitHub only
uses SSL, and for the current Squeak VMs that entails additional setup
(an additional plugin).
Seeing as I'm interested in your work, I used your code as a guinea pig :).
I didn't expect all the tests to fail - I _am_ loading Cuis code into
Squeak, after all. I was just surprised to see _all_ the tests fail,
and upon investigation found a number of places where Cuis Strings and
Characters use non-Squeak methods. Again, this isn't unexpected. So I
wondered, before I delve too deeply into the drift, if perhaps
somewhere there was a document that summarised the changes.
frank
On 26 March 2013 04:18, Ken Dickey <Ken.Dickey(a)whidbey.com> wrote:
> On Mon, 25 Mar 2013 13:48:41 +0000
> Frank Shearar <frank.shearar(a)gmail.com> wrote:
>
> Frank,
>
> Sorry, I have not been following this discussion and am unsure of the context.
>
> Tests fail for mcz, SSL, GitHub, Cuis-Ropes ??
>
> With respect to the latter, I basically ported most of the Cuis Strings API into Ropes. I have not looked at Squeak in some time, so can't really comment on code drift.
>
> Cheers,
> -KenD
> =========
>> > The mcz is missing something important, namely
>> >
>> > Installer class >> github
>> > ^ InstallerGitHub new
>> >
>> > but with that in place, and with an SSL plugin installed (the
>> > published binaries are 32 bit only; they don't work in an Interpreter
>> > built on a 64 bit machine), you can:
>> >
>> > (Installer github
>> > user: 'KenDickey' repository: 'Cuis-Ropes) install
>> >
>> > frank
>>
>> I should add that in Squeak most of the tests fail. This is likely
>> because of drift between Cuis' and Squeak's String API. Is it possible
>> to find a document somewhere summarising the changes? If so, I'll
>> craft a Cuis-Compatibility package for Squeak.
>>
>> Thanks!
>>
>> frank
>>
>> _______________________________________________
>> Cuis mailing list
>> Cuis(a)jvuletich.org
>> http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
>
>
> --
> Ken [dot] Dickey [at] whidbey [dot] com
On 26 March 2013 13:22, Nicolas Cellier
<nicolas.cellier.aka.nice(a)gmail.com> wrote:
> Cuis did chose to not support unicode for simplicity and stick to
> 8-bits chars (CP-1252 ? iso-8859-L1 ? iso-8859-L15 ?).
> Squeak/Pharo cannot afford this choice.
> So there will be a few differences here and there.
OK, that's useful information. Indeed, I wouldn't want anything other
than Unicode anywhere.
> For line-ending, Cuis could provide a simplified version of nextLine
> linesDo: etc... based only on CR
> For the displaying of LF, CR, or any other non printable ASCII that
> should be generalized and an option available in Squeak too.
Yes, most of the differences were around the names of newline-making
methods, except for something like #generallyAcceptableInSelector,
which I had no idea how to implement.
frank
> Nicolas
>
> 2013/3/26 Frank Shearar <frank.shearar(a)gmail.com>:
>> That's great news, Hannes!
>>
>> Obviously I really wouldn't mind seeing String/Character shims in particular :)
>>
>> frank
>>
>> On 26 March 2013 09:34, H. Hirzel <hannes.hirzel(a)gmail.com> wrote:
>>> Yes, a document that summarizes the changes between Cuis and Squeak,
>>> is something we need soon. Cuis has advanced very nicely recently and
>>> at least for certain fields of application it can be considered the
>>> leading Squeak variant when comparing Squeak, Pharo and Cuis.
>>>
>>> Regarding compatibility between Squeak and Cuis. What I have seen so
>>> far is that there are not all that many issues regarding non-GUI
>>> classes. CR/LF is an issue. I have started doing a Cuis-compatibility
>>> layer for Squeak. So far it is quite thin. I.e. I manage to develop in
>>> Squeak and file in the mcz file into Cuis 4.1. As long as I do not use
>>> GUI classes it is fine.
>>>
>>> More on this later.
>>>
>>> --Hannes
>>>
>>> On 3/26/13, Frank Shearar <frank.shearar(a)gmail.com> wrote:
>>>> Hi Ken,
>>>>
>>>> Installer is a Squeak utility for loading code. It can install code
>>>> from changesets and other things, and I recently extended it to allow
>>>> it to install code hosted on GitHub. A wrinkle was that GitHub only
>>>> uses SSL, and for the current Squeak VMs that entails additional setup
>>>> (an additional plugin).
>>>>
>>>> Seeing as I'm interested in your work, I used your code as a guinea pig :).
>>>>
>>>> I didn't expect all the tests to fail - I _am_ loading Cuis code into
>>>> Squeak, after all. I was just surprised to see _all_ the tests fail,
>>>> and upon investigation found a number of places where Cuis Strings and
>>>> Characters use non-Squeak methods. Again, this isn't unexpected. So I
>>>> wondered, before I delve too deeply into the drift, if perhaps
>>>> somewhere there was a document that summarised the changes.
>>>>
>>>> frank
>>>>
>>>> On 26 March 2013 04:18, Ken Dickey <Ken.Dickey(a)whidbey.com> wrote:
>>>>> On Mon, 25 Mar 2013 13:48:41 +0000
>>>>> Frank Shearar <frank.shearar(a)gmail.com> wrote:
>>>>>
>>>>> Frank,
>>>>>
>>>>> Sorry, I have not been following this discussion and am unsure of the
>>>>> context.
>>>>>
>>>>> Tests fail for mcz, SSL, GitHub, Cuis-Ropes ??
>>>>>
>>>>> With respect to the latter, I basically ported most of the Cuis Strings
>>>>> API into Ropes. I have not looked at Squeak in some time, so can't really
>>>>> comment on code drift.
>>>>>
>>>>> Cheers,
>>>>> -KenD
>>>>> =========
>>>>>> > The mcz is missing something important, namely
>>>>>> >
>>>>>> > Installer class >> github
>>>>>> > ^ InstallerGitHub new
>>>>>> >
>>>>>> > but with that in place, and with an SSL plugin installed (the
>>>>>> > published binaries are 32 bit only; they don't work in an Interpreter
>>>>>> > built on a 64 bit machine), you can:
>>>>>> >
>>>>>> > (Installer github
>>>>>> > user: 'KenDickey' repository: 'Cuis-Ropes) install
>>>>>> >
>>>>>> > frank
>>>>>>
>>>>>> I should add that in Squeak most of the tests fail. This is likely
>>>>>> because of drift between Cuis' and Squeak's String API. Is it possible
>>>>>> to find a document somewhere summarising the changes? If so, I'll
>>>>>> craft a Cuis-Compatibility package for Squeak.
>>>>>>
>>>>>> Thanks!
>>>>>>
>>>>>> frank
>>>>>>
>>>>>> _______________________________________________
>>>>>> Cuis mailing list
>>>>>> Cuis(a)jvuletich.org
>>>>>> http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
>>>>>
>>>>>
>>>>> --
>>>>> Ken [dot] Dickey [at] whidbey [dot] com
>>>>
>>>> _______________________________________________
>>>> Cuis mailing list
>>>> Cuis(a)jvuletich.org
>>>> http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
>>>>
>>>
>>> _______________________________________________
>>> Cuis mailing list
>>> Cuis(a)jvuletich.org
>>> http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
>>
>
tim Rowledge uploaded a new version of Graphics to project The Trunk:
http://source.squeak.org/trunk/Graphics-tpr.206.mcz
==================== Summary ====================
Name: Graphics-tpr.206
Author: tpr
Time: 25 March 2013, 3:39:44.074 pm
UUID: 3475831d-5338-41ce-ab44-41981bd4daeb
Ancestors: Graphics-tpr.204
Change Form>pixelValueAt: to make use of the new primitivePixelValueAt
Change the users of bitPeekerFromForm: to take advantage of that.
Leave bitPeekerFromForm: to support any externally stored code we can't see right now.
Passes the tests in BitBltTest as of 20130325
=============== Diff against Graphics-tpr.204 ===============
Item was removed:
- ----- Method: ColorForm>>pixelValueAt: (in category 'pixel accessing') -----
- pixelValueAt: aPoint
- "Return the raw pixel value at the given point. Typical clients use colorAt: to get a Color."
- "Details: To get the raw pixel value, be sure the peeker's colorMap is nil."
-
- ^ (BitBlt bitPeekerFromForm: self) colorMap: nil; pixelAt: aPoint
- !
Item was changed:
----- Method: Form>>floodFill2:at: (in category 'filling') -----
floodFill2: aColor at: interiorPoint
"Fill the shape (4-connected) at interiorPoint. The algorithm is based on Paul Heckbert's 'A Seed Fill Algorithm', Graphic Gems I, Academic Press, 1990.
NOTE: This is a less optimized variant for flood filling which is precisely along the lines of Heckbert's algorithm. For almost all cases #floodFill:at: will be faster (see the comment there) but this method is left in both as reference and as a fallback if such a strange case is encountered in reality."
+ | poker stack old new x y top x1 x2 dy left goRight |
- | peeker poker stack old new x y top x1 x2 dy left goRight |
- peeker := BitBlt bitPeekerFromForm: self.
poker := BitBlt bitPokerToForm: self.
stack := OrderedCollection new: 50.
"read old pixel value"
+ old := self pixelAt: interiorPoint.
- old := peeker pixelAt: interiorPoint.
"compute new value"
new := self pixelValueFor: aColor.
old = new ifTrue:[^self]. "no point, is there?!!"
x := interiorPoint x.
y := interiorPoint y.
(y >= 0 and:[y < height]) ifTrue:[
stack addLast: {y. x. x. 1}. "y, left, right, dy"
stack addLast: {y+1. x. x. -1}].
[stack isEmpty] whileFalse:[
top := stack removeLast.
y := top at: 1. x1 := top at: 2. x2 := top at: 3. dy := top at: 4.
y := y + dy.
"Segment of scanline (y-dy) for x1 <= x <= x2 was previously filled.
Now explore adjacent pixels in scanline y."
x := x1.
+ [x >= 0 and:[(self pixelAt: x@y) = old]] whileTrue:[
- [x >= 0 and:[(peeker pixelAt: x@y) = old]] whileTrue:[
poker pixelAt: x@y put: new.
x := x - 1].
goRight := x < x1.
left := x+1.
(left < x1 and:[y-dy >= 0 and:[y-dy < height]])
ifTrue:[stack addLast: {y. left. x1-1. 0-dy}].
goRight ifTrue:[x := x1 + 1].
[
goRight ifTrue:[
+ [x < width and:[(self pixelAt: x@y) = old]] whileTrue:[
- [x < width and:[(peeker pixelAt: x@y) = old]] whileTrue:[
poker pixelAt: x@y put: new.
x := x + 1].
(y+dy >= 0 and:[y+dy < height])
ifTrue:[stack addLast: {y. left. x-1. dy}].
(x > (x2+1) and:[y-dy >= 0 and:[y-dy >= 0]])
ifTrue:[stack addLast: {y. x2+1. x-1. 0-dy}]].
+ [(x := x + 1) <= x2 and:[(self pixelAt: x@y) ~= old]] whileTrue.
- [(x := x + 1) <= x2 and:[(peeker pixelAt: x@y) ~= old]] whileTrue.
left := x.
goRight := true.
x <= x2] whileTrue.
].
!
Item was changed:
----- Method: Form>>pixelValueAt: (in category 'pixel access') -----
pixelValueAt: aPoint
"Return the raw pixel value at the given point. This pixel value depends on the receiver's depth. Typical clients use colorAt: to get a Color. "
+ ^ self primPixelValueAtX: aPoint x y: aPoint y!
- ^ (BitBlt bitPeekerFromForm: self) pixelAt: aPoint
- !
Item was changed:
----- Method: Form>>primPixelValueAtX:y: (in category 'pixel access') -----
primPixelValueAtX: x y: y
+ "Return the raw pixel value at the given point. This pixel value depends on the receiver's depth. Typical clients use colorAt: to get a Color. Make sure the colorMap is nil for ColorForms "
- "Return the raw pixel value at the given point. This pixel value depends on the receiver's depth. Typical clients use colorAt: to get a Color. "
<primitive: 'primitivePixelValueAt' module:'PixelValuePeekPlugin'>
+ ^(BitBlt bitPeekerFromForm: self) colorMap: nil; pixelAt: x@y!
- ^(BitBlt bitPeekerFromForm: self) pixelAtX: x y: y!
Item was changed:
----- Method: PNMReadWriter>>nextPutGray: (in category 'writing') -----
nextPutGray: aForm
+ | myType val |
- | myType peeker val |
cols := aForm width.
rows := aForm height.
depth := aForm depth.
"stream position: 0."
aForm depth = 1 ifTrue:[myType := $4] ifFalse:[myType := $5].
self writeHeader: myType.
- peeker := BitBlt bitPeekerFromForm: aForm.
0 to: rows-1 do: [:y |
0 to: cols-1 do: [:x |
+ val := aForm pixelAt: x@y.
- val := peeker pixelAt: x@y.
stream nextPut: val.
]
].
!
Item was changed:
----- Method: PNMReadWriter>>nextPutRGB: (in category 'writing') -----
nextPutRGB: aForm
+ | myType f shift mask |
- | myType peeker f shift mask |
cols := aForm width.
rows := aForm height.
depth := aForm depth.
f := aForm.
depth < 16 ifTrue:[
f := aForm asFormOfDepth: 32.
depth := 32.
].
myType := $6.
"stream position: 0."
self writeHeader: myType.
depth = 32 ifTrue:[shift := 8. mask := 16rFF] ifFalse:[shift := 5. mask := 16r1F].
- peeker := BitBlt bitPeekerFromForm: f.
0 to: rows-1 do: [:y |
0 to: cols-1 do: [:x | | p r g b |
+ p := f pixelAt: x@y.
- p := peeker pixelAt: x@y.
b := p bitAnd: mask. p := p >> shift.
g := p bitAnd: mask. p := p >> shift.
r := p bitAnd: mask.
stream nextPut: r.
stream nextPut: g.
stream nextPut: b.
]
].
!
Item was changed:
----- Method: Pen>>print:withFont: (in category 'operations') -----
print: str withFont: font
"Print the given string in the given font at the current heading"
| lineStart scale wasDown |
scale := sourceForm width.
wasDown := penDown.
lineStart := location.
str do:
[:char |
char = Character cr ifTrue:
[self place: lineStart; up; turn: 90; go: font height*scale; turn: -90; down]
ifFalse:
+ [ | charStart pix rowStart form backgroundCode |
- [ | charStart pix rowStart form bb backgroundCode |
form := font characterFormAt: char.
backgroundCode := 1<< (form depth // 3 * 3) - 1.
charStart := location.
wasDown ifTrue: [
self up; turn: -90; go: font descent*scale; turn: 90; down.
0 to: form height-1 do:
[:y |
rowStart := location.
- bb := BitBlt bitPeekerFromForm: form.
pix := RunArray newFrom:
+ ((0 to: form width-1) collect: [:x | form pixelAt: x@y]).
- ((0 to: form width-1) collect: [:x | bb pixelAt: x@y]).
pix runs with: pix values do:
[:run :value |
value = backgroundCode
ifTrue: [self up; go: run*scale; down]
ifFalse: [self go: run*scale]].
self place: rowStart; up; turn: 90; go: scale; turn: -90; down].
].
self place: charStart; up; go: form width*scale; down].
].
wasDown ifFalse: [self up]
"
Display restoreAfter:
[Pen new squareNib: 2; color: Color red; turn: 45;
print: 'The owl and the pussycat went to sea
in a beautiful pea green boat.' withFont: TextStyle defaultFont]
"!
Item was changed:
----- Method: WarpBlt>>warpBitsSmoothing:sourceMap: (in category 'primitives') -----
warpBitsSmoothing: n sourceMap: sourceMap
+ | deltaP12 deltaP43 pA pB deltaPAB sp fixedPtOne poker pix nSteps |
- | deltaP12 deltaP43 pA pB deltaPAB sp fixedPtOne picker poker pix nSteps |
<primitive: 'primitiveWarpBits' module: 'BitBltPlugin'>
"Check for compressed source, destination or halftone forms"
((sourceForm isForm) and: [sourceForm unhibernate])
ifTrue: [^ self warpBitsSmoothing: n sourceMap: sourceMap].
((destForm isForm) and: [destForm unhibernate])
ifTrue: [^ self warpBitsSmoothing: n sourceMap: sourceMap].
((halftoneForm isForm) and: [halftoneForm unhibernate])
ifTrue: [^ self warpBitsSmoothing: n sourceMap: sourceMap].
(width < 1) | (height < 1) ifTrue: [^ self].
fixedPtOne := 16384. "1.0 in fixed-pt representation"
n > 1 ifTrue:
[(destForm depth < 16 and: [colorMap == nil])
ifTrue: ["color map is required to smooth non-RGB dest"
^ self primitiveFail].
pix := Array new: n*n].
nSteps := height-1 max: 1.
deltaP12 := (self deltaFrom: p1x to: p2x nSteps: nSteps)
@ (self deltaFrom: p1y to: p2y nSteps: nSteps).
pA := (self startFrom: p1x to: p2x offset: nSteps*deltaP12 x)
@ (self startFrom: p1y to: p2y offset: nSteps*deltaP12 y).
deltaP43 := (self deltaFrom: p4x to: p3x nSteps: nSteps)
@ (self deltaFrom: p4y to: p3y nSteps: nSteps).
pB := (self startFrom: p4x to: p3x offset: nSteps*deltaP43 x)
@ (self startFrom: p4y to: p3y offset: nSteps*deltaP43 y).
- picker := BitBlt bitPeekerFromForm: sourceForm.
poker := BitBlt bitPokerToForm: destForm.
poker clipRect: self clipRect.
nSteps := width-1 max: 1.
destY to: destY+height-1 do:
[:y |
deltaPAB := (self deltaFrom: pA x to: pB x nSteps: nSteps)
@ (self deltaFrom: pA y to: pB y nSteps: nSteps).
sp := (self startFrom: pA x to: pB x offset: nSteps*deltaPAB x)
@ (self startFrom: pA y to: pB y offset: nSteps*deltaPAB x).
destX to: destX+width-1 do:
[:x |
n = 1
ifTrue:
[poker pixelAt: x@y
+ put: (sourceForm pixelAt: sp // fixedPtOne asPoint)]
- put: (picker pixelAt: sp // fixedPtOne asPoint)]
ifFalse:
[0 to: n-1 do:
[:dx | 0 to: n-1 do:
[:dy |
pix at: dx*n+dy+1 put:
+ (sourceForm pixelAt: sp
- (picker pixelAt: sp
+ (deltaPAB*dx//n)
+ (deltaP12*dy//n)
// fixedPtOne asPoint)]].
poker pixelAt: x@y put: (self mixPix: pix
sourceMap: sourceMap
destMap: colorMap)].
sp := sp + deltaPAB].
pA := pA + deltaP12.
pB := pB + deltaP43]!
tim Rowledge uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-tpr.520.mcz
==================== Summary ====================
Name: System-tpr.520
Author: tpr
Time: 25 March 2013, 2:19:09.759 pm
UUID: 54ea34c3-dcaa-4fc2-a560-98bcfb5cc5f7
Ancestors: System-fbs.519
Remove BitBlt|WarpBlt>current usage - it's a vestige of an old experiment
=============== Diff against System-fbs.519 ===============
Item was changed:
----- Method: Project>>makeThumbnail (in category 'menu messages') -----
makeThumbnail
"Make a thumbnail image of this project from the Display."
viewSize ifNil: [viewSize := Display extent // 8].
thumbnail := Form extent: viewSize depth: Display depth.
+ (WarpBlt toForm: thumbnail)
- (WarpBlt current toForm: thumbnail)
sourceForm: Display;
cellSize: 2; "installs a colormap"
combinationRule: Form over;
copyQuad: (Display boundingBox) innerCorners
toRect: (0@0 extent: viewSize).
(Smalltalk at: #InternalThreadNavigationMorph) ifNotNil: [:tnMorph |
tnMorph cacheThumbnailFor: self].
^thumbnail
!