Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004481 [Squeak] Morphic minor always 08-11-06 10:11 08-11-06 10:15
Reporter wiz View Status public  
Assigned To
Priority normal Resolution open  
Status new   Product Version 3.9
Summary 0004481: When polygons, bitmapfills and rounded corners do not mix.
Description Demonstrating this one took some doing in a workspace
evaluate:rect := (RectangleMorph new cornerStyle: #rounded) openCenteredInWorld .

(poly := PolygonMorph vertices: rect bounds corners
                color: Color orange
                borderWidth: 0
                borderColor: Color black)
                fillStyle:( (BitmapFillStyle fromForm: rect imageForm) origin: rect position) ;
                openInWorld ;
                position: poly position + 50 asPoint .
                
rect := (RectangleMorph new cornerStyle: #squared) openCenteredInWorld color: Color cyan .

(poly := PolygonMorph vertices: rect bounds corners
                color: Color orange
                borderWidth: 0
                borderColor: Color black)
                fillStyle:( (BitmapFillStyle fromForm: rect imageForm) origin: rect position) ;
                openInWorld ;
                position: poly position + 50 asPoint .


Try picking up the morphs from their center. Three of them will lift.

The one that won't pay any attention to the hand is the polygon with the fill of the rounded rectangle.
Additional Information Polygons will not contain points when they are transparent.
Bitmapfills answer asColor with the color at the topLeft pixel.
The image form of a morph with rounded corners has...

... (yes you guessed it) a transparent pixel at its top left corner.

You can pick up the polygon by lifting at the edges. You can even pick it up by moving the corner over the invisible transparent pixels in its rounded corners. You can not pick it up from the middle . indeed you can not interact with it in the middle.


There seems to me to be more than one bug or sad implementation here.

The largest bug belongs to polygon contains point. And I think it must bear the responsibility of finding a better way to do its job.

There is a sad implementation in BitMapFillStyle asColor. Since samplng a corner will in general not be representative of the color.
Better might be to sample the center of its form. Or just use the forms dominant color. This will give a better guess.

I have uploaded the BitmapFillStyle>>asColor method changed to use the forms dominant color. This actually solved the problem in the application I was trying to make work..

Yours in service, --Jerome Peace

Attached Files  BitmapFillStyle.wiz.1.cs [^] (214 bytes) 08-11-06 10:11
 IntegrationBug.text [^] (714 bytes) 08-11-06 10:12

- Relationships

- Notes
(0006488 - 141 - 147 - 147 - 147 - 147 - 147)
wiz
08-11-06 10:15

IntegrationBug.text is a copy of the problem description doit saved from the workspace I used for testing.
Yours in Service, -- Jerome Peace
 

- Issue History
Date Modified Username Field Change
08-11-06 10:11 wiz New Issue
08-11-06 10:11 wiz File Added: BitmapFillStyle.wiz.1.cs
08-11-06 10:12 wiz File Added: IntegrationBug.text
08-11-06 10:15 wiz Note Added: 0006488


Mantis 1.0.8[^]
Copyright © 2000 - 2007 Mantis Group
35 total queries executed.
26 unique queries executed.
Powered by Mantis Bugtracker