Subscribe: code monkey
http://jpobst.blogspot.com/feeds/posts/default?alt=rss
Added By: Feedage Forager Feedage Grade B rated
Language: English
Tags:
android  code  effects  great  mono android  mono  net  new  paint net  paint  people  pinta  release  source  var  windows 
Rate this Feed
Rate this feedRate this feedRate this feedRate this feedRate this feed
Rate this feed 1 starRate this feed 2 starRate this feed 3 starRate this feed 4 starRate this feed 5 star

Comments (0)

Feed Details and Statistics Feed Statistics
Preview: code monkey

code monkey





Last Build Date: Wed, 21 Feb 2018 14:19:38 +0000

 



Pinta Effects for Your .NET Apps

Thu, 27 Dec 2012 05:54:00 +0000

Pinta wouldn't exist today without the amazing code from the previously open source Paint.NET.  Now we've decided to pay it forward and make that same code available for other developers to easily use in their applications.

To accomplish this, we've extracted the code for all of Pinta's effects into a graphics toolkit agnostic library called Pinta.ImageManipulation and posted it up on NuGet for easy use.  This includes over 35 multi-threaded effects exposed as cancelable Tasks.

The core of Pinta.ImageManipulation is graphics toolkit agnostic and only works on arrays of BGRA bytes, but we've also included wrappers for System.Drawing (GDI+) and Cairo (GTK+).

Now that you've got all those great new holiday photos, let's see how to apply an effect to them in 5 lines of code.

Create a new project, bring up the NuGet dialog, and search for Pinta:


Select the Pinta.ImageManipulation.System.Drawing package and install it...


..which adds 2 new project references, the toolkit agnostic core and the System.Drawing wrapper.

Now we need to:
  • Load an image into System.Drawing.Bitmap
  • Wrap it into a BitmapWrapper we can pass to Pinta.
  • Create a new emboss effect.
  • Render the emboss effect to the image.
  • Save the result.
var photo = new Bitmap (@"C:\helo.png");
var photo_wrapper = new BitmapWrapper (photo);

var blur = new EmbossEffect ();
await blur.RenderAsync (photo_wrapper);

photo.Save (@"C:\helo2.png");
Resulting in:


A full list of available effects can be found here.

Pinta.ImageManipulation retains Paint.NET and Pinta's MIT X11 license, so feel free to use this in your applications.

If you want to submit new effects, send us a pull request on GitHub:

https://github.com/PintaProject/Pinta.ImageManipulation

Enjoy!



Mono for Android Portable Libraries in VS

Sat, 21 Apr 2012 21:29:00 +0000

Thanks to Scott Hanselman's recent article on .NET's support for Portable Class Libraries (PCLs), there has been some renewed interested in using them for Mono for Android.If you try to add a reference to a compiled PCL assembly, things should work, as VS simply checks that the version of mscorlib.dll referenced is the same as the MFA project (2.0.5).  However, if you try to add a reference to a PCL project, you get this nasty dialog box:The bad news is we don't ship any tooling for supporting these out of the box yet.  The good news is it's trivial to do it yourself!The portable libraries are installed in .NET's Reference Assemblies folder, which is here:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.0If you explore around in that folder, you will see there are something called "Profiles" which specify the common assemblies for a given set of targets.For example, "Profile2" targets .NET 4, Silverlight 4, and Windows Phone 7.  This is the set that matches Mono for Android best, so we want to tell Visual Studio that it's okay for Mono for Android projects to use this set as well.This is done by files in the "SupportedFrameworks" folder, specifically:C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETPortable\v4.0\Profile\Profile2\SupportedFrameworksYou can see there are already files for .NET 4, Silverlight 4, and Windows Phone 7:In order to support Mono for Android, we just need to add a .xml file to this directory called "MonoAndroid,Version=v1.6+.xml":The contents of the file are simply some metadata to tell Visual Studio about our target:Once you have this file created, restart Visual Studio, and you should be able to add references to PCL projects in Mono for Android projects!NOTE: Last time I checked, the Mono for Android profile is not an exact match for Profile2.  There are a few rarely used methods that Mono for Android lacks, so you still have to be slightly careful about what you use.[...]



