Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 RGB color picker
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
thoughtful




PostPosted: Sun Nov 16, 2003 11:02 pm   Post subject: RGB color picker

This is an RGB color picker that i made.

code:

import GUI
var slider : array 1 .. 3 of int
var Red, Green, Blue : int
var font : int := Font.New ("Ariel:16")
var clr : int
setscreen ("graphics:280;350,title:Thoughtful Color Mixer")
Red := 255 div 2
Green := 255 div 2
Blue := 255 div 2

proc add_clr
    clr := RGB.AddColor (Red / 255, Green / 255, Blue / 255)
end add_clr

proc draw
    drawfillbox (10, 300, 260, 340, clr)
end draw

proc values
    drawfillbox (135, 230, 190, 250, white)
    drawfillbox (135, 130, 190, 150, white)
    drawfillbox (135, 30, 190, 50, white)
    Font.Draw (intstr (Red), 135, 230, font, black)
    Font.Draw (intstr (Green), 135, 130, font, black)
    Font.Draw (intstr (Blue), 135, 30, font, black)
end values

procedure RedMoved (value : int)
    Red := value

    values
    add_clr
    draw
end RedMoved

procedure GreenMoved (value : int)
    Green := value

    values
    add_clr
    draw
end GreenMoved

procedure BlueMoved (value : int)
    Blue := value

    values
    add_clr
    draw
end BlueMoved
slider (1) := GUI.CreateHorizontalSlider (10, 210, 255,
    0, 255, 255 div 2, RedMoved)
slider (2) := GUI.CreateHorizontalSlider (10, 110, 255,
    0, 255, 255 div 2, GreenMoved)
slider (3) := GUI.CreateHorizontalSlider (10, 10, 255,
    0, 255, 255 div 2, BlueMoved)
values
loop
    exit when GUI.ProcessEvent

end loop
Sponsor
Sponsor
Sponsor
sponsor
AsianSensation




PostPosted: Sun Nov 16, 2003 11:46 pm   Post subject: (No subject)

http://www.compsci.ca/v2/viewtopic.php?t=767

lol, good job done anyways
Tony




PostPosted: Sun Nov 16, 2003 11:51 pm   Post subject: (No subject)

hmm... I'd be interested in seeing one of them colordropper tools app. Like where all the colors are already premixed for you, and you just click on the pixel with the one you like.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: