How to let another image animate - c#

I was adding something to my XNA project, and I downloaded the GIF animation library from https://xnagif.codeplex.com/
I added the pipeline and references as needed (I followed the sample GIF animation) and one of my gif images worked (yay) but I have decided to add more gif images and only the first image loaded animates normally, while the other ones do not...I just see a still image/frame.
How am I supposed to fix that?
Also just something extra, how can I make it so that I do not have specific color in the spritebatch.Draw parameters? I want the colors to remain as they are from image, but I can't find a way to get rid of the color restriction to be incolved as a parameter also. How can I get rid of that?

After long thought, I figured out a while ago that I had to update time in the other functions in seemed.

Related

What does MSPaint process to eliminate objects in background when PNG image is converted to 4-bit BMP image?

I opened a PNG image, clicked Save As, changed to 16 color Bitmap, and saved it.
Then, MSPaint warned about loss of information about transparent and image qualities and, I clicked OK.
As a result, letters behind the black glass object disappeared clearly like this image (Before->After).
By changing PixelFormat or removing transparent area on C# (.Net 4.6.2), I tried to implement this feature just like MSPaint, however, it wasn't removed clearly. In some way, Nothing changed.
Is that not about PixelFormat or ColorDepth?
Or, Is there a way to get rid of objects behind another on PNG?
What should I do to implement that?
EDIT 1
Thank you so much, #TaW. By following your method ApplyGamma, I could solve the issue.

WPF Printing Large Canvas over multiple Pages

I've got this problem:
I created a pretty large Canvas in WPF with a lot children.
I want to add a Print Button. PrintVisual seems not to work, because the image is to big. (I am using a scrollbar) I want to split the Canvas between multiple pages.
What i've done so far:
I am taking a Visual Brush for every part of the Canvas
Create a new Canvas and make the visual brush its background
Adding the new Canvas to a page, add the page to a FixedDocument.
Well, now i've got a FixedDocument and going to print it via printDocument.
The Problem is, that the whole process of printing takes a lot of time and sometimes it doesn't work at all. It's like there is a preprocessing step to convert the fixed document into a bitmap.
My Question: Is a Visualbrush in a Canvas to big? Should i convert the Canvas first into a bitmap?
I've found this great article: http://www.codeproject.com/Articles/339416/Printing-large-WPF-UserControls.
Whatever.
Is it a good way to convert a huge canvas into a bitmap first and then print parts of the bitmap? I could very well imagine, that one could get problems with blurring effects this way.
I've got also no idea how to add a bitmap to a page in wpf.
The worst thing is, that i couldn't found some really good sorces or a standardway (and i think there has to be one, cause this should be a pretty standard problem) for printing dynamic produced canvas in wpf.
I am really greatful for every really good source, help or code.
Thank you for your time.

C# How do use one image as a cookie cutter for removing part of another image

I have an image with a decent portion of it transparent. It's the result of a green screen process. I need to overlay a filter on top of the image without laying on top of the transparent portions. You could think of it like using the base image as a cookie cutter to remove a matching shape from the filter image so I can merge them.
I've tried combing through AForge but I don't see anything helpful and google is returning all sorts of garbage. If anyone has any suggestions on where to start or alternate methods I would appreciate it.
I came up with a solution that works for me but may not answer the question directly, as I asked it. Someone else may find this useful though.
I Iterated through image I wanted to cut out. At each pixel position I would use that same position to check the "cookie cutter" image and if the Alpha channel was 0, I would then set the pixel value on the base image to 0. I was basically setting everything other than the cookie cutter shape to transparent.
A caveat is this only works if the image are the exact same size and you can't easily change the location of the where you want the cutout.

Path Intersection Removing excess path

Hej
Lets say I have a cirkel as my usercontrol in a Windows Phone 8 application, And I add elements inside a Geometry group, with a rectangel and a line. I would get the following:
(source: c-sharpcorner.com)
I am interested in having my cirkel as the main element. To specify I want the everything else to only be displayed in the region of the cirkel.
So if the rectangle was red I would only get the red corner displayed.
I have code that can manage inserting and moving objects. But I do not know how to make the intersect work opporsit of the picture.
I have tried a bit of the same in a small sample as is done in this link:
the link is http://www.c-sharpcorner.com/uploadfile/mahesh/path-in-wpf/
Anybody has an idea for this?
Best
So the Best solution I found is to convert your element to WriteableBitmap, and then setting this as the background of your wished shape.
So to acheive the above if you have the elements as geometric shapes you can use this link to get the path of the object.
http://www.c-sharpcorner.com/uploadfile/mahesh/path-in-wpf/

Listview icons show up blurry (C#)

I'm attempting to display a "LargeIcon" view in a listview control, however the images I specify are blurry. This is what I have so far:
alt text http://img220.imageshack.us/img220/1005/blurryiconsql3.jpg
The .png files are 48x48 and that's what I have it set to display at in the ImageList properties. There's one thing that I've noticed (which is probably the cause) but I don't know how to change it. Inside the "Images Collection Editor" where you choose what images you want for the ImageList control, it looks like it's setting the wrong size for each image.
alt text http://img83.imageshack.us/img83/5218/imagepropertiesmf9.jpg
As you can see the "PhysicalDimension" and the "Size" is set to 16x16 and not abled to be manipulated. Does anyone have any ideas? Many thanks!
Be sure to set ImageList.ImageSize to 48 x 48 too.
When adding a .PNG Icon format size the editor tends to pick the first entry size in that file, so it picks up the 16x16 entry and it's stretching that out. That's why you see the 16x16 in the properties there. As suggested, the support for PNG is poor, I'm often found myself rolling over to another format as well to avoid this.
You can open the file in Paint.Net if you need a free editor or something more fully featured like Photoshop or Fireworks and extract the exact size you want.
I'm not sure if its the problem in this specific case, but Microsoft support for the PNG format is generally poor. Try adding the images in .bmp format and they should display fine.
Check also the ColorDepth setting on your ImageList. I had a similar issue with a TreeView control, but after reading the previous posting regarding the size I found this setting, played around with it a bit and found that it greatly affects the way images from an ImageList are rendered. The higher the depth the better the quality.
Be sure to set the ImageList size to 48x48 px BEFORE you add the images.
If the ImageList is set to 32x32 and you add a 48x48 image, the icon is resized to 32x32. When you change the ImageList to 48x48 afterwards, the image is just resized again, thus losing quality and going blurry.
Also, Paint.NET (or Photoshop) can't open .ico files.
Visual Studio/.NET can handle 32-bit PNG images fine, the built-in image editor in VS is a bit lack-lustre though.

Categories

Resources