Entries:
Comments:
Discussions:

Loading user information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading user information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Awesome embeddable, deployable web browser that's free for independents... Awesomium!

Sometimes all you want to do in your app or game is display some HTML content. But you also don't want to take a dependency on Internet Explorer or other installed web browser. Being a hobby, independent, or just for fun at home, developer you don't have many resources and just wish there was a browser you could easily embedded and deploy in your app. That it would be awesome if you could easily used it in a .Net app, be it VB.net, WinForms or WPF.

I give you Awesomium!

I caught this via Chris Cavanagh's post, Awesomium – Free Indie License! where the awesome, indie and free seemed like it would make a good post.

Awesomium is the first, full-featured, windowless web-browser framework.

It is crazy fast, supports the latest stuff, and is super simple to use in your own applications .

Great for use in 3D games, .NET apps, HTML GUIs, and way more.

For In-Game Browsing:

Add a custom web-browser to your game to grant users access to forums, guides, and additional online game content without ever leaving your application.

screenshot_eveonline_browser2 

For .NET and WPF:

Great when used with WPF; get started quickly with our drop-in WebViewControl or use our full .NET API for total customization. No airspace issues here!

screen_tabbedbrowsersample

For HTML UIs:

Power your UI with latest-generation XHTML, CSS, and JS. Mature toolset and rapid-prototyping possibilities make this a great new option for game developers.

screenshot_overgrowth_ui

And I said free for indie's, right?

SNAGHTML3064fb6c

Now the actual source for Awesomium is not free, but it is available.

So if the source for Awesomium isn't free why am I chatting it up? Because the SDK and AwesomiumSharp wrapper are free (given the conditions above).

Here's a snap of the C# WPF based "tabbed browser" sample included in the SDK;

SNAGHTML306ebb12

And here's the binaries, all the binaries, for this sample;

image

The AwesomiumSharp solution;

image

(Yeah, there's a Mono Project too... Smiley

Because "I'm a VBer" let's take a quick look at the VB.Net WinForm code.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim config As WebCore.Config = New WebCore.Config()
config.enablePlugins = True

WebCore.Initialize(config)
webView = WebCore.CreateWebview(webViewBitmap.Width, webViewBitmap.Height)
webView.LoadURL("http://www.bing.com")
webView.Focus()
End Sub

Dim
bmp As Bitmap
Private Sub render()
Dim rBuffer As RenderBuffer = webView.Render()

Dim data(webViewBitmap.Width * webViewBitmap.Height) As Integer
Marshal.Copy(rBuffer.GetBuffer(), data, 0, webViewBitmap.Width * webViewBitmap.Height)

bmp = New Bitmap(webViewBitmap.Width, webViewBitmap.Height, PixelFormat.Format32bppArgb)

Dim bits As BitmapData = bmp.LockBits(New Rectangle(0, 0, webViewBitmap.Width, webViewBitmap.Height), ImageLockMode.ReadWrite, bmp.PixelFormat)

Dim ptr As IntPtr = bits.Scan0.ToInt32()
rBuffer.CopyTo(ptr, bits.Stride, 4, False)

bmp.UnlockBits(bits)

webViewBitmap.Image = bmp
End Sub

Private Sub
Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
WebCore.Update()
If webView.IsDirty Then
render()
End If
End Sub

Yeah, it might be a little more work using this control, but the power it gives you is hard to beat.

Given that this is, in reality, a commercial product, you'd expect some documentation...

AwesomiumSharp 1.6.

Introduction

Hi there, welcome to the Awesomium .NET API docs! Awesomium is a software library that makes it easy to put the web in your applications. Whether that means embedded web browsing, rendering pages as images, streaming pages over the net, or manipulating web content live for some other purpose, Awesomium does it all.

If this is your first time exploring the API, we recommend starting with AwesomiumSharp.WebCore and AwesomiumSharp.WebView.

Here's a simple example of using the API to render a page once:

   WebCore.Initialize(new WebCore.Config());
   WebView webView = WebCore.CreateWebview(800, 600);
webView.LoadURL("http://www.google.com");
   while (webView.IsLoadingPage())
WebCore.Update();
   webView.Render().SaveToPNG("result.png", true);
   WebCore.Shutdown();

If you are interested in just adding a standalone WebView to your WPF application with minimal work, take a look at AwesomiumSharp.WebViewControl (it should be available in your Toolbox if you add a reference to AwesomiumSharp in your project, just drag-and-drop and you're done).

If you're looking to have HTML in your app and would like to embed a controlled renderer this might just be your ticket to awesome...

Follow the discussion

  • Oops, something didn't work.

    Getting subscription
    Subscribe to this conversation
    Unsubscribing
    Subscribing

Remove this comment

Remove this thread

Close

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.