none
c# UWP How to use a SpriteSheet RRS feed

  • Question

  • I have s sprite Sheet.  So I need to open an image and cut some portion of it out to an Image and store them in an image array. Then I write that to a bmp according to the proper coordinates.  I did this VS2005, but that code doesn't work with VS2009 and I have been unable to find a process that does it. Examples all seem to be pre-UWP. 

    I can write say 5 images to the bmp, then refresh it.  It gives the appearance of running faster as opposed to refreshing after each write. I can make hundreds of Image controls and move them, but I think that would bee to slow. Way back, it sure was. That's why I came up with this process.

    Anyway, Looking for a way to do it. Funny, the old silver light app compiles and works. One would think you can do it in UWP.

    Wednesday, August 28, 2019 3:37 AM

All replies

  • Hi,

    Since this forum is about General Windows Desktop Development Issues, and this thread is more related to UWP develop. I will move it to UWP forum for better support.

    Best regards,

    Drake


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, August 28, 2019 9:45 AM
  • I use Direct2D for sprites but I don't use UWP

    Maybe you can see MS samples with Win2D, mainly SpriteSheets

    (I cannot compile those samples with VS 2015)

    Wednesday, August 28, 2019 8:35 PM
  • Hi,

    So based on your words, if you are not using UWP, could you please tell me what kind of project you are using? Winforum, WPF or other kind of apps?

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, August 29, 2019 2:07 AM
    Moderator
  • I am using UWP.   I tried it in others, but this seemed to be the best one to use. 

    I think this may be my last issue. But you dont know that till its done :-)

    I can usually figure out this stuff if I can locate the correct tools to use.  Browser searching returns mostly old stuff.

    Thursday, August 29, 2019 2:30 PM
  • "if you are not using UWP" - strangely someone else interjected there and said they don't use UWP. I guess they were just pointing out that they weren't using it themselves. But it read like it was the OP answering when it wasn't.

    @ScCrow2 - There are a few ways to do it probably. Just off the top of my head I think you can use CopySubresourceRegion to copy regions from a source texture into a TextureArray.

    C# CopySubresourceRegion
    C++ CopySubresourceRegion
    Monday, September 2, 2019 6:26 AM
  • Thanks for the Reply Gavin.

    I did a VERY quick test.  Basically, cut and pasted his one proc in.  The SharpDx couldn't be referenced, and I did not try to chase it. 

    That is primarily because I had already moved on (and because I have not found a way to do it).  Instead of using the spriteSheet, I'm just creating individual images. I wanted to update all the old images anyway as they were done in a very small size with pixel drawing.  So the images will be better now.  I started on that this morning, and just saw your reply.

    I think that such a function would be useful, like Cut out the Face of some one and paste  an inner section of an image into into/over another and size it. And, it was an existing process, so one would think it should be an easy add.  But, I know nothing about that. In the end, it may be easier get the image you want. Less programming.

    Thanks again.  If anyone posts a sample code, I'll mark it as answer. 

    Monday, September 2, 2019 4:40 PM
  • Hi,

    I'm sorry to say that currently there is on existing official UWP sample about this. As @Castorix31 mentioned, you could try to check the Win2D sample.

    Best regards,

    Roy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, September 4, 2019 7:20 AM
    Moderator