Playing With Roslyn

Mon, 24 Oct 2011 19:02:00 +0000

As a tools guy, I've been fascinated with Roslyn ever since Microsoft previewed it. It looks like it provides lots of power for tools to consume. Now that the first CTP is out, I spent some time over the weekend playing with it.

The first thing it gives you access to is parsing source code, giving you an object model you can play with, and then letting you spit the modified source code back out. Reading source code in is easy:
var source_text = File.ReadAllText ("input.txt");

var tree = SyntaxTree.ParseCompilationUnit(source_text);
var root = (CompilationUnitSyntax)tree.Root;
Now we have an object model we can play with. We can search through the model for specific tokens and replace them with new ones, like this:
// Replace "Hello World!" with "Goodbye World!"
var output = root.GetFirstToken (p => p.Kind == SyntaxKind.StringLiteralToken);

var new_output = Syntax.StringLiteralToken ("\"Goodbye World!\"", "Goodbye World!", output.LeadingTrivia, output.TrailingTrivia);

root = root.ReplaceToken (output, new_output);
We can do source code formatting:
// Add a space in front of all open parentheses
var parens = root.DescendentTokens ().Where (p => p.Kind == SyntaxKind.OpenParenToken && p.LeadingWidth == 0);

var new_parans = parens.Select (p => p.WithLeadingTrivia (Syntax.WhitespaceTrivia (" ")));

root = root.ReplaceTokens (parens, (p, q) => p.WithLeadingTrivia (Syntax.WhitespaceTrivia (" ")));
Finally, we can do syntax highlighting:
private static void OutputNode (CompilationUnitSyntax token)
{
var default_color = Console.ForegroundColor;

foreach (var t in token.DescendentTokens ()) {
// Make keywords blue
if (SyntaxFacts.IsKeyword (t))
Console.ForegroundColor = ConsoleColor.DarkCyan;

Console.Write (t.ToString ());
Console.ForegroundColor = default_color;
}
}
Putting this all together and running it results in:
(image)

Note the "Hello World" has changed to "Goodbye World", open parentheses now have spaces in front of them, and we colored the keywords blue with very few lines of code.

The tools guy inside of me loves playing with the API, but the Mono guy inside me has to go further and actually play with implementing the API, so the screenshot is actually running on a toy implementation of Roslyn's VB syntax tokenizer that I whipped up. I want to stress that it's just a quick hack that pretty much only parses my sample program and I know nothing about writing parsers, but it was a fun exercise.

The other nice feature of the Roslyn APIs is that it makes each compiler step independently testable, so I know I produce the same 59 syntax tokens as the MS implementation with the same leading and trailing trivia.

If you want to play with the code, it's available on GitHub:
https://github.com/jpobst/Mokii



Pinta 1.0 Released

Wed, 27 Apr 2011 22:13:00 +0000

After roughly 16 months of development, Pinta is proud to join the ~1% of open source projects that make it to version 1.0!

I am extremely pleased of how Pinta has turned out, and extremely grateful for everyone who sent encouragement, bug reports, patches, and translations.

(image)

Some 1.0 Links:
- Release Notes
- Downloads
- Bug Tracker
- Feature Requests

In the next month or so I'll get up a roadmap of where future Pinta development will be going. Hint: Plugins.

Thanks again to everyone who helped make this happen, and here's hoping for another great 16 months of development!



Lesson of the Week

Fri, 18 Feb 2011 17:19:00 +0000

Apparently if you want third parties (Apple App Store, Google Marketplace, MS App Store) to distribute your software for you, you shouldn't choose a license that forces requirements on distributors.



MonoDroid Progress

Wed, 08 Dec 2010 17:26:00 +0000

About 4 months ago, I worked on porting some of the Android SDK samples to run on MonoDroid. It was a soul-crushing failure. Every line of code I wrote exposed a new bug in MonoDroid which I had to wait until it got fixed to continue. Eventually I gave up on doing anything more than the absolutely trivial Hello World.

What a different story things are today!

I dusted off my unfinished Snake port, and it now works without modification.

