Hi,
I'm using a image presenter and I find Gdiplus particularly interesting because of the uality of the interpolation. It happens to me, using #viewMode: #scaleToFit, that when I maximize and then restore the window, when the image is wider than taller, the parts without image (those boxes on the window that are not a proportional part of the box of the resized image) are maintaining the parts of the previous maximized image. I can manually send to the presenter #hide and the #show to solve that, but I was unable to find a way to put those messages in a convinient place. thanks for any help, Sebsatian |
Sebastián,
> It happens to me, using #viewMode: #scaleToFit, that when I maximize > and then restore the window, when the image is wider than taller, the > parts without image (those boxes on the window that are not a > proportional part of the box of the resized image) are maintaining the > parts of the previous maximized image. That seems to be a bug somewhere in D6. In D5, you can avoid that behaviour by setting the view's #isEraseBackground to true, /and/ the #backcolor to something non-nil So the following works OK in D5. f := 'C:\someFile.jpg'. i := GdiplusImage fromFile: f. p := ImagePresenter show: 'Gdiplus view' on: i. (p view) backcolor: (Color yellow fadedBy: 4); isEraseBackground: true; viewMode: #scaleBestFit; invalidate. The view erases itself as you change the size or maximise it. But that doesn't work under D6. I don't know why, but one hint is that the view doesn't seem to have passed its background color to the underlying control. -- chris |
As you said, it does not work for me in D6. It seems to behave
correctly when reducing size but not for increasing it. I opted for a less elegant solution putting this loose method: GdiplusImageView>>onPositionChanged: aPositionEvent "Private - Handle a window position change event (move or resize)." aPositionEvent isResize ifTrue:[self hide; show]. ^super onPositionChanged: aPositionEvent cheers, Sebastian Chris Uppal escreveu: > Sebastián, > > > It happens to me, using #viewMode: #scaleToFit, that when I maximize > > and then restore the window, when the image is wider than taller, the > > parts without image (those boxes on the window that are not a > > proportional part of the box of the resized image) are maintaining the > > parts of the previous maximized image. > > That seems to be a bug somewhere in D6. > > In D5, you can avoid that behaviour by setting the view's #isEraseBackground to > true, /and/ the #backcolor to something non-nil So the following works OK in > D5. > > f := 'C:\someFile.jpg'. > i := GdiplusImage fromFile: f. > p := ImagePresenter show: 'Gdiplus view' on: i. > (p view) > backcolor: (Color yellow fadedBy: 4); > isEraseBackground: true; > viewMode: #scaleBestFit; > invalidate. > > The view erases itself as you change the size or maximise it. > > But that doesn't work under D6. I don't know why, but one hint is that the > view doesn't seem to have passed its background color to the underlying > control. > > -- chris |
In reply to this post by Chris Uppal-3
"Chris Uppal" <[hidden email]> wrote in message
news:44a9120e$0$778$[hidden email]... > Sebastián, > >> It happens to me, using #viewMode: #scaleToFit, that when I maximize >> and then restore the window, when the image is wider than taller, the >> parts without image (those boxes on the window that are not a >> proportional part of the box of the resized image) are maintaining the >> parts of the previous maximized image. > > That seems to be a bug somewhere in D6. Yes, in GdiplusImageView. The way that control backgrounds are erased was changed and this was not reflected into GdiplusImageView. You can fix this by copying down the View>>onEraseRequired: method, although it will now ignore the isEraseBackground flag. For the forthcoming release we have rationalised things so that ImageView and GdiplusImageView sit under a common abstract superclass. Regards Blair |
Free forum by Nabble | Edit this page |