Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Graphic Manipulation: Nonlinear Magnification ("fisheye views", "distortion-oriented presentation", or "focus+context")

Posted on 2001-07-09
Medium Priority
Last Modified: 2010-04-06
Hi all,
  back with another question about magnification.  straight forward magnification in easy, but i wanted to look into "nonlinear magnification" a bit, but can not find any routines/algorithms/etc to even play with.  here is one of the links i have been looking at:


maybe i missed something.  pay special attention to


this is something i would very much like to learn how to do.  it looks like you could apply a lookup table to a grabbed image and get the right effect, but unfortunately i have not been able to find one of those either.  maybe a modified "magnifying glass" lookup table?  

anyone know anything about this?

also, assuming i do find a lookup table, is there a fast way to apply one to a bitmap?
Question by:felonious
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 6269747
I've looked at this in the past (with better and worse results) and what I did was to come up with a function that translates the destination position to a position on the source image. You probably already know that. What I've always used is the trig functions SIN and COS and (this is off the top of my head so no promises) done something like this:

  deg2rad = PI / 180;

IF x < (Dest.Width DIV 2)
  sx := ROUND((Dest.Width DIV 2) * COS(deg2rad * (90 - (x / Dest.Width DIV 2))))
  sx := (Dest.Width DIV 2) + ROUND((Dest.Width DIV 2) * COS(deg2rad * (90 - (x / Dest.Width DIV 2))));

IF (sx < 0) OR (sx > Dest.Width) //Check that the pixel is not off the edge of the image
  Dest.Pixels[x, y] := clSilver  //Pixel out of range - Blank it
  Dest.Pixels[x, y] := Source[sx, y];

That only demonstrates scaling in one direction but once you've got it working happily in one direction you simpyl apply the same scaling process to the y value and it should give you a fisheye lens effect. Apologies for using Pixels but I can't remember the scanline code off the top of my head (besides which, pixels are easier to debug. I will work with scanlines though)

Hope that's some help (probably won't be though)

The neil =:)

Expert Comment

ID: 6274586

Author Comment

ID: 6282283
The Neil,
  Sorry I took so long to get back to you.  I had a chance to mess around with the above code and after a bit to tweaking I got it to compile.  I tried it on a number of different size images and it never seemed to produce the right kind of effect.

  I've found a few different pieces of code to do whats called a 'lens effect' in the demo scene.  So far only one looks promising.  Ofcourse this isn't *exactly* the effect I wanted, but maybe with some tweaking it will work for my purposes.  

  If either of you would like to see this code, tell me and I will either post a link to it or send you the files directly to mess around with.  I haven't had much luck 'ripping' the code that I want to use from it (mainly because I don't know how it works yet), but I haven't really taken the time to study it in depth.  Maybe one of you could figure it out for me :)  If you interested, comment.

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.


Expert Comment

ID: 6282478

I'd be interested in having a look at the code (TheNeil@Eudoramail.com). Mine is awkward at the best of times and lacks any sort of control. It does work but probably isn't what you were after in the first place

The Neil =:)

Author Comment

ID: 6282514
I've sent the neil two program sources I had found a few days ago.  if anyone else would like to look at them, feel free to comment here with your email address and I will be happy to send you them.  The first source achieves the same effect you see in the above link:


the second is much faster but does something a bit different (it's called a lens effect)

LVL 26

Expert Comment

by:Russell Libby
ID: 8702723
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

To be PAQ/Refund

Please leave any comments here within the next seven days.
Thank you,

EE Cleanup Volunteer

Accepted Solution

PashaMod earned 0 total points
ID: 8818642
Per recommendation

CS Moderator @Experts Exchange

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question