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

New Post: create polygon with float cordiantes

$
0
0
No.

For performance reason are absolute coordinates expected as int.
  • Rene

New Post: Convolute / Invert changes WriteableBitmap DPI

$
0
0
Sounds like WPF.

Yes, you can convert after the operation. See the BitmapFactory class in the source code to get an idea how that works with the FormatConvertedBitmap class.
You can also compile your own WBX and modify BitmapFactory to use 72 DPI to omit that extra convert step. The power of open source. ;)
  • Rene

New Post: create polygon with float cordiantes

New Post: SetSource with BMP file

$
0
0
This has to do with the WriteableBitmap base class, but I was hoping someone could answer my question:

Why does this code work for PNG and JPG files but not BMP?
      WriteableBitmap wb = new WriteableBitmap(1500, 1500);
      wb.SetSource(fileStream);
For BMP files I get the following error on SetSource: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

New Post: SetSource with BMP file

$
0
0
The BitmapImage / WB does not support BMP.
But BMP is easy enough to parse, so you can roll your won Bmp Reader or use an open source one. I'm pretty sure someone wrote a BitmapImage / Wb method that support BMP.

But you should really think about if BMP is needed, BMPs are huge!
  • Rene

New Post: can increase line thickness?

$
0
0
how to draw line with more thickness?

New Post: can increase line thickness?

New Post: WriteableBitmap Shift

$
0
0
For a WPF project, I used 3 writeablebitmaps and the Blit method to accomplish something similar in an overridden OnRender method.
  1. First, I crop the original writeablebitmap, "wbm" and make that the source of a new one, "croppedWBM" with the new size and destination (I just move it over by the amount clipped).
  2. Then I create a third, "addWBM" which has the position and size of the new area I want to add.
  3. Finally, I clear the original and use it to Blit "croppedWBM" and "addWBM" together.
This method allows me to be able to write new data to the new section while maintaining the original data (minus the part that was cropped). OnRender is called every second making it appear that the image is moving horizontally, in my case to the left.

New Post: FillPolygon alpha not working on Windows Phone8

$
0
0
Hi,
for some reason WriteableBitmap.FillPolygon(path.Points, c); with c beeing {#00FFFFFF} draws a black figure. With c = {#BEFFFFFF} it is a slightly gray square and #FFFFFFFF is white.

I clear the writeablebitmap before the call with bitmap.Clear(Color.White) and also tried invalidating it. Still it draws a black square instead of a 100% transparent white one.

Can someone help me out with this please?

New Post: Is it possible to write text?

$
0
0
I'm seeing this too. My code is on WP8. I am using Resize to resize a WritableBitmap. If I render a textblock onto the WritableBitmap that is returned from resize I get a black rectangle with my text drawn on top. If, however, I use WritableBitmap.SaveJpeg to create a stream backed by MemoryStream and then create a new WritableBitmap from that stream I can render a textblock and the image looks correct. Is there something I need to do to the WritableBitmap that returned from Resize??

New Post: Is it possible to write text?

$
0
0
BTW, using blit solves this, but I'm curious why render does not work.

Commented Feature: Overloads for int[] pixels [11060]

$
0
0
If many shapes need to be drawn, it's dramatically faster if a local reference to the Pixels array is passed to the methods directly.
 
int[] pixels = writeableBmp.Pixels;
int w = writeableBmp.PixelsWidth;
int h = writeableBmp.PixelsHeight;
for(int i = 0; i < 10000; i++)
{
DrawLine(pixels, w, h, ...);
}
 
is much faster than
 
for(int i = 0; i < 10000; i++)
{
DrawLine(writeableBmp, ...);
}
 
Another important point is multi-threading. The WriteableBitmap cannot be used in a background thread (Exception is thrown).
Comments: ** Comment from web user: ffMathy **

This is incredibly important. Right now, it's impossible in Windows Phone apps to do resizing and other heavy operations on large images in the background!

New Post: Is this project dead?

$
0
0
Is this project dead? it's been over a year since the last contribution. Maybe it's time somebody forks it and starts improving it.

I for one could use one that would be compatible with cross-thread manipulation, and I would easily be able to implement that.

New Post: Is this project dead?

$
0
0
This project is not dead. :) The last update was released in June and the latest code check in is from 06/20.

We are always happy to add community contributions. Before we give write access to the repository we usually prefer a patch / diff and apply that if it makes sense and is good. Of course you will be given credits for it. Your suggestion sounds great. :)
  • Rene

Commented Feature: Overloads for int[] pixels [11060]

$
0
0
If many shapes need to be drawn, it's dramatically faster if a local reference to the Pixels array is passed to the methods directly.
 
int[] pixels = writeableBmp.Pixels;
int w = writeableBmp.PixelsWidth;
int h = writeableBmp.PixelsHeight;
for(int i = 0; i < 10000; i++)
{
DrawLine(pixels, w, h, ...);
}
 
is much faster than
 
for(int i = 0; i < 10000; i++)
{
DrawLine(writeableBmp, ...);
}
 
Another important point is multi-threading. The WriteableBitmap cannot be used in a background thread (Exception is thrown).
Comments: ** Comment from web user: teichgraf **

We just have it for a few methods right now and won't have the time to add it soon, but we appreciate code contributions. :)

- Rene


New Post: BitmapContext.CopyPixels on WinRT

$
0
0
To fix a bug in WinRT, call ToArray() twice.
#if NETFX_CORE
      private unsafe void CopyPixels()
      {
         var data = writeableBitmap.PixelBuffer.ToArray();
         data = writeableBitmap.PixelBuffer.ToArray(); // *** FIX ***
         fixed (byte* srcPtr = data)
         {
            fixed (int* dstPtr = pixels)
            {
               for (var i = 0; i < length; i++)
               {
                  dstPtr[i] = (srcPtr[i * 4 + 3] << 24) | (srcPtr[i * 4 + 2] << 16) | (srcPtr[i * 4 + 1] << 8) | srcPtr[i * 4 + 0];
               }
            }
         }
      }
#endif

Created Unassigned: WinJS support? [20387]

$
0
0
The NuGet component fails to add to a WinJS application.

Shouldn't this work?

Closed Unassigned: WinJS support? [20387]

$
0
0
The NuGet component fails to add to a WinJS application.

Shouldn't this work?
Comments: The WriteableBitmap is not available in WinJS. It's only part of the Xaml stack.
For WinJS you want to use the HTML 5 Canvas element.

Created 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.5) but the issue is still there.

Is there any way to fix this?

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: teichgraf **

Can you please post a repro solution?

Viewing all 360 articles
Browse latest View live


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