Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Luigi Thirty
Apr 30, 2006

Emergency confection port.

I've got VS2013 and Office 365. Trying to create a project with the Excel Workbook template says that my Office installation is missing required parts and to reinstall it. According to Microsoft you can't create Excel workbooks with Visual Studio 2013 when your Office is delivered via Click-to-Run because you can't customize the install and tell it to install the bits that communicate with Visual Studio. I've got Office 365. Is there any way around that? It seems really stupid that I can't create workbooks because I have the poor version of Office.

Luigi Thirty fucked around with this message at 20:41 on Jul 24, 2014

Adbot
ADBOT LOVES YOU

Luigi Thirty
Apr 30, 2006

Emergency confection port.

candy for breakfast posted:

Nthing everyone else here: WPF/MVVM is not easy. It took all of us some time to understand it. Once you hit that 'aha' moment then you realize it turns into something spectacular and never want to go back to winforms.

I helped someone convert their example program to proper MVVM in another thread. Granted the dealer hitting/staying logic doesn't work, but it's a simple example of INotifyPropertyChanged, RelayCommand, and datacontext implementations.

Confirmed that nothing I have ever done has made me feel stupider than trying to write this in WPF.

Luigi Thirty
Apr 30, 2006

Emergency confection port.

I'm bad at WPF. I have a byte array containing 8 bytes of image data (so an 8x8 1bpp image) that I want to display as a 64x64 Image on a window. I've been trying to use that WriteableBitmapEx library to load the image data into a WriteableBitmap and bind the Image to it but it's documented poorly and I can't work out how to do that.

To make sure it works, I bound the 64x64 WPF image to a 64x64 96dpi WriteableBitmap and when I do .Clear(Colors.Black) on it, only the right 1/4 of the image is cleared to the right color. I'm really confused.

Luigi Thirty
Apr 30, 2006

Emergency confection port.

Mr Shiny Pants posted:

How do you bind the image?

If you just bind it in Xaml and stretch it?

I'm not even trying to bind the actual image now, just get the drat thing to work right at all. Here's the Image on my WPF window. TestCharacter is a WriteableBitmap property which is not initialized at start time.

code:
<Image x:Name="imgTestCharacter" Source="{Binding Path=TestCharacter}" HorizontalAlignment="Left" Height="64" Margin="215,39,0,0" VerticalAlignment="Top" Width="64" Stretch="None"/>
And I press a button that initializes it and tries to clear it to black:

code:
vm.TestCharacter = new WriteableBitmap(64, 64, 96, 96, PixelFormats.BlackWhite, null);
vm.TestCharacter.Clear(Colors.Black);
and I get an access violation on .Clear().

Luigi Thirty
Apr 30, 2006

Emergency confection port.

EssOEss posted:

I believe you have to surround any touching of the WriteableBitmap with a .Lock() and .Unlock() pair, to properly synchronize everything.

I got an access violation still. I changed it to just SetPixel() but the results are wrong. Starting with a black image, this code:

code:
            vm.TestCharacter = new WriteableBitmap(64, 64, 96, 96, PixelFormats.BlackWhite, null);
            vm.TestCharacter.Lock();
            vm.TestCharacter.SetPixel(0, 1, Colors.White);
            vm.TestCharacter.Unlock();
gives me this image (minus the border). Shouldn't it be touching one pixel and not... many pixels?

Luigi Thirty
Apr 30, 2006

Emergency confection port.

Bognar posted:

Just a guess, but I think this might be because you're using PixelFormats.BlackWhite. Try Bgr32 or Pbgra32.

That got it working thanks.

Luigi Thirty
Apr 30, 2006

Emergency confection port.

I updated my Visual Studio 2015 from Update 1 RC to Update 1 release. Now when I start the application I get an error sound and it locks up on the start page. Is this happening to anyone else?

Luigi Thirty
Apr 30, 2006

Emergency confection port.

I'm generating an Indexed4 format BitmapImage from an arcade game's graphics ROMs. Which encoder can I use to save this as an image file in a native 4bpp indexed format? I'll take third-party encoders if I need to.

Adbot
ADBOT LOVES YOU

Luigi Thirty
Apr 30, 2006

Emergency confection port.

The native format is raw binary but mechanically similar to PBM. 1 bit from each of the 4 ROMs gets combined into a palette index for a pixel.

I was able to encode it as an uncompressed 16-color TIFF and load it into an image editor so my problem's solved.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply