Clan x86

Technical (Development, Security, etc.) => General Programming => New Project Announcements => Topic started by: Sidoh on August 14, 2006, 02:31:14 am

Title: Sixth Sense
Post by: Sidoh on August 14, 2006, 02:31:14 am
This is more of a project revival than a "new" project, persay, but I'm doing it from scratch. 

It's a service that dynamically generates images with data provided by an update client.  With this version, I plan to add things to allow display of one or more of randomly entered quotes or phrases as well.

I've been coding the update client in C#.  It's been the first practical .NET project I've worked on in a while.  It's definitely pretty sloppy, but it's working really well at the moment.  I need to add error handling (that comes in version 2.0 all the time anyway, right? ... >_>) and redo the plugin structure (I must consult master myndfyre :o), but, like I said, it works really well!

On the server side, I have the login verification and update handling taken care of.  Now I just need to code the rest of the interface and it's ready to go! >_>

Here are some screenshots of the update client:

(http://www.sidoh.org/~sidoh/ss_main.jpg)

(http://www.sidoh.org/~sidoh/ss_settings.jpg)

(http://www.sidoh.org/~sidoh/ss_plugins.jpg)

(http://www.sidoh.org/~sidoh/ss_pluginsettings.jpg)
Title: Re: Sixth Sense
Post by: Explicit on August 14, 2006, 02:35:57 am
I need to add error handling (that comes in version 2.0 all the time anyway, right? ... >_>)

ROFL, hilarious.
Title: Re: Sixth Sense
Post by: deadly7 on August 14, 2006, 08:52:00 am
For a second when I read this I thought you were making a computer app to sniff out dead people with..
Title: Re: Sixth Sense
Post by: MyndFyre on August 14, 2006, 03:50:27 pm
For a second when I read this I thought you were making a computer app to sniff out dead people with..
WEAK
Title: Re: Sixth Sense
Post by: Quik on August 14, 2006, 11:53:22 pm
Where's the screenie of it actually dynamically updating an image?? :p
Title: Re: Sixth Sense
Post by: Sidoh on August 15, 2006, 12:30:43 am
Where's the screenie of it actually dynamically updating an image?? :p

That's the easy part.  I'm much better at PHP than I am at C#.  I'll hopefully have it done in a month or so.
Title: Re: Sixth Sense
Post by: Joe on August 15, 2006, 01:18:53 am
I'm guessing it's Sixth Sense that made this (http://www.sidoh.org/sig/sig.php?act=display), right? I always wondered how you did that.
Title: Re: Sixth Sense
Post by: Sidoh on August 15, 2006, 01:51:29 am
I'm guessing it's Sixth Sense that made this (http://www.sidoh.org/sig/sig.php?act=display), right? I always wondered how you did that.

No, that's a quick project I threw together about a year ago for myself personally.  Sixth Sense was a service that allowed any person to register.  It was also a lot more robust, despite the lack of room for expansion in the way I coded both the server and the update client.  So far, this "version" is turning out a lot better.
Title: Re: Sixth Sense
Post by: Sidoh on August 21, 2006, 10:59:05 am
Alpha-ish version working pretty well.  Example product:

(http://www.sidoh.org/ss/index.php/sixthsense/viewdgi/15)

(http://www.sidoh.org/ss/index.php/sixthsense/viewdgi/16)

(http://www.sidoh.org/ss/index.php/sixthsense/viewdgi/17)
Title: Re: Sixth Sense
Post by: rabbit on August 21, 2006, 11:13:10 am
So much superfluous space...
Title: Re: Sixth Sense
Post by: Sidoh on August 21, 2006, 11:32:14 am
So much superfluous space...

How did I know it would be a negative, useless, obvious comment coming from you, rabbit? :P <3

I'm planning on adding a feature to read (or store) font widths, modify it by the size entered, and then dynamically resizing the image to fit that.

However, the only way to use the "older" generation of this product was to write ontop of a pre-made image.  I've been working pretty hard the last few days to get it to this point. :P
Title: Re: Sixth Sense
Post by: rabbit on August 21, 2006, 01:56:45 pm
Calculate the width and then generate the background image to a temp file to write on top of, then write on top of it and delete the temp, and save the final product in the display folder-y place?
Title: Re: Sixth Sense
Post by: MyndFyre on August 21, 2006, 05:28:10 pm
I love C#:

Code: [Select]
<% @Page Language="C#" AutoEventWireup="true" Debug="true" %>
<% @Import Namespace="System.Drawing" %>
<% @Import Namespace="System.Drawing.Imaging" %>
<% @Import Namespace="System.Drawing.Drawing2D" %>
<% @Import Namespace="System.IO" %>

<script runat="server">
void Page_Load(object sender, EventArgs e)
{
  Response.ContentType = "image/png";
  Response.Clear();

  Font font = new Font("Tahoma", 12.0f, GraphicsUnit.Point);
  string text = "Sidoh's old web service is gay.";
  SizeF textSize;
  using (Graphics g = Graphics.FromImage(new Bitmap(1, 1)))
  {
    textSize = g.MeasureString(text, font);
  }

  // make a rainbow gradient - need to start with junk values first
  LinearGradientBrush lgb = new LinearGradientBrush(new RectangleF(PointF.Empty, textSize), Color.Red, Color.Violet, 0.0f);
  ColorBlend blend = new ColorBlend();
  blend.Colors = new Color[] { Color.Red, Color.Orange, Color.Yellow, Color.Green, Color.Blue, Color.Indigo, Color.Violet };
  blend.Positions = new float[] { 0.0f, 0.16f, 0.33f, 0.5f, 0.66f, 0.83f, 1.0f };
  lgb.InterpolationColors = blend;

  Bitmap bmp = new Bitmap((int)textSize.Width, (int)textSize.Height, PixelFormat.Format32bppArgb);
  using (Graphics g = Graphics.FromImage(bmp))
  {
    g.FillRectangle(new SolidBrush(Color.LightGray), new RectangleF(PointF.Empty, textSize));
    g.DrawString(text, font, lgb, PointF.Empty);
  }
 
  using (MemoryStream ms = new MemoryStream())
  {
    bmp.Save(ms, ImageFormat.Png);
    ms.WriteTo(Response.OutputStream);
  }
  bmp.Dispose();
  lgb.Dispose();
}
</script>

See it in action:

http://www.jinxbot.net/test.aspx
Title: Re: Sixth Sense
Post by: Warrior on August 21, 2006, 06:19:54 pm
Myndy you're mean, and I love it.
Title: Re: Sixth Sense
Post by: Sidoh on August 21, 2006, 07:13:40 pm
Calculate the width and then generate the background image to a temp file to write on top of, then write on top of it and delete the temp, and save the final product in the display folder-y place?

The width is dynamic.  Constantly resizing the image on a request doesn't make any sense.  I'm fully aware how I would do that if it did, by the way. :P

If you're referring to the image with a blank background, then that's exactly what I was suggesting in the post you replied to...

MyndFyre: shut up.
Title: Re: Sixth Sense
Post by: Sidoh on August 22, 2006, 05:02:55 pm
Feature added! :)

(http://www.sidoh.org/ss/index.php/sixthsense/viewdgi/19)

(http://www.sidoh.org/ss/index.php/sixthsense/viewdgi/20)

(http://www.sidoh.org/ss/index.php/sixthsense/viewdgi/21)