(image)
Since I did it so long ago, there was no telling what magic I had in there to make it work on MonoDroid, so I ported another one from scratch. I grabbed the hardest sample I think they have: JetBoy. It's basically a fast-paced, Guitar Hero-esque game where you have to fire your laser to the music as each asteroid passes across the beat line.

After an afternoon of literal translation to C# (over 1k LOC), I fixed up the few Java porting issues like anonymous classes and nested classes accessing the parent class's private variables, and it *just worked*.

(image)
I think we're getting pretty close on finishing up our first release MonoDroid, and I can't wait to see what apps people write with it.

Both samples are available in our MonoDroid samples GitHub repository.



Full of Hot Air

Mon, 08 Nov 2010 04:10:00 +0000

Today there were several hot air balloons out when I came home.

(image)

One came closer and closer to my house.

(image)

And landed in the street in front of my house.

(image)

It was then deflated and sent on its way.

(image)

Shot from the inside.

(image)

Full Photo Set On Flickr



Pinta 0.5 Release

Tue, 02 Nov 2010 19:57:00 +0000

Just a quick note that Pinta 0.5 has been released today, with a few big features like multiple images support, fun new brushes, and clone stamp.

Full release notes are available here:
http://pinta-project.com/release/0.5


(image)



You Can't Please Everyone

Wed, 02 Jun 2010 23:38:00 +0000

If there's one thing I've learned in designing GUI's and websites is you can't please everyone. One person's favorite part is another's "worst idea ever".

Same goes for Pinta. Some people want to be able to move the various widget pads away from their canvas. Others want them to always be visible and easy to reach.

For Pinta 0.4, we're going to try to please as many people as possible. To do that, we've brought in MonoDevelop's incredibly awesome docking library. This allows you to resize, move, close, float, and autohide pads.

Here's the default:
(image)

Here's an example of a customized layout:
(image)

Hopefully this will please 90% of our users! Many thanks to the MonoDevelop team for such as awesome (and small!) library!



Pinta 0.3 Released!

Mon, 03 May 2010 20:10:00 +0000

Twenty inches of rain couldn't stop the release of Pinta 0.3.

This is a great release, as it brings us pretty close to feature parity with Paint.NET.

I think the most important new feature is live preview, especially as this release adds 25 new effects to play with. It also adds 3 new tools (gradient, text, magic wand select) and has several visual improvements to make image editing / painting better.

(image)

I've posted packages/installers for SUSE/Mac/Windows/Zip, and the excellent Debian guys should have the Ubuntu PPA updated shortly.

Check out the full release notes for Pinta 0.3!

Thanks to everyone who made this release possible!



A Wet Weekend

Mon, 03 May 2010 03:36:00 +0000

It's been a wet weekend here in Tennessee. On Saturday, my town got an estimated 12-15" of rain in about 12 hours. Obviously, no place is designed to handle that much rain that quickly. Then it repeated again today, causing widespread flooding throughout the entire Middle Tennessee area. Any kind of previous record for rainfall or rivers heights have been demolished.I think about the only thing they've shown on national news is this video of a portable classroom cruising down the interstate. (Note this is I-24, a 4-lane national highway.)That was yesterday, things got a lot worse today, as the water made it to the streams and rivers, which then overflowed their boundaries.It's impossible to capture in a few pictures how widespread this is. Everything in about a 50 mile radius is flooded and shut down. They actually imposed a curfew where I live, so I'm not allowed to leave my house, not that I could probably get anywhere with most major roads closed. My city is one of the hardest hit, with the most rain, and a major waterway runs through the middle of the city.Personally, I've been pretty lucky, as I live on relatively high ground on the outskirts of the city. Middle Tennessee is rather hilly, so it all depends exactly on where you live. Tons of water has passed through my yard, but it fortunately keeps flowing and not backing up. This ditch beside my house is normally empty. This is about as high as it ever got, and it has stayed rapidly flowing for about 36 hours.It's nice that I work from home so I don't have to try to go to work tomorrow. Of course, if I worked local, I'm sure I'd get the day (or week) off. :)It's finally stopped raining. The rivers will continue to rise for a few more hours as the water continues to drain. Then they should slowly recede and people can begin to see what's left. Thousands of homes have probably been destroyed. Probably tens of thousands of cars. Some interstates and roads may be closed for weeks until they are deemed safe or will have to be rebuilt. Likely, the final bill for this will be close to a billion.[...]



