Quantcast
Channel: WriteableBitmapEx
Viewing all 360 articles
Browse latest View live

Commented Unassigned: segments ends do not match exactly when using drawline [20411]

$
0
0
I am using the drawline primitive to segments of polylines. Somehow the end point of each segment does not exactly match the startpoint of the next segment. This is of course only visible when zooming enough but on my app (routing app) the map is often zoomed in quite deep, so the discrepancies are visible. I have looked into my code several times, and can't find where it is wrong. I have updated to the latest version (1.0.8) but the issue is still there.

Is there any way to fix this?
Comments: ** Comment from web user: El_Tuby **

Hi,

Here is a small project that draw lines from a set of points with double coords. The line ending point does not always matche the starting point of the next line (materialized by a color change and a small circle. On ma machine, You can see this on the center most point.

Also another little issue : is ellipse draw fullu off screen shows up on the side of the drawing.


Commented Unassigned: segments ends do not match exactly when using drawline [20411]

$
0
0
I am using the drawline primitive to segments of polylines. Somehow the end point of each segment does not exactly match the startpoint of the next segment. This is of course only visible when zooming enough but on my app (routing app) the map is often zoomed in quite deep, so the discrepancies are visible. I have looked into my code several times, and can't find where it is wrong. I have updated to the latest version (1.0.8) but the issue is still there.

Is there any way to fix this?
Comments: ** Comment from web user: El_Tuby **

note : I changed after posting one of the points coords from 143+rnd() to -143+rnd() to avoid a line go straight along the edge of the ellipse, make thing not so visible.

Also another little issue : when ellipse is drawn fully off screen, it shows up on the side of the drawing.

(sorry for double posting, but I don't know how to update a comment)

New Post: Is it possible to write text?

$
0
0
Any known solutions for WinRT 8?

New Post: Is it possible to write text?

$
0
0
For Win 8.1 you want to use the RenderTargetBitmap and render a TextBlock to a bitmap. For Win 8.0 it's not possible in a good way.

New Post: Is it possible to write text?

$
0
0
8.0 was my concern. Too bad. Anyway, thanks for the reply. And thank you and the team for all the effort put into this project!

New Post: Merge two images into one

$
0
0
I want to merge two images into one. I read that I should use WriteableBitmapEx library and use blit method. Both of my images are Image type.

So, should I first convert Image type to WriteableBitmap ?
Like this:

    var im1 = image1.ToImage().ToBitmap(); 
    var im2 = image2.ToImage().ToBitmap();
And how can I use method blit now ?

New Post: Merge two images into one

$
0
0
I have been trying to use Blit method like this
BitmapImage image1 = new BitmapImage();
            BitmapImage image2 = new BitmapImage();

            image1 = new BitmapImage(new Uri("/Images/pic1.jpg"));
            image2 = new BitmapImage(new Uri("/Images/pic2.jpg"));

            WriteableBitmap merge1 = new WriteableBitmap(image1);
            WriteableBitmap merge2 = new WriteableBitmap(image2);

            var photo = merge1;
            var frame = merge2;

            var merge = new WriteableBitmap(2048, 1536);

            merge.Blit(new Rect(0, 0, 2048, 1536), photo, new Rect(0, 0, photo.PixelWidth, photo.PixelHeight)); 
            merge.Blit(new Rect(0, 0, 2048, 1536), frame, new Rect(0, 0, frame.PixelWidth, frame.PixelHeight)); 
but im getting error:

Error 5 'System.Windows.Media.Imaging.WriteableBitmap' does not contain a definition for 'Blit' and no extension method 'Blit' accepting a first argument of type 'System.Windows.Media.Imaging.WriteableBitmap' could be found (are you missing a using directive or an assembly reference?)

New Post: Merge two images into one

$
0
0
Well, you have to use this extension library in the right way. Please see the source code samples. There are a few that show how it should be used. Even the project's start site has a sample.

Source code checked in, #105345

$
0
0
* Added Windows 8.1 RenderTargetBitmap support via FromPixelBuffer. For details see http://kodierer.blogspot.com/2013/12/easy-render-writeablebitmapex-with.html

Updated Release: WriteableBitmapEx 1.0.9 (Oct 24, 2012)

$
0
0
This is the final version 1.0 of WriteableBitmapEx with Windows Phone 8 & 7, WPF, WinRT 8 & 8.1 Windows Store XAML and Silverlight support
  • Added Windows 8.1 RenderTargetBitmap support via PixelBuffer
  • Added Windows Phone 8 support and sample
  • Much improved performance for WinRT XAML
  • Bug fixes for alpha blitting, rectangle drawing coordinates and much more

Contains the WriteableBitmapEx binaries for Windows Phone 8 & 7, WPF, WinRT Windows Store XAML and Silverlight. Download the source for the samples.

Blog posts with more details:
http://kodierer.blogspot.com/2013/12/easy-render-writeablebitmapex-with.html

Released: WriteableBitmapEx 1.0.9 (Oct 24, 2012)

$
0
0
This is the final version 1.0 of WriteableBitmapEx with Windows Phone 8 & 7, WPF, WinRT 8 & 8.1 Windows Store XAML and Silverlight support
  • Added Windows 8.1 RenderTargetBitmap support via PixelBuffer
  • Added Windows Phone 8 support and sample
  • Much improved performance for WinRT XAML
  • Bug fixes for alpha blitting, rectangle drawing coordinates and much more

Contains the WriteableBitmapEx binaries for Windows Phone 8 & 7, WPF, WinRT Windows Store XAML and Silverlight. Download the source for the samples.

Blog posts with more details:
http://kodierer.blogspot.com/2013/12/easy-render-writeablebitmapex-with.html
http://kodierer.blogspot.com/2012/10/faster-writeablebitmapex-for-windows.html
http://kodierer.blogspot.com/2012/08/update-writeablebitmapex-for-winrt-rtm.html
http://kodierer.blogspot.com/2012/06/its-alive-writeablebitmapex-10-for.html
http://kodierer.blogspot.de/2012/05/one-bitmap-to-rule-them-all.html

Updated Release: WriteableBitmapEx 1.0.9 (Oct 24, 2012)

$
0
0
This is the final version 1.0 of WriteableBitmapEx with Windows Phone 8 & 7, WPF, WinRT 8 & 8.1 Windows Store XAML and Silverlight support
  • Added Windows 8.1 RenderTargetBitmap support via PixelBuffer
  • Added Windows Phone 8 support and sample
  • Much improved performance for WinRT XAML
  • Bug fixes for alpha blitting, rectangle drawing coordinates and much more

Contains the WriteableBitmapEx binaries for Windows Phone 8 & 7, WPF, WinRT Windows Store XAML and Silverlight. Download the source for the samples.

Blog posts with more details:
http://kodierer.blogspot.com/2013/12/easy-render-writeablebitmapex-with.html
http://kodierer.blogspot.com/2012/10/faster-writeablebitmapex-for-windows.html
http://kodierer.blogspot.com/2012/08/update-writeablebitmapex-for-winrt-rtm.html
http://kodierer.blogspot.com/2012/06/its-alive-writeablebitmapex-10-for.html
http://kodierer.blogspot.de/2012/05/one-bitmap-to-rule-them-all.html

New Post: Using WriteableBitmapEx in Metro C# UI ?

$
0
0
Hi ,
I'm building a metro ui c# and I 'm trying to use the WriteableBitmapEx.
I have an ImageControl in my XAML where I load it from a webservice. Before I load it to the image control I want to be able to draw some rectangles on my Image and then show it.
My question is
How can I draw rectangles in specific coordinates on my Image using writeablebitmapex in Metro?
Appreciate any guidance on this.
thank you

New Post: Using WriteableBitmapEx in Metro C# UI ?

$
0
0
See the samples for details. First use the FromStream method to load the image into a WriteableBitmap, then the method DrawRectangle or FillRectangle.
Even this projects start page has some snippets which show how to use it.
  • rene

New Post: Using WriteableBitmapEx in Metro C# UI ?


New Post: Using WriteableBitmapEx in Metro C# UI ?

$
0
0
Ignore my previous post.
Found it in the source code.
thank you rene

New Post: Draw a rectangle over an image

$
0
0
Hi ,
I'm trying to use the library in a Metro UI C# app.
I have an Image control filled with an image and I'm trying to draw a red rectangle in some x,y coordinates.
I have used so far from the samples the below code
 public WriteableBitmap ParticleBitmap;
Rect sourceRect = new Rect(0, 0, 32, 32);
Target.Source = ParticleBitmap;
   ParticleBitmap = BitmapFactory.New(512, 512);

 using (var bitmapContext = ParticleBitmap.GetBitmapContext())
            {
                // Init some size vars
                int w = ParticleBitmap.PixelWidth - 2;
                int h = ParticleBitmap.PixelHeight - 2;
                int wh = w >> 1;
                int hh = h >> 1;

                //// Clear 
                ParticleBitmap.Clear();

                ParticleBitmap.DrawRectangle(rand.Next(wh), rand.Next(hh), rand.Next(wh, w), rand.Next(hh, h),
                                           Colors.Red);

            }

            // Invalidate
            ParticleBitmap.Invalidate();
So far I can draw the rectangle with the above code and by writing the below
Target.Source = ParticleBitmap;
I can succesfully draw a rectangle.

I have a second image control which contains the original picture.
How am I suppose to take the particlebitmap and display it over my original control ?

I tried to use the blit method but I cannot make it work.
The examples are not compiling.
I tried also the below but nothing happened
ParticleBitmap.Invalidate();
        WriteableBitmap TargetBitmap = BitmapFactory.New(512, 512);

        //Rect sourceRect = new Rect(0, 0, 32, 32);
        Point mypoint;
        mypoint.X = 10;
        mypoint.Y = 20;

        using (TargetBitmap.GetBitmapContext())
        {
            TargetBitmap.Blit(mypoint, ParticleBitmap, sourceRect, Colors.Red, WriteableBitmapExtensions.BlendMode.Additive);

        }

        TargetBitmap.Invalidate();
        Target1.Source = TargetBitmap;
Is there any simple example to draw a rectangle over an image ?

thank you

New Post: How to use writeablebitmapex for windows8 store app (c# metro) on vs2013

$
0
0
Hi all,

I'm trying to use the lib i used on a windows phone 8 app where i appreciated it... But it seems that the project doesn't load the lib and so when i try to write the following code:
        Image uielement = new Image();
        uielement.Stretch = Stretch.Uniform;
        uielement.Source = bitmap;
        WriteableBitmap overlayBitmap = new WriteableBitmap(uielement, null);
I get an error :
Error 1 The best overloaded method match for 'Windows.UI.Xaml.Media.Imaging.WriteableBitmap.WriteableBitmap(int, int)' has some invalid arguments

I don't know what to do...

Ide: vs2013
OS: windows8.1

I referenced the lib into the NetCore45 folder...

Thanks in advance for all your replies....

Bye

New Post: How to use writeablebitmapex for windows8 store app (c# metro) on vs2013

New Post: save PNG (transparent picture)

$
0
0
Thanks for the very helpful extension! I've been working with trying to save a WriteableBitmap to a PNG and this was just the thing. I did find what I think is a bug in the implementation. I'm using this code to save png files that are used for Windows Phone Live Tiles. After adding the code from BubbaRichard it was working great, but I found that I was getting OutOfMemoryExceptions when run in the phone memory constrained ScheduledTask environment. In many cases the process is limited to 11MB (WP8). In this case I was seeing much higher memory consumption than expected. I finally was able to live within the memory limits, but only after modifying the WritePNG() function.
        public static void WritePNG(this WriteableBitmap bmp, System.IO.Stream destination)
        {
            Encode(bmp, destination);
        }
changed to
        public static void WritePNG(this WriteableBitmap bmp, System.IO.Stream destination)
        {
            Encode(bmp, destination);
            _image = null;
        }
I think that because that variable is static and WriteableBitmap doesn't implement IDisposable, that it doesn't get released and there is no way for the caller to release it. There isn't the same issue with the Stream because the caller can call Dispose() to free it.

I hope this helps save someone else avoid some pain.

Even with this change I had to manually call the GC to live in the small memory footprint allowed.

Thanks again for the code!
Viewing all 360 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>