Click here to Skip to main content
15,916,280 members
Home / Discussions / C#
   

C#

 
GeneralRe: Correct way of doing installer in Windows.... Pin
Pete O'Hanlon28-Jun-12 5:46
mvePete O'Hanlon28-Jun-12 5:46 
GeneralRe: Correct way of doing installer in Windows.... Pin
glennPattonWork328-Jun-12 5:57
professionalglennPattonWork328-Jun-12 5:57 
GeneralRe: Correct way of doing installer in Windows.... Pin
Pete O'Hanlon28-Jun-12 6:13
mvePete O'Hanlon28-Jun-12 6:13 
GeneralRe: Correct way of doing installer in Windows.... Pin
glennPattonWork329-Jun-12 0:52
professionalglennPattonWork329-Jun-12 0:52 
GeneralRe: Correct way of doing installer in Windows.... Pin
glennPattonWork329-Jun-12 4:47
professionalglennPattonWork329-Jun-12 4:47 
QuestionC# and mySQL question - Salary Slips Pin
Jassim Rahma28-Jun-12 1:52
Jassim Rahma28-Jun-12 1:52 
AnswerRe: C# and mySQL question - Salary Slips Pin
Abhinav S28-Jun-12 2:20
Abhinav S28-Jun-12 2:20 
GeneralRe: C# and mySQL question - Salary Slips Pin
Jassim Rahma28-Jun-12 2:31
Jassim Rahma28-Jun-12 2:31 
AnswerRe: C# and mySQL question - Salary Slips Pin
Pete O'Hanlon28-Jun-12 2:38
mvePete O'Hanlon28-Jun-12 2:38 
QuestionOpenXML SDK - a link in MS Excel to open another MS Excel. how would the request be authenticated? Pin
Rijz27-Jun-12 19:20
Rijz27-Jun-12 19:20 
AnswerRe: OpenXML SDK - a link in MS Excel to open another MS Excel. how would the request be authenticated? Pin
Richard MacCutchan27-Jun-12 22:29
mveRichard MacCutchan27-Jun-12 22:29 
GeneralRe: OpenXML SDK - a link in MS Excel to open another MS Excel. how would the request be authenticated? Pin
Rijz27-Jun-12 23:47
Rijz27-Jun-12 23:47 
GeneralNeed some general feedback on my WCF Pin
Software200727-Jun-12 14:30
Software200727-Jun-12 14:30 
GeneralRe: Need some general feedback on my WCF Pin
Richard MacCutchan27-Jun-12 22:28
mveRichard MacCutchan27-Jun-12 22:28 
GeneralRe: Need some general feedback on my WCF Pin
Software200728-Jun-12 6:09
Software200728-Jun-12 6:09 
GeneralRe: Need some general feedback on my WCF Pin
Richard MacCutchan28-Jun-12 6:40
mveRichard MacCutchan28-Jun-12 6:40 
QuestionScope issue closing a connection after exception Pin
Harley Burton27-Jun-12 6:02
Harley Burton27-Jun-12 6:02 
AnswerRe: Scope issue closing a connection after exception Pin
Pete O'Hanlon27-Jun-12 6:13
mvePete O'Hanlon27-Jun-12 6:13 
AnswerRe: Scope issue closing a connection after exception Pin
Luc Pattyn27-Jun-12 6:20
sitebuilderLuc Pattyn27-Jun-12 6:20 
SuggestionRe: Scope issue closing a connection after exception Pin
kisMicrosoftDev27-Jun-12 6:29
kisMicrosoftDev27-Jun-12 6:29 
GeneralRe: Scope issue closing a connection after exception Pin
Harley Burton27-Jun-12 6:57
Harley Burton27-Jun-12 6:57 
GeneralRe: Scope issue closing a connection after exception Pin
mohancbe27-Jun-12 21:11
mohancbe27-Jun-12 21:11 
AnswerRe: Scope issue closing a connection after exception Pin
Harley Burton14-Aug-19 4:37
Harley Burton14-Aug-19 4:37 
GeneralDrawImage with NearestNeighbor-Interpolation Pin
LionAM27-Jun-12 2:03
LionAM27-Jun-12 2:03 
GeneralRe: DrawImage with NearestNeighbor-Interpolation Pin
Luc Pattyn27-Jun-12 9:47
sitebuilderLuc Pattyn27-Jun-12 9:47 
(this gibberish sentence has been necessary to get the message accepted by CP as it "appears to have already been posted")

No I've never seen that function being available. However there are two simple solutions for what you seem to want:

1.
the interpolation is quite simple, it basically is a linear re-scaling, something like:
xNew = x * scaleNew / scaleOld


and then the options determine the petty details.
For one you need a floating point operation, and the result needs turned into an int again; that is where NearestNeighbor comes in (it basically means regular rounding: less than 0.5 becomes 0; 0.5 or more becomes 1). And PixelOffsetMode.Half means 0.5 is added anyways, so I would give this a try:
xNew = floor (*(x+0.5) * floatScaleNew / floatScaleOld)+0.5)


Caveat: one has to be careful with negative values, so when you run some tests, include both positive and negative values (unless negatives are irrelevant to your app).

2.
As a big alternative you could simply use the function they use without having direct access to it; this is how it works:
make a synthetic image, width=your original width, height=1; fill it with a wedge, i.e. the values 0, 1, 2, 3... etc. if it is a gray image; or perhalps (0,0,0), (1,1,1), (2,2,2), (3,3,3) if you prefer a regular RGB image (you may need a modulo-256 then).
now let the system apply your scaling to it (in x direction), yielding a larger image with the same width as your actual scaled image. When you click the actual scaled image, use the mouse position and look into the scaled synthetic image; it will return a pixel value which equals the original x coordinate (or at least the lowest 8-bits of it if your synthetic is RGB).
You can use the same trick in the other direction of course (i.e. there is no need to have a 2-D synthetic image).

Smile | :)
Luc Pattyn [My Articles] Nil Volentibus Arduum


modified 27-Jun-12 15:58pm.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.