Hello all, and especially Andy,
I'm about to rush in where angels fear to tread, and have a couple of questions, one more concrete than the other: (1) Do you know what causes an image created on the fly to not display in an ImagePresenter, or maybe have a fix that can move from D5 back to D4? It's not a big deal, because a tweak of my existing workaround will suffice. The sample below displays a blue rectangle in my hacked presenter and nothing in the ImagePresenter. | bitmap canvas | bitmap := Bitmap compatible:Canvas forDesktop extent:200@100. canvas := bitmap canvas. canvas fillRectangle:(Point zero extent:200@100) brush:(Brush color:Color blue). ImagePresenter showOn:bitmap asValue. ImageValuePresenter showOn:bitmap asValue. Again, not a big deal, but I thought I should at least mention it. (2) The next question is one that I've tried to phrase many times and never seem to do a very good job. Here's another shot at it: re comparison policies for value models, do they exist to "damp" what might otherwise be a continuing chain reaction of triggers and changes? Or, is it more for efficiency? I'll stop there to see if that resonates. Anything you'd like to correct or add to it? Making a long story short, my Win98 server is filling up, can't hold another disk, and the Win2k replacement is on order - time for PenWindows to go, and I'm hoping to do it at least sorta right this time :) Have a good one, Bill -- Wilhelm K. Schwab, Ph.D. [hidden email] |
Bill
I'll answer for the bug. You wrote in message news:9serm4$12v5pn$[hidden email]... > Hello all, and especially Andy, > > I'm about to rush in where angels fear to tread, and have a couple of > questions, one more concrete than the other: > > (1) Do you know what causes an image created on the fly to not display in an > ImagePresenter, or maybe have a fix that can move from D5 back to D4? It's > not a big deal, because a tweak of my existing workaround will suffice. The > sample below displays a blue rectangle in my hacked presenter and nothing in > the ImagePresenter. > > | bitmap canvas | > bitmap := Bitmap compatible:Canvas forDesktop extent:200@100. > canvas := bitmap canvas. > canvas fillRectangle:(Point zero extent:200@100) brush:(Brush color:Color > blue). > ImagePresenter showOn:bitmap asValue. > ImageValuePresenter showOn:bitmap asValue. > > Again, not a big deal, but I thought I should at least mention it. It is because the Bitmap is selected into a DC (it caches its canvas) and the control underlying StaticBitmap presumably then tries to select it into another canvas which fails since a bitmap can only be selected into one DC at a time (I think). Anyway this should work: | bitmap canvas | bitmap := Bitmap compatible:Canvas forDesktop extent:200@100. canvas := bitmap canvas. canvas fillRectangle:(Point zero extent:200@100) brush:(Brush color:Color blue). bitmap freeDC. ImagePresenter showOn: bitmap. This has been fixed "in general" in D5 (a similar issue exists with adding bitmaps into image lists). The D4 workaround of sending #freeDC before adding the bitmap will have no adverse effect in 5 (although obviously one needs to be aware that one may be freeing a DC that someone else may still be hanging onto). Alternatively the "Basic image" view of ImagePresenter (an ImageView, which is implemented entirely in Smalltalk) will work without the #freeDC, and is more flexible than the static bitmap control, both in terms of what it can display and whether and how the bitmap is stretched to fit. Regards Blair |
Blair,
> Anyway this should work: > > | bitmap canvas | > bitmap := Bitmap compatible:Canvas forDesktop extent:200@100. > canvas := bitmap canvas. > canvas fillRectangle:(Point zero extent:200@100) brush:(Brush > color:Color blue). > bitmap freeDC. > ImagePresenter showOn: bitmap. It works. > This has been fixed "in general" in D5 (a similar issue exists with adding > bitmaps into image lists). Out of curiousity, how did you fix it? > The D4 workaround of sending #freeDC before > adding the bitmap will have no adverse effect in 5 (although obviously one > needs to be aware that one may be freeing a DC that someone else may still > be hanging onto). Alternatively the "Basic image" view of ImagePresenter (an > ImageView, which is implemented entirely in Smalltalk) will work without the > #freeDC, and is more flexible than the static bitmap control, both in terms > of what it can display and whether and how the bitmap is stretched to fit. "Basic image" works too (without the #freeDC), and with the #normal view mode, does what I need in this situation. Thanks! Bill -- Wilhelm K. Schwab, Ph.D. [hidden email] |
Free forum by Nabble | Edit this page |