Kicking Pinta in to High Gear

Thu, 01 Apr 2010 08:00:00 +0000

As people may or may not be aware, even though I work for Novell, Pinta is not sponsored by Novell. It is a project I do purely in my free time. Since it's getting kinda popular, I thought it'd be nice to earn some money with it so I can dedicate more time to it.

Unfortunately, society has decided that creative works (software, music, movies, tv) aren't worth paying money for. So far, I think the only successful business model for open source software is to have a browser and sell your homepage to Google or Yahoo. I thought about adding a browser to Pinta, but it was hard to justify as enhancing the user experience.

Advertising is the only other legitimate option, but I was reluctant to degrade the GUI by placing ads in it. However I've come up with a brilliant and creative idea that adds advertising in a fun way that I think users will enjoy.

I am still working out the deals with advertisers, but the plan is to add sponsored effects. Basically, we've come up with some effects that are helpful to users and tie in great with some great products.

As I said, these aren't final yet, but I wanted to give a preview of a couple I've been working on. From now on, Gaussian Blur will be known as the Bud Light Golden Wheat with Lime (tm) Drunken Blur:

(image)

I've replaced the boring old "Radius" option with a slider of how many beers you've had to determine how much blur is applied!

Another new effect is the VISINE "Get the Red Out!" (tm) Red Eye Reduction filter:

(image) (Image courtesy of wikipedia.)

Red eye reduction is a very important effect for users, and the synergy with VISINE is a natural fit!

If everything goes according to plan, we'll ship Pinta 0.3 with several sponsored effects. The income from these opportunities will allow us to fund additional hacking on Pinta.

I think today, the first of April, is going to be the start of a wonderful new phase of development for Pinta!



Pinta: Nil Dot Duo

Mon, 15 Mar 2010 06:05:00 +0000

I am extremely excited to announce the release of Pinta 0.2!

Pinta 0.2 is a big step towards general feature parity with PDN, by adding great new features like:

- 5 new tools (Paint Bucket, Recolor, Line, Zoom, Pan)
- 5 new adjustments (Levels, Curves, Brightness/Contrast, Hue/Saturation, Posterize)
- 5 new effects (Ink Sketch, Oil Painting, Pencil Sketch, Gaussian Blur, Glow)
- Enhanced layer and history pads
- Multithreaded adjustments/effects rendering
- Basic OS X integration
- and more!

Full release notes (with pictures!) are available here.

Packages are available here, and likely more will be contributed.

The most exciting part about this release is that it isn't all my work. Pinta has attracted several great contributors who are helping it quickly move towards maturity. Without their awesome work, Pinta would be releasing today with only about half of these new features!

With 0.2 out the door, now I can turn to the merge requests already waiting to make 0.3 an even better release!

(image)



Delayed Transition

Thu, 04 Mar 2010 00:21:00 +0000

After Comcast's year-long advertising blitz on how their customers were safe from the analog->digital TV transition, I got a nice letter in the mail today informing me that Comcast is going, *gasp*, all digital. All I need to be ready for the transition is a digital converter box for every television, which they will gladly rent me!

Maybe the government will offer vouchers for them. ;)



Internet TV

Sat, 20 Feb 2010 21:08:00 +0000

Dear Internet Media companies,

Have I got a deal for you!

Looking at my cable bill, I currently pay $88.59 a month for basic cable (no premium channels) and one HD DVR. If everything I watch is in-season, I watch about 50 hours of television a month plus local football (CBS). Obviously, this is ridiculous and needs to stop very soon.

So here's a chance for me to pay you cash money, Apple/Microsoft/Google/Hulu/whoever. I would gladly pay, lets say, $30-$40 a month for up to ~60 hours of television. It can be DRM'd, it can be "rented", I don't care, as long as I can play it in HD on my TV. I would also greatly prefer to be able to pre-download it so I can have high quality without network hiccups.

