Messages - VideoInPicture [ switch to compact view ]

Pages: prev1 ... 6 7 8 9 10 [11] 12 13 14 15 16 ... 94next
Finished Programs / Re: IDEA: Photo Downloader Kiosk
« on: October 27, 2008, 09:47 PM »
I haven't played around with the AHK code enough to give a good image scaling function in that will preserve the aspect ratio in AHK, but below is what I wrote to scale images in Circle Dock that preserves the aspect ratio while maximizing the image size given a desired size. I think it should be pretty easy for you guys to transfer this C# code to AHK form.

Code: C# [Select]
  1. /// <summary>
  2.         /// Returns a bitmap resized to fit inside NewWidth and NewHeight without aspect ratio change. Uses high quality scaling.
  3.         /// Returns null if an error is encountered.
  4.         /// </summary>
  5.         /// <param name="Bitmap">Image to resize.</param>
  6.         /// <param name="NewWidth">Width of the resized bitmap.</param>
  7.         /// <param name="NewHeight">Height of the resized bitmap.</param>
  8.         public static Bitmap ScaleBySizeBestFit(ref Bitmap Bitmap, int NewWidth, int NewHeight)
  9.         {
  10.             try
  11.             {
  12.                 Bitmap scaledBitmap = new Bitmap(NewWidth, NewHeight);
  14.                 // Scale the bitmap in high quality mode.
  15.                 using (Graphics gr = Graphics.FromImage(scaledBitmap))
  16.                 {
  17.                     gr.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighSpeed;
  18.                     gr.PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.HighSpeed;
  19.                     gr.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighSpeed;
  20.                     gr.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
  22.                     double scaledBitmapAspectRatio = (double)scaledBitmap.Width / (double)scaledBitmap.Height;
  23.                     double sourceBitmapAspectRatio = (double)Bitmap.Width / (double)Bitmap.Height;
  25.                     int bestLeft, bestRight, bestTop, bestBottom, calcWidth, calcHeight;
  27.                     if (sourceBitmapAspectRatio > scaledBitmapAspectRatio)      // The source bitmap is wider
  28.                     {
  29.                         bestLeft = 0;
  30.                         bestRight = scaledBitmap.Width;
  32.                         calcHeight = (int)((double)scaledBitmap.Width / sourceBitmapAspectRatio);
  33.                         bestTop = (scaledBitmap.Height - calcHeight) / 2;
  34.                         bestBottom = calcHeight;
  35.                     }
  36.                     else
  37.                     {
  38.                         bestTop = 0;
  39.                         bestBottom = scaledBitmap.Height;
  41.                         calcWidth = (int)((double)scaledBitmap.Height * sourceBitmapAspectRatio);
  42.                         bestLeft = (scaledBitmap.Width - calcWidth) / 2;
  43.                         bestRight = calcWidth;
  44.                     }
  46.                     gr.DrawImage(Bitmap, new Rectangle(bestLeft, bestTop, bestRight, bestBottom), new Rectangle(0, 0, Bitmap.Width, Bitmap.Height), GraphicsUnit.Pixel);
  47.                 }
  49.                 return scaledBitmap;
  50.             }
  51.             catch (Exception)
  52.             {
  53.                 return null;
  54.             }
  55.         }
  56.     }

How about simply using one of the online storage websites like

You can download their client that sits on your computer and it creates a special folder that gets synchronized across all the computers where you are running the DropBox client. Synchronization happens in real time.

I think he is using a C++ mouse hook: which would work on all windows versions 95 and up. The hook captures the mouse click events and gives you an option of cancelling them or doing something else.

This is a good article that can tell you how to set up a C++ mouse hook:
I'm currently using a modified version of that program to quickly allow me to make a window always on top by simply right-clicking on the title bar of a window. It is very useful for me because I often have a need to put a window always on top and right-clicking on a window title bar is the quickest and most convenient way I could think of. Right-click again on a window will make it a normal level window. Note that you will need the Microsoft Foundation Classes found in the standard and professional versions of Microsoft Visual Studio if you want to compile the program in the above URL.

Circle Dock / Re: Help again Please
« on: October 24, 2008, 08:37 PM »
Yes, it can be a bit difficult to get the icons where you want because a circle can only had a limited number of icons and then it over flows, meaning that it has to push the last icon in the circle out to the next ring. One thing you could try is to put the icons you want together in the outer circle and then drag and drop them back into the inner circle. You can do this by simply drag and dropping dummy files on to the dock to fill up the inner circle and then delete them once you are finished restructuring. You can quickly delete an icon on the dock by placing your mouse over it and then pressing your delete key on the keyboard.

To make sure two items get swapped within the same circle, ensure that your mouse is over top of another icon in the circle when you release your mouse button.

Don't mean to be just sounding negative, because this is an interesting idea, but I really don't think many people could out do a computer on this one. I could be wrong, but I do know of some folks who are just abysmal at pattern recognition.

Maybe they've been probed by aliens and have a computer controlled brain :D

I don't know how well a geometric pattern captcha would work but I think it would be interesting. I'll have to do a lot more thinking about it though.

I still like the cat/dog captcha. Something easy to make,  update with new images, easy for humans to see and hard for computers.


The author should really apply some distortion effects to those images to prevent automated attacks where the computer can just compare images.

Pages: prev1 ... 6 7 8 9 10 [11] 12 13 14 15 16 ... 94next
Go to full version