Posted: Sun Oct 25, 2009 10:15 pm Post subject: Photoshop with Turing
What is it you are trying to achieve?
I am trying to create a photoshop program using turing (as you may have guessed from the title)
What is the problem you are having?
I can't seem to find a function in turing where you can find the RGB values of a certain pixel in a picture.
I know "whatdotcolour" will give me the "turing colour" between 0 and 255, but 256 colours is pitiful and hard to create a decent photoshop program with, does anyone know if there is a function like that where you can just find out the RGB values of the pixel.
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Since i could not find a function to do what i want i decided to just add more colours to turing, this is the code i have been working with, it is suppose to ceate a range of colours numbered between 0 and 1000000, but for some reason it stops at 1024 and won't add any more, is there a max amount of new colours that you can add to turing or is my programming just wrong?
Turing:
View.Set("graphics:1280;800, offscreenonly") var count :int:=0 var tempclr :int
for decreasing r :100.. 0 for decreasing b :100.. 0 for decreasing g :100.. 0 if count > 255then %adds a new colour past 255
tempclr :=RGB.AddColor(r / 100, b / 100, g / 100) else %changes default turing colour to specific RGB values RGB.SetColor(count, r / 100, b / 100, g / 100) endif
count +=1 endfor endfor endfor
count :=0 %suppose to fill every pixel with a different colour %this was just to make sure it worked, but it didn't for a :1.. maxx for b :1.. maxy drawdot(a, b, count) View.Update
count +=1 endfor endfor
Please specify what version of Turing you are using
4.1.1
Sponsor Sponsor
Tony
Posted: Sun Oct 25, 2009 10:52 pm Post subject: RE:Photoshop with Turing
Posted: Sun Oct 25, 2009 11:01 pm Post subject: RE:Photoshop with Turing
Yes, but with that function don't I have to input the number of the colour rather than the pixel location, which I am unable to do because my colours won't add correctly.
Tony
Posted: Sun Oct 25, 2009 11:06 pm Post subject: Re: RE:Photoshop with Turing
Michael516 @ Sun Oct 25, 2009 11:01 pm wrote:
with that function don't I have to input the number of the colour
Right. And you already know how to get the number of the colour at a pixel location.
Posted: Sun Oct 25, 2009 11:14 pm Post subject: RE:Photoshop with Turing
That would work but it is slightly inaccurate, for example I made a program that would display a picture and tell me the colour value of the pixel underneath the mouse pointer and it worked, but when I moved my mouse over areas of similar colours such as on a cloud, it would tell me that the entire thing was only one or two colours.
Tony
Posted: Sun Oct 25, 2009 11:39 pm Post subject: RE:Photoshop with Turing
once again, documentation is your friend -- RGBmodule
Quote:
If you attempt to determine the color number of a particular pixel that does not match any of the colors in Turing's color palette, then Turing will return the color number of the color in the Turing palette that most closely matches that color of the pixel.
Posted: Mon Oct 26, 2009 11:45 am Post subject: RE:Photoshop with Turing
Note that Turing DOES have a 1024 color limit. With clever programming that deletes/creates colors as they are needed. People have created modules for this on this site.
SNIPERDUDE
Posted: Mon Oct 26, 2009 2:13 pm Post subject: Re: Photoshop with Turing
Michael516 @ October 25th 2009 wrote:
Please specify what version of Turing you are using
4.1.1
May I suggest switching to Turing 4.1 (as apposed to 4.1.1), for some reason this most latest version does not compile right. 4.1 has all the same features though, so no loss. This of course doesn't fix your current problem, but will prevent future problems when you try to make your programme an EXE.
Sponsor Sponsor
mirhagk
Posted: Mon Dec 14, 2009 3:25 pm Post subject: RE:Photoshop with Turing
hey so I was wondering, is there a way to get the actually colour values, (like accessing the exact memory within the window maybe???)
DemonWasp
Posted: Mon Dec 14, 2009 3:37 pm Post subject: RE:Photoshop with Turing
RGB.GetColour(num, r, g, b : int)
mirhagk
Posted: Mon Dec 14, 2009 11:35 pm Post subject: RE:Photoshop with Turing
thats not what i meant, i meant like whatdotcolour except resulting in exact colour values (not the preset 256 colours)
DemonWasp
Posted: Tue Dec 15, 2009 12:01 am Post subject: RE:Photoshop with Turing
Look at the specification for what I wrote. If you use whatdotcolour to find the colour number for a displayed colour, you can use RGB.GetColour to get the red, green and blue values for it. This gives you "exact colour values".
mirhagk
Posted: Tue Dec 15, 2009 12:06 am Post subject: RE:Photoshop with Turing
no that doesn't, whatdotcolour returns the closet 256 colour, so essentially all that would do is get the red, green and blue of the closest 256 colour. I want exact
Tony
Posted: Tue Dec 15, 2009 12:45 am Post subject: RE:Photoshop with Turing
You can change the preset colours, pick out the closest colour, and refine your presets until you get to the exact value.
Posted: Tue Dec 15, 2009 12:50 am Post subject: Re: Photoshop with Turing
Yes, though a clever methods insectoid was talking about. Though there's no built in function. You'd have to hack away at it recursively like a search function using the WhatDotColour/GetColour combo. Just imagine the colour cube as a 3 dimensional array that your searching.