> Maarten, > > Point taken, I have no idea how the fonts will map exactly when > libgdiplus from Mono is used. > > One API for doing graphics is highly desirable to me as well. I have > a bunch of code in VW and a lot in C++. Adding GDI+ to both allows > me to get rid of the VW graphicscontext calls and the Win32 GDI and > MFC stuff. It is also a rather straightforward task. And there are > many books on GDI+ as well that show how to do nice things. > > Paul > >> The thing you describe becomes more of a write many times deploy >> once thing. >> Are you using the VW context And the Cairo Context And the GDI+ >> context ? >> >> When making scaled WYSIWYG pdf documents with Cairo, I allready run >> into problems when fonts in VW's widgets when do >> not match exactly the Cairo fhttp://webmail1g.orange.fr/webmail/ >> fr_FR/write.html#ont widths. So personnally I am >> awaiting the day that all can be done within the same API. >> >> The Guys from Cairo however very often discuss performance issues, >> so if I where you I would first checkout and >> verify that it cannot be done in a different Cairo Way. >> >> If I understand the explanations on multi platform font systems, I >> understand that there are not so many >> alternatives to Cairo and Pango. >> >> Regards, >> >> @Maarten, >> >> >>> Message du 12/07/10 14:27 >>> De : "Paul Weustink" >> >>> A : "Mark Plas" >>> Copie à : "VWNC List" >>> Objet : Re: [vwnc] [cairo] Text display tuning question >>> >>> Hi Mark, >>> >>> There is no package , I did start with the WinGDIPlusInterface >>> from the >>> repository. Added the missing Gdip functions by changing the >>> gdiplusflat.h file a bit (basically fixing errors from MS and some >>> typedefs of structs) and parse it with the DLLCC tools. >>> >>> The nice objects from C++ like Graphics, Pen, Brush, Font, etc are >>> still >>> lacking, but the flat functions work fine. >>> >>> Perhaps, if someone is interested, we could update the package in >>> the >>> repository with the new stuff? >>> Actually I asked earlier if someone did some work on GDI+ already, >>> no >>> answers so I wonder who uses it? >>> >>> Paul >>> >>> On 12-7-2010 13:54, Mark Plas wrote: >>>> >>>> Hi Paul, >>>> >>>> Where did you get the package containing the gdiplusflat.h api? >>>> It's >>>> not the WinGDIPlusInterface from the public repository I believe? >>>> >>>> Mark >>>> >>>> *From:* Paul Weustink [mailto:[hidden email]] >>>> *Sent:* maandag 12 juli 2010 12:26 >>>> *To:* Mark Plas >>>> *Cc:* VWNC List >>>> *Subject:* Re: [vwnc] [cairo] Text display tuning question >>>> >>>> Mark, >>>> >>>> I've tried your example with GDI+ and direct screen output (so >>>> without >>>> the pixmap). >>>> These are my results (on a Pentium4 with XP-SP3): >>>> >>>> VW7 530 ms (your example without pixmap >>>> buffering) >>>> GDI+ 1093 ms >>>> GDI+ smooth 880 ms (anti-alias style font rendering) >>>> GDI+ cleartype 1120 ms (clear-type style font rendering) >>>> >>>> Better than I expected. This is the code I used: >>>> >>>> | view x y gc graphics interface symbols aTime namePtr >>>> fontFamilyPtr fontFamily >>>> fontPtr font brushPtr brush stringPtr string rectPtr| >>>> >>>> view := ScheduledControllers activeController view. >>>> gc := view graphicsContext. >>>> symbols := ByteSymbol allInstances select: [:each | each size > 1]. >>>> >>>> gc medium gdiGraphicsPtrDo: [:graphicsPtr | >>>> graphics := graphicsPtr contents. >>>> interface := WinGDIPlusInterface current. >>>> "interface GdipSetTextRenderingHint: graphics with: 4." >>>> "try 1, 4, or 5" >>>> >>>> aTime := Time millisecondsToRun: [ >>>> 10 timesRepeat: [ >>>> x := 0. >>>> y := 0. >>>> >>>> namePtr := 'Arial' asTwoByteString gcCopyToHeapUnicode. >>>> fontFamilyPtr := interface GpFontFamily gcMalloc. >>>> interface GdipCreateFontFamilyFromName: namePtr with: >>>> 0 with: fontFamilyPtr. >>>> fontFamily := fontFamilyPtr contents. >>>> >>>> fontPtr := interface GpFont gcMalloc. >>>> interface GdipCreateFont: fontFamily with: 12 with: 0 >>>> with: 0 with: fontPtr. >>>> font := fontPtr contents. >>>> >>>> brushPtr := interface GpBrush gcMalloc. >>>> interface GdipCreateSolidFill: 16rFF000000 with: >>>> brushPtr. "ARGB color" >>>> brush := brushPtr contents. >>>> >>>> 1 to: 1300 do: [:i | >>>> interface GdipSetClipRectI: graphics with: x with: >>>> y with: (view width // 17) with: 18 with: 0. >>>> >>>> string := (symbols at: i) asString asTwoByteString. >>>> stringPtr := string gcCopyToHeapUnicode. >>>> rectPtr := interface RectF gcCalloc. >>>> rectPtr memberAt: #X put: x. >>>> rectPtr memberAt: #Y put: y. >>>> interface GdipDrawString: graphics with: stringPtr >>>> with: string size with: font with: rectPtr with: 0 with: brush. >>>> >>>> x := x + (view width // 17). >>>> x > view width ifTrue: [ >>>> x := 0. >>>> y := y + 18. >>>> ]. >>>> ]. >>>> >>>> interface GdipDeleteBrush: brush. >>>> interface GdipDeleteFont: font. >>>> interface GdipDeleteFontFamily: fontFamily. >>>> ]. >>>> ]. >>>> ]. >>>> aTime inspect. >>>> >>>> Notes: >>>> - GDI+ also introduces classes that wrap the native "flat" Gdip* >>>> functions into nice objects. >>>> I did not port these classes from C++ yet, since they are not >>>> needed >>>> to use the gdiplus.dll. >>>> - This code works on any Windows platform. If your OS is before XP >>>> please download the gdiplus.dll >>>> from the microsoft site. >>>> - There exists a Mono open-source project that also has an >>>> implementation of GDI+ using Cairo, >>>> perhaps this can be used for Linux and Mac? >>>> >>>> Paul Weustink >>>> >>>> >>>> On 7-7-2010 22:14, Mark Plas wrote: >>>> >>>> Hi, >>>> >>>> How can I get the displaying of text in Cairo faster? Compared to >>>> displaying text using the standard VW GraphicsContext, Cairo >>>> appears >>>> to be around 7x slower. >>>> >>>> Below are two scripts that can be run from a workspace. I first >>>> maximize the workspace window and then I run it. The scripts >>>> display >>>> 1300 strings on screen (1900x1200 pixels in my case) in a gridlike >>>> fashion and repeat this 10x. I use double buffering for both >>>> versions >>>> with the GraphicsContext version drawing on a Pixmap and the Cairo >>>> version using #groupWhile: []. >>>> >>>> Running the GraphicsContext version takes about 290ms on my >>>> computer. >>>> With Cairo it takes 2050ms. That's 7x slower! Using Pango (not >>>> shown >>>> here) it's about the same performance as Cairo's #showText. >>>> >>>> In an application that shows lots of data in grid, scrolling page >>>> by >>>> page through the data really is sluggish when it's being displayed >>>> using Cairo. >>>> >>>> How can I improve this? >>>> >>>> Thanks, >>>> >>>> Mark >>>> >>>> Here are the scripts: >>>> >>>> GraphicsContext version: >>>> >>>> | view gc x y | >>>> >>>> view := ScheduledControllers activeController view. >>>> >>>> thePixmap := Pixmap extent: view extent. >>>> >>>> gc := thePixmap graphicsContext. >>>> >>>> symbols := ByteSymbol allInstances select: [:each | each size > 1]. >>>> >>>> Time millisecondsToRun: >>>> >>>> [10 timesRepeat: >>>> >>>> [x := 0. >>>> >>>> y := 0. >>>> >>>> gc >>>> font: ((FontDescription new) >>>> >>>> >>>> family: 'Arial'; >>>> >>>> >>>> pixelSize: 12). >>>> >>>> 1 to: 1300 >>>> >>>> >>>> do: >>>> >>>> >>>> [:i | >>>> >>>> >>>> gc clippingRectangle: (x @ y extent: (view width // 17) @ 18). >>>> >>>> >>>> gc displayString: (symbols at: i) at: x @ y + 16. >>>> >>>> >>>> x := x + (view width // 17). >>>> >>>> >>>> x > view width >>>> >>>> >>>> ifTrue: >>>> >>>> >>>> [x := 0. >>>> >>>> >>>> y := y + 18]]. >>>> >>>> >>>> thePixmap displayOn: view graphicsContext. >>>> >>>> view >>>> flush]] >>>> >>>> Cairo version: >>>> >>>> | view gc x y | >>>> >>>> view := ScheduledControllers activeController view. >>>> >>>> gc := view graphicsContext. >>>> >>>> symbols := ByteSymbol allInstances select: [:each | each size > 1]. >>>> >>>> Time millisecondsToRun: >>>> >>>> [10 timesRepeat: >>>> >>>> [gc >>>> newCairoContextWhile: >>>> >>>> >>>> [:cr | >>>> >>>> >>>> x := 0. >>>> >>>> >>>> y := 0. >>>> >>>> >>>> cr selectFontFace: 'Arial'. >>>> >>>> >>>> cr fontSize: 10. >>>> >>>> >>>> cr groupWhile: >>>> >>>> >>>> [1 to: 1300 >>>> >>>> >>>> do: >>>> >>>> >>>> [:i | >>>> >>>> >>>> cr resetClip. >>>> >>>> >>>> cr rectangle: (x @ y extent: (view width // 17) @ 18). >>>> >>>> >>>> cr clip. >>>> >>>> >>>> cr moveTo: x @ (y + 16). >>>> >>>> >>>> cr showText: (symbols at: i). >>>> >>>> >>>> x := x + (view width // 17). >>>> >>>> >>>> x > view width >>>> >>>> >>>> ; ifTrue: >>>> >>>> >>>> ; [x := 0. >>>> >>>> >>>> ; y := y + 18]]]. >>>> >>>> >>>> cr paint]]] >>>> >>>> >>>> >>>> _______________________________________________ >>>> vwnc mailing list >>>> [hidden email] >>>> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc >>>> >>>> >>> >>> >>> >>> [ (pas de nom de fichier) (0.1 Ko) ] >> >> >> >> _______________________________________________ >> vwnc mailing list >> [hidden email] >> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Free forum by Nabble | Edit this page |