diff options
| author | jacob1 <jfu614@gmail.com> | 2013-02-08 16:39:14 (GMT) |
|---|---|---|
| committer | jacob1 <jfu614@gmail.com> | 2013-02-08 16:39:14 (GMT) |
| commit | cd0af92fb316a3e3dc2de7082512ff2d650e7a70 (patch) | |
| tree | dfb7b0dc5f12df7145ec84eea6efe2417c16748c /src/colourpicker/ColourPickerActivity.cpp | |
| parent | 8e02443f0a294fcec9bcc8678dcf8b61f0d56f99 (diff) | |
| download | powder-cd0af92fb316a3e3dc2de7082512ff2d650e7a70.zip powder-cd0af92fb316a3e3dc2de7082512ff2d650e7a70.tar.gz | |
minor fixes to color picker / small speed improvement
Diffstat (limited to 'src/colourpicker/ColourPickerActivity.cpp')
| -rw-r--r-- | src/colourpicker/ColourPickerActivity.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/src/colourpicker/ColourPickerActivity.cpp b/src/colourpicker/ColourPickerActivity.cpp index 65bccc9..966cd41 100644 --- a/src/colourpicker/ColourPickerActivity.cpp +++ b/src/colourpicker/ColourPickerActivity.cpp @@ -169,7 +169,7 @@ void ColourPickerActivity::OnMouseDown(int x, int y, unsigned button) { x -= Position.X+5; y -= Position.Y+5; - if(x >= 0 && x <= 256 && y >= 0 && y < 127) + if(x >= 0 && x < 256 && y >= 0 && y <= 128) { mouseDown = true; currentHue = (float(x)/float(255))*359.0f; @@ -185,7 +185,7 @@ void ColourPickerActivity::OnMouseDown(int x, int y, unsigned button) currentHue = 0; } - if(x >= 0 && x <= 256 && y >= 131 && y < 142) + if(x >= 0 && x < 256 && y >= 132 && y <= 142) { valueMouseDown = true; currentValue = x; @@ -295,13 +295,18 @@ void ColourPickerActivity::OnDraw() g->blendpixel(value+offsetX, i+offsetY+127+5, cr, cg, cb, currentAlpha); } + //draw color square pointer int currentHueX = clamp_flt(currentHue, 0, 359); int currentSaturationY = ((255-currentSaturation)/2); - g->xor_line(offsetX+currentHueX, offsetY+currentSaturationY-5, offsetX+currentHueX, offsetY+currentSaturationY+5); - g->xor_line(offsetX+currentHueX-5, offsetY+currentSaturationY, offsetX+currentHueX+5, offsetY+currentSaturationY); - - g->xor_line(offsetX+currentValue, offsetY+4+128, offsetX+currentValue, offsetY+13+128); - g->xor_line(offsetX+currentValue+1, offsetY+4+128, offsetX+currentValue+1, offsetY+13+128); + g->xor_line(offsetX+currentHueX, offsetY+currentSaturationY-5, offsetX+currentHueX, offsetY+currentSaturationY-1); + g->xor_line(offsetX+currentHueX, offsetY+currentSaturationY+1, offsetX+currentHueX, offsetY+currentSaturationY+5); + g->xor_line(offsetX+currentHueX-5, offsetY+currentSaturationY, offsetX+currentHueX-1, offsetY+currentSaturationY); + g->xor_line(offsetX+currentHueX+1, offsetY+currentSaturationY, offsetX+currentHueX+5, offsetY+currentSaturationY); + + //draw brightness bar pointer + int currentValueX = restrict_flt(currentValue, 0, 254); + g->xor_line(offsetX+currentValueX, offsetY+4+128, offsetX+currentValueX, offsetY+13+128); + g->xor_line(offsetX+currentValueX+1, offsetY+4+128, offsetX+currentValueX+1, offsetY+13+128); } ColourPickerActivity::~ColourPickerActivity() { |