Unfortunately, the current internet TV model is ~$3 per HD episode, which makes it remarkably more expensive than cable, even for my limited usage.

As it stands, it looks like I'm going to have to cobble together my own solution of Windows Media Center DVR for OTA stuff, Hulu for some stuff, and iTunes for what I can't get elsewhere. And yet you wonder why people turn to BitTorrent...



Calling All Testers!

Tue, 16 Feb 2010 20:13:00 +0000

We recently released a beta version of our upcoming Mono Tools for Visual Studio version 1.1, containing a couple of nifty new features.

- File copying is smarter, and no longer copies files that haven't changed.

- It is now easier to package a pre-compiled copy of a web site:

(image)

- And, most importantly, a preview of VS2010 support that works with VS2010 RC!

(image)

Give it a shot and let me know if something is broken so I can fix it before we release!

Full release notes and download links can be found here. Enjoy!



A Great First Week

Mon, 15 Feb 2010 15:38:00 +0000

I wanted to thank everyone for the tremendous show of support for Pinta in it's first week!

A few stats:

- The announcement of Pinta was picked up by several large tech news sites.

- The Pinta web site received over 29,000 hits.

- 23 people sent me emails of encouragement. (And 1 of discouragement.)

- People contributed packages for Ubuntu, OS X, and Pardus Linux. I was also contacted by people making packages for Fedora and Windows.

- Roughly 10 people sent me email offering to translate Pinta into a variety of languages. (We're not ready for translations yet, but I have a bunch of emails to send when we are!)

- 7 people have contributed code which has already been merged into Pinta's master repository.

Overall, it was a great week! I also wanted to thank everyone that I didn't personally reply to. I was flooded with emails all week and couldn't respond to them all!

Anyways, work has begun on Pinta 0.2. Thanks to many great contributions, my roadmap for 0.2 is already over halfway complete, so I guess I'll have to expand the feature list for 0.2!



Introducing Pinta

Sun, 07 Feb 2010 17:07:00 +0000

Over the holiday break, I stumbled upon this article from OSNews stating that there was a need for something like Paint.NET for Gtk. Having some experience with porting Paint.NET to Mono Winforms before, I knew that that was a massive task. But it still got me curious about Cairo and creating a layered canvas, since I had never played with Cairo or Gtk.

After playing around for a few hours, I actually had a working paintbrush and canvas. Intrigued by my success, I played around with it for a few more days. By the end of the week I had a nifty little paint program with a few features. Now, a month later, it's time to open my little project up to the world: Pinta.

(image)
Pinta is a clone of Paint.NET. It already has a small, but hopefully useful, set of features like multiple layers and infinite levels of Undo/Redo.

(image)
I hope to implement the same feature set as Paint.NET. Currently there are several tools missing, as well as adjustments like brightness/contrast and levels and Paint.NET's effects.

(image)
Being written in Mono/Gtk, Pinta is naturally cross-platform.

(image)
To download Pinta or the source code, check out the website!

Note: I didn't misspell "Hello" in my screenshot, my dog's name is Helo. ;)



Taking All Bets

Wed, 27 Jan 2010 19:36:00 +0000

With the massive success of the iTunes App Store (over 3 billion apps downloaded), I think it's safe to assume the next version of OS X will include an App Store for Mac software.

The question is:

How many iterations of OS X will it take before Mac software can only be distributed (without "jailbreaking") through the App Store, thus ensuring Apple gets their cut of all Mac software sales?



Merry Christmas Back

Tue, 05 Jan 2010 17:35:00 +0000

My Christmas gift to myself (mainly my back) this year was a spiffy Aeron chair, since I spend probably 10+ hours sitting at my desk each day. It is a considerable upgrade from what I've used for the last 2 years:

(image)
We're cool now, right vertebrae?



If you build it, they will come

Fri, 16 Oct 2009 22:04:00 +0000

Ever since I got a dog, and realized said dog would fetch himself to death given the opportunity, I have threatened to build him an automatic ball thrower. Unfortunately, I have the mechanical skills of a chinchilla. Fortunately, someone else has done all the hard work for me:

The Automatic Canine Fetch Machine (catchy name!)

(image)

This is great for those people who want a dog, but don't want to have to actually interact with the dog. It's like getting a television for your toddler.

Even a cold, soulless ball throwing mechanotron bucket can't say no to these eyes:

(image)



I don't get KDE

Wed, 07 Oct 2009 04:33:00 +0000

Last night while browsing the internets, I saw some screenshots of KDE 4.3 running on openSUSE 11.2. I've never tried KDE, so I installed the openSUSE 11.2 M8 build to briefly play with it.

What got me interested was this element of the KDE desktop:

(image)
I look at that and see hope. It is elegant and refined. It is glassy and tasteful. It says: "I can easily compete with Windows 7 and OSX." Simply put, it is beautiful.

Yes, there are some problems with it. The buttons do not highlight in any way on hover. There are no tooltips, so I don't even know what the top two buttons do. From what I can tell, they do absolutely nothing. But it really lives up to KDE's reputation of eye candy.

And then you open a window:

(image)
It is.. gray. There is no glass. There are no gradients. There is no depth. There is no elegance. There is just gray. It says: "I am kicking Windows 95's ass! Barely!"

I just don't get it. How can half of your desktop (let's call it "Plasma") be so beautiful, while the other half (let's call it "the stuff that is always going to be covering up Plasma") be so ugly and uninspired?

Errata:
- I do not know if I am complaining about KDE, or openSUSE's implementation of KDE, or both.
- I lamented on the aesthetics of GNOME previously, so it's not "let's start a desktop war".



iInnovation

Mon, 05 Oct 2009 01:39:00 +0000

Has anyone created a farting app using MonoTouch yet, or is my golden ticket to riches still available?



RMS mistakes and malattribution

Wed, 30 Sep 2009 18:25:00 +0000

Given the recent environment of reflection on past statements made, I have looked at my past to see if there are things I have said that might not be verifiably true.

I have said multiple times in the past that Richard Stallman was actually Weird Al Yankovic with a costume beard. I had heard this through various sources, but there is no published source that confirms this, and I now believe I may have accidentally completely made that up and passed it off as fact.

I have no way to verify that Stallman is not Yankovic, but there is no basis to claim he is. I apologize to Mr. Stallman, and, should he be a separate person, Mr. Yankovic.

(image)

While Mr. Yankovic may not actually be RMS, he does a have a history of Stallman-esque leanings, as exhibited by the original titles of his hit songs before the record labels changed them:

- It's All About the GNU/Pentiums
- Living in an Amish Paradise (To Escape the Evil, Proprietary Monopoly that is Microsoft)

So I don't withdraw my claim that RMS and Weird Al might be the same person. But I do withdraw my claim that RMS and Weird Al are the same person.



Planning for Spontaneity

Thu, 17 Sep 2009 04:09:00 +0000

I have recently felt like my popularity is waning a bit, people just aren't talking about me enough. Fortunately, current events have given me an idea. At this year's PDC, if I go, I will yell something horribly distasteful during the keynote, and then immediately apologize like I never meant for it to happen.

What this means to you dear reader is that we only have roughly two months to come up with what I should spontaneously yell with no forethought whatsoever. I'll start the ball rolling with a few:

- "Clippy is racist."
- "Windows ME was the best version of Windows ever."
- "You lie", in response to the cloud being the future.
- "Steve Jobs is a handsome man."
- "That guy was lucky Ballmer only threw a chair at him."
- "Anders Hejlsberg is a no-talent hack."
- "I'm really happy for you Windows 7, I'm gonna let you finish, but Vista SP1 had one of the best videos of all time."
- "Hitler used Windows."
- "Google apps are an adequate replacement for desktop apps."
- "I swear to God I'm [expletive] going to take this [expletive] Zune HD and shove it down your [expletive] throat, you hear that? I swear to God."

Feel free to leave your suggestions in the comments, and let's make this a PDC to remember! (for being about me!)

[Reporters and podcasters, feel free to begin booking me now for my heartfelt apology!]