On 7 January 2014 19:25, J.F. Rick <s...@je77.com> wrote: > On Tue, Jan 7, 2014 at 11:22 AM, Igor Stasenko <siguc...@gmail.com> wrote: > >> Right. Converting Form(s) to paint(s) is memory intensive operation. >> Basically, it copies contents of the form to newly created surface. >> To avoid this, use caching. Here is an example from ImageMorph: >> >> drawOnAthensCanvas: aCanvas >> >> | cached | >> >> cached := aCanvas cacheAt: image ifAbsentPut: [ >> image asAthensPaintOn: aCanvas. >> ]. >> >> aCanvas setPaint: cached. >> >> aCanvas paintTransform restoreAfter: [ >> aCanvas paintTransform translateBy: self innerBounds origin >> "negated". >> >> aCanvas drawShape: self innerBounds. >> ]. >> >> without caching, rendering morphic desktop was very slow, since all icons >> is forms. >> > > Yes. I had figured that out. Unfortunately, even with cacheing, it was > slow after enough images were open. It could be that, for whatever reason, > my cacheing code is not working, but I doubt it. It looks pretty exactly > like that. > > what object you using as a key for cache? because if its temporary object, then its useless.
> >> Anyway, for most of my applications, switching over to vector-based >>> graphics would be a better choice as it would allow for me to more easily >>> scale to different screen sizes. So, I was excited to try the SVG import. >>> Now that the XMLParser is working, I am running into some problems with the >>> SVG import code. It seems that it doesn't support some of the features that >>> an SVG export from Illustrator produces. I was wondering if I could get >>> some help there. >>> >>> First, Illustrator tends to spit out SVGs that use #reflectedCubicBezier >>> curves, which is not yet implemented. >>> >>> Second, I found a small bug in ASPathConverter>>readPoint The "self >>> skipBlanks" has to be changed to "self skipBlanksAndComma" or multiple >>> points cannot be read in sequence. >>> >>> Can you submit the fix, please? Let me know if you need commit rights . >> > > Thanks. I'd love to contribute. My SmalltalkHub Id is JochenRick. > > Okay, i added you. Wellcome. > Third, while ASPathConverter supports vLineTo: and hLineTo:, >>> AthensCairoPathBuilder does not. I tried implementing these myself but they >>> apparently don't work the way I thought they should. >>> >> >> should be straightforward: >> >> vLineTo: number >> ^ self lineTo: (absolute ifTrue: [ endPoint x@number ] ifFalse: [ >> 0@number ]) >> >> hLineTo: number >> ^ self lineTo: (absolute ifTrue: [ number@endPoint y ] ifFalse: [ >> number@0 ]) >> > > Great. Works like a charm. The swap shapes one now works fine. I can also > include that in a commit. > > >> >> >> >>> >>> Here are two examples of the kind of SVG files I would like to read: >>> button-swapShapes.svg<http://home.cc.gatech.edu/je77/uploads/1/button-swapShapes.svg> >>> - >>> This one fails because of vLineTo: and hLineTo: >>> button-erase.svg<http://home.cc.gatech.edu/je77/uploads/1/button-erase.svg> >>> - >>> This one fails because of reflectedCubicBezier curves. >>> >>> You mean this one?: >> >> >> *S/s * (shorthand/smooth CurveTo) >> >> x2,y2 >> x, y >> >> Draw a cubic Beizer curve from the current point to (x,y). The first >> control point is assumed to be the reflection of the second control point >> (x2, >> y2) on the previous command relative to the current point. >> >> Yes. Not supported. Yet :) >> But it should be quite easy to implement. >> Jochen, i need help with completing SVG importer. So, if you can help, >> please do. >> >> Can you tell me what is your login name on smalltalkhub, so i will add >> you to >> http://smalltalkhub.com/#!/~Pharo/Athens >> committers? >> >> >> > Thanks. I'd love to contribute. My SmalltalkHub Id is JochenRick. I can > take a shot at implementing the S/s thing. If you have any URLs that would > be helpful for getting started, please send them my way. Otherwise, I'll > just try to find some documentation on Cairo and SVG. That seems like the > major obstacle. > > I use W3C/SVG.. i don't think there's any better/more complete and more comprehensive source than official one :) http://www.w3.org/TR/SVG11/ Cheers, > > Jeff > > PS I know my name is confusing. My surname is Rick. My forename is Jochen, > but I go by Jeff for English speaking people. > > hehe.. i typed Jeff at first, but then looked at your profile picture which says 'Jochen Rick' and corrected it :) > > > -- > Jochen "Jeff" Rick, Ph.D. > http://www.je77.com/ > Skype ID: jochenrick > -- Best regards, Igor Stasenko.