invert

How do I invert a colour?

I know that this won't directly invert a colour, it will just 'oppose' it. I was wondering if anyone knew a simple way (a few lines of code) to invert a colour from any given colour? At the moment I have this (which isn't exactly the definition of an invert): const int RGBMAX = 255; Color InvertMeAColour(Color ColourToInvert) { re...

Invert function: base 38 conversion

Hello! Can you tell me how the invert function for the following PHP function is? <?php function id2secure($old_number) { $alphabet_en = '1357902468acegikmoqsuwybdfhjlnprtvxz-_'; $new_number = ''; while ($old_number > 0) { $rest = $old_number%38; if ($rest >= 38) { return FALSE; } $new_number .= $alphabet_en[$rest]; $old_num...

How can I invert a regular expression in JavaScript?

I have a string A and want to test if another string B is not part of it. This is a very simple regex whose result can be inverted afterwards. I could do: /foobar/.test('[email protected]') and invert it afterwards, like this: !(/foobar/).test('[email protected]') The problem I have is, that I need to do it within the regular expression ...

How to compute ifft from fft?

Hello, I've done a fft to get fundamental frequency in real time and to implement high and low pass filters. Now I want to be able to record to a .wav file after I apply a filter. First I'll have to invert the fft and that is my question. What are the steps to do this? I use the FFT defined in this project. Here is the code for it: ...

Inverting a diff or patch || CVS diff

In CVS, my working copy (WC) is on a certain branch (which we'll call "foo"). There have been other changes checked into foo by another dev. I want to do a diff between my WC and the upstream state of foo. Normally, when working in the trunk (HEAD), I just do a cvs diff, and that's fine. But for some reason when doing a plain cvs dif...

Automatically convert CSS file to be used on dark backgrounds

I have about 200 CSS files like this: /** * GeSHi Dynamically Generated Stylesheet * -------------------------------------- * Dynamically generated stylesheet for bnf * CSS class: , CSS id: * GeSHi (C) 2004 - 2007 Nigel McNie, 2007 - 2008 Benny Baumann * (http://qbnz.com/highlighter/ and http://geshi.org/) * --------------------...

Draw standard NSImage inverted (white instead of black)

I'm trying to draw a standard NSImage in white instead of black. The following works fine for drawing the image in black in the current NSGraphicsContext: NSImage* image = [NSImage imageNamed:NSImageNameEnterFullScreenTemplate]; [image drawInRect:r fromRect:NSZeroRect operation:NSCompositeSourceOver fraction:1.0]; I expected NSComposi...

Is there a conventional method for inverting NSColor values?

I'm looking for a way to invert arbitrary NSColor values at runtime, and there doesn't appear to be any built-in method to do so. I will be using a category to extend NSColor as follows: NSColor * invertedColor = [someOtherColor inverted]; Here is the category method prototype that I am using: @implementation NSColor (MyCategories) ...

opengl invert framebuffer pixels

I was wondering was the best way to invert the color pixels in the frame buffer is. I know it's possible to do with glReadPixels() and glDrawPixels() but the performance hit of those calls is pretty big. Basically, what I'm trying to do is have an inverted color cross-hair which is always visible no matter what's behind it. For instance...

Flipping/Inverting/Mirroring text using css only

I did some googling and here's my answer <!--[if IE]> <style> .mirror { filter: progid:DXImageTransform.Microsoft.BasicImage(mirror=1); } </style> <![endif]--> <style> .mirror { display:block; -moz-transform: matrix(-1, 0, 0, 1, 0, 0); -webkit-transform: matrix(-1, 0, 0, 1, 0, 0); -o-transform:matrix(-1...

Cannot create a program which will invert string

I am using Linux. I am trying to write a program in c that will print a string backward. Here is my code: #include <stdio.h> #include <string.h> #include <stdlib.h> int main (){ char string[100]; printf ("Enter string:\n"); gets (string); int length = strlen (string)-1; for (length = length; length>=0; length--){ ...

Inverted-colors text on top of an OpenGL scene

Hello, I have a font texture which I use in order to draw text on top of my OpenGL scene. The problem is that the scene's colors vary so much that any solid color I use is hard to read. Is it possible to draw my font texture with inverted colors? A call to glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); would just draw it with a sol...

Regex: Extracting readable (non-code) text and URLs from HTML documents

I am creating an application that will take a URL as input, retrieve the page's html content off the web and extract everything that isn't contained in a tag. In other words, the textual content of the page, as seen by the visitor to that page. That includes 'masking' out everything encapsuled in <script></script>, <style></style> and <!...