locked
WPF image ellipse RRS feed

  • Question

  • Hello, I need a little guidance. I'm trying to create an image in the shape of an ellipse.
    To retrieve the image using CachedImage. The problem occurs if the source image format other than 1:1 should be 16:9 or 4:3. So the resulting image is not centered. see figure below:

    I need something like this:

    I tried to solve it yet but that's not it. Here is my current status of a The source code:

      <Grid Width="100" Height="100">
                <cachedImage:Image Stretch="UniformToFill" 
                               SnapsToDevicePixels="True"
                               RenderOptions.BitmapScalingMode="HighQuality"    
                               ImageUrl="https://i.scdn.co/image/f328553af6ac1d0ad313fa49fa8c4093031e55df" >
                    <Image.Clip>
                        <EllipseGeometry Center="50,50" RadiusX="50" RadiusY="50" />
                    </Image.Clip>
                </cachedImage:Image>
       </Grid>

    Thanks for any advice.

    Monday, August 29, 2016 6:59 PM

Answers

  • If there is an issue with the CachedImage control you should contact the creator of this library directly or report it at GitHub:
    https://github.com/floydpink/CachedImage/issues
    http://floydpink.github.io/CachedImage/

    These forums are intended for Microsoft's own products and technologies only. Please don't ask questions about third-party software in these forums.

    Please provide a full reproducible sample that doesn't involves any third-party controls for further help. 

    Hope that helps and thanks for your understanding.

    Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. Please don't ask several questions in the same thread.

    • Proposed as answer by DotNet Wang Sunday, September 4, 2016 3:43 AM
    • Marked as answer by DotNet Wang Wednesday, September 7, 2016 2:39 AM
    Wednesday, August 31, 2016 7:16 PM

All replies

  • Now I tried this and it works, but again I trimmed edges

    <Grid Width="100" Height="100">
        <Grid Width="200" HorizontalAlignment="Center">
            <cachedImage:Image Stretch="Uniform"
                   SnapsToDevicePixels="True"
                   RenderOptions.BitmapScalingMode="HighQuality"  
                   ImageUrl="https://i.scdn.co/image/f8ac6f7e92941d5afe6fe610e55df046995bd8bd"/>
        </Grid>
        <Grid.Clip>
            <EllipseGeometry Center="50,50" RadiusX="50" RadiusY="50" />
        </Grid.Clip>
    </Grid>
    

    Monday, August 29, 2016 7:48 PM
  • When I remove the cachedImage I get no problems.  Don't know what it is so can't test with it.

    When you use just Image you use Source property to indicate the image to use.


    Lloyd Sheen

    Monday, August 29, 2016 10:47 PM
  • If there is an issue with the CachedImage control you should contact the creator of this library directly or report it at GitHub:
    https://github.com/floydpink/CachedImage/issues
    http://floydpink.github.io/CachedImage/

    These forums are intended for Microsoft's own products and technologies only. Please don't ask questions about third-party software in these forums.

    Please provide a full reproducible sample that doesn't involves any third-party controls for further help. 

    Hope that helps and thanks for your understanding.

    Please remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. Please don't ask several questions in the same thread.

    • Proposed as answer by DotNet Wang Sunday, September 4, 2016 3:43 AM
    • Marked as answer by DotNet Wang Wednesday, September 7, 2016 2:39 AM
    Wednesday, August 31, 2016 7:16 PM