View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0003212 | NoesisGUI | C# SDK | public | 2024-04-05 12:26 | 2024-06-04 13:17 |
| Reporter | voula_d | Assigned To | sfernandez | ||
| Priority | normal | Severity | minor | ||
| Status | resolved | Resolution | no change required | ||
| Product Version | 3.2 | ||||
| Target Version | 3.2.4 | Fixed in Version | 3.2.4 | ||
| Summary | 0003212: Bitmap image is not rendered correctly. | ||||
| Description | I need to dynamically load image from a stream which in WPF I am doing by using the following: BitmapImage bi = new BitmapImage(); As the above code is not Noesis compatible, I am trying to do the same with the following code: System.Drawing.Image img = System.Drawing.Image.FromFile("Images/Diagram_WhiteBackground.png");The code above occasionally fails with the error: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt". But even when it executes successfully it produces a blurred image. | ||||
| Attached Files | |||||
| Platform | Any | ||||
|
When using BitmapSource.Create() you should provide the raw pixels of the image without any file header. And the format and stride should match (for example, Stride=Width*4 and Format=RGBA8). |
|
|
Thanks for the reply and guidance. I was able to make this work by changing the code per your suggestion: I saw other posts where you are suggesting that using a FileTextureProvider is the way to go when trying to dynamically load images and I maybe that approach would better fit our requirements. Is there a way to use multiple FileTextureProviders and decide which one to use depending on some criteria? Thank you |
|
|
Yes, you can have your own FileTextureProvider. For example, depending on the Uri format, or if the file is available or not, you can decide whether to use your custom implementation, or just fallback to any other implementation (similar to what we do in our EmbeddedTextureProvider: https://github.com/Noesis/Managed/blob/master/Src/NoesisApp/Core/Src/Core/EmbeddedTextureProvider.cs). Regarding the issue about the BitmapSource, can we close this ticket? |
|
|
Yes, thank you. I found a way to render the bitmap so you can close the issue. |
|
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2024-04-05 12:26 | voula_d | New Issue | |
| 2024-04-05 12:26 | voula_d | File Added: noesis.png | |
| 2024-04-05 12:26 | voula_d | File Added: wpf.png | |
| 2024-04-05 12:26 | voula_d | File Added: NoesisTest.zip | |
| 2024-04-10 11:52 | sfernandez | Assigned To | => sfernandez |
| 2024-04-10 11:52 | sfernandez | Status | new => assigned |
| 2024-04-10 11:52 | sfernandez | Target Version | => 3.2.4 |
| 2024-04-10 11:52 | sfernandez | Description Updated | |
| 2024-04-10 11:52 | sfernandez | Description Updated | |
| 2024-04-10 12:17 | sfernandez | Status | assigned => feedback |
| 2024-04-10 12:17 | sfernandez | Note Added: 0009363 | |
| 2024-04-10 14:50 | voula_d | Note Added: 0009365 | |
| 2024-04-10 14:50 | voula_d | Status | feedback => assigned |
| 2024-06-03 19:53 | sfernandez | Status | assigned => feedback |
| 2024-06-03 19:53 | sfernandez | Note Added: 0009618 | |
| 2024-06-04 12:23 | voula_d | Note Added: 0009630 | |
| 2024-06-04 12:23 | voula_d | Status | feedback => assigned |
| 2024-06-04 13:17 | sfernandez | Status | assigned => resolved |
| 2024-06-04 13:17 | sfernandez | Resolution | open => no change required |
| 2024-06-04 13:17 | sfernandez | Fixed in Version | => 3.2.4 |