HSL<->RGB and Color Manipulation Routines
Routines to convert between Hue-Saturation-Luminescence values an Red-Green-Blue color values (Converted from C++). Also several unique routines using these functions to manipulate color such as Brighten, Invert, PhotoNegative, Blend, Tint, etc. ***NOTE: I have reposted this with the original sorce (now complete). I am working on and will soon submit this in class form, once comments are added to the source.***
AI
สรุปโดย AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
ซอร์สโค้ด
Private Sub Command1_Click()
Dim i%, j%, R&, c&
'Simple routine to demonstrate color manipulation
'in a picture. Not fast but it works.
'Picture1 must contain an image and be Autosized to it.
'(Point will return -1 for pixels outside an image, and
'this is invalid)
For i = 0 To (Picture1.ScaleWidth - Screen.TwipsPerPixelX) _
Step Screen.TwipsPerPixelX
For j = 0 To (Picture1.ScaleHeight - Screen.TwipsPerPixelY) _
Step Screen.TwipsPerPixelY
c = Picture1.Point(i, j)
If c >= 0 Then
'Point will return -1 for pixels outside an image
c = PhotoNegative(c) 'Substitute any color routine here
'c = Tint(c,80)
'c = Brighten(c,0.1)
'c = Greyscale(c)
'etc.
Picture1.PSet (i, j), c
End If
Next j
Next i
End Sub
//ROMAN.CPP - Converts Arabic to Roman numerals
// Inspired by 'The Never Ending Debate About Roman Numerals'
// Author: J@w3s
// Version: 1.1.6
// Modified: July 23, 2001
/********************************************************************
Well, here it is folks... the ACCURATE and MODERN CONVERSION
from ARABIC numerals to ROMAN numerals! Yes, and this is based
on the strick rule that every digit (thousands, hundreds, tens, ones)
represents an equivalent ROMAN digit.
Here is a quick review of the ROMAN NUMERALS:
I = 1 V = 5 X = 10 L = 50 C = 100
D = 500 M = 1000
So combining these values, we can represent numbers up to
thousands digits. This SOURCE CODE will compute for conversions
up to 3999. I will make more additions to support up to
millions digits (later ;)
An alternative way of depicting larger numbers is by putting
a horizontal bar over the numeral which multiplies it by 1000.
Say you put a horizontal bar over V, it becomes 5000, or over
X, it becomes 10,000.
On a larger scale 3,852,429 can be depicted as
MMMDCCCL MMCDXXIX
On a small scale like the value 1999 (which have many
versions of roman numerals, and most debates on how to
represent it) is
MCMXCIX
I hope you find this very useful. And pls vote for my code!
Thanks! This is dedicated to all of c++ programmers, and
roman numeral fanatics. ;)
***************************************************************/
#include<iostream.h>
#include<conio.h>
#include<string.h>
main()
{
char thou[4], huns[5], tens[5], ones[5];
int n, thd, hd, tnd, od;
clrscr();
cout << "\n -=[ ROMAN NUMERALS ]=-";
cout << "\n Enter a number (1 - 3999): ";
cin >> n;
thd = n / 1000;
hd = (n % 1000) / 100;
tnd =((n % 1000) % 100) / 10;
od = ((n % 1000) % 100) % 10;
switch(thd)
{
case 1: strcpy(thou, "M");
break;
case 2: strcpy(thou, "MM");
break;
case 3: strcpy(thou, "MMM");
break;
default: strcpy(thou, "");
}
switch(hd)
{
case 1: strcpy(huns, "C");
break;
case 2: strcpy(huns, "CC");
break;
case 3: strcpy(huns, "CCC");
break;
case 4: strcpy(huns, "CD");
break;
case 5: strcpy(huns, "D");
break;
case 6: strcpy(huns, "DC");
break;
case 7: strcpy(huns, "DCC");
break;
case 8: strcpy(huns, "DCCC");
break;
case 9: strcpy(huns, "CM");
break;
default: strcpy(huns, "");
}
switch(tnd)
{
case 1: strcpy(tens, "X");
break;
case 2: strcpy(tens, "XX");
break;
case 3: strcpy(tens, "XXX");
break;
case 4: strcpy(tens, "XL");
break;
case 5: strcpy(tens, "L");
break;
case 6: strcpy(tens, "LX");
break;
case 7: strcpy(tens, "LXX");
break;
case 8: strcpy(tens, "LXXX");
break;
case 9: strcpy(tens, "XC");
break;
default: strcpy(tens, "");
}
switch(od)
{
case 1: strcpy(ones, "I");
break;
case 2: strcpy(ones, "II");
break;
case 3: strcpy(ones, "III");
break;
case 4: strcpy(ones, "IV");
break;
case 5: strcpy(ones, "V");
break;
case 6: strcpy(ones, "VI");
break;
case 7: strcpy(ones, "VII");
break;
case 8: strcpy(ones, "VIII");
break;
case 9: strcpy(ones, "IX");
break;
default: strcpy(ones, "");
}
cout << "\n The equivalent roman numeral is: ";
cout << thou << huns << tens << ones;
getch();
return 0;
}
Upload
ความคิดเห็นดั้งเดิม (3)
กู้คืนจาก Wayback Machine