Color Picker

Posts 115 of 16 · Page 1 of 2
Color Picker
Well i decided to release my color picker i made becuase i really only done it for fun.
I was going to put it in the DirectX section, But it will get more views here.

All it is, is a sprite, with a simple GetPixel to get the color of the selected mouse reigon.
You can then use that color to use on Chams, ESP, Crosshairs, Anything that you need to specify a color for really.

I have included the sprite bytes in a notepad file. as it is too big to post here.

Code:
RGBColors color;

class RGBColors
{
public:
	int xred;
	int xgreen;
	int xblue;
};
You will also need the class to use the colors whereva you want.
Thanks to GodHack2 for this.

Code:
D3DXVECTOR3 POS; 
POS.x = 20; 
POS.y = 600; 
POS.z = 0; 

Sprite->Begin(D3DXSPRITE_ALPHABLEND); 
Sprite->Draw(MenuTexture,NULL,NULL,&POS,0xFFFFFFFF);
Sprite->End();
That do draw the sprite.

Code:
POINT pos;
GetCursorPos(&pos);

if(pos.x > 10 && pos.x < 285 && pos.y > 570 && pos.y < 737)
{
	POINT pos;
	GetCursorPos (&pos);

	if(GetAsyncKeyState(VK_LBUTTON)<0) 				
	{
		HDC hScreenDC = GetDC (NULL);
		COLORREF Colors = GetPixel (hScreenDC, pos.x, pos.y);
		ReleaseDC (NULL, hScreenDC);

		color.xred = GetRValue (Colors);
		color.xgreen = GetGValue (Colors);
		color.xblue = GetBValue (Colors);
	}
	NewText(20, 580, White, " X-Hair Color:");
	if(color.xred && color.xgreen && color.xblue > 0) FillRGB( 100, 582, 80, 10, D3DCOLOR_XRGB(color.xred,color.xgreen,color.xblue), pDevice); //if(color.xred && color.xgreen && color.xblue > 0 -- some simple error handeling
}
The main function of code to get the color from the selected reigon.

Code:
if(CH_xhair) {
		if(color.xred && color.xgreen && color.xblue > 0) DrawCrosshair(pDevice,15,1,D3DCOLOR_XRGB(color.xred,color.xgreen,color.xblue));
	}
And an example of how to use the color

If you do use this, Please credit me.

Also, Here is the sprite image.



And how it looks in ca ( minus the tabs and background)



acid_buRn
Sprite.txtattachment deleted · 204 downloads before removal
Good share.

Though I wish the POS weren't hardcoded.
Also I dont think this line does what you think it does.
[highlight=c++]
if(color.xred && color.xgreen && color.xblue > 0)
[/highlight]

Lastly color values as well as screen positions are all positive numbers so the error checking probably isn't needed, but if it is one might want to check for screen coords, since i'm not sure what happen if you take a pos outside of the screen.

But that's enough nitpicking. Thanks for the share.
nice share,,

But u used sprites.
Quote Originally Posted by why06 View Post
Good share.

Though I wish the POS weren't hardcoded.
Also I dont think this line does what you think it does.
[highlight=c++]
if(color.xred && color.xgreen && color.xblue > 0)
[/highlight]

Lastly color values as well as screen positions are all positive numbers so the error checking probably isn't needed, but if it is one might want to check for screen coords, since i'm not sure what happen if you take a pos outside of the screen.

But that's enough nitpicking. Thanks for the share.
If i didnt add that error checking, it crashes becuase no number is specified for the RGB color.
Just something simple. to prevent anything crashing

Quote Originally Posted by topblast View Post
nice share,,

But u used sprites.
Does it matter? lol
Quote Originally Posted by ac1d_buRn View Post


If i didnt add that error checking, it crashes becuase no number is specified for the RGB color.
Just something simple. to prevent anything crashing



Does it matter? lol
At least it works but look at the texture maping
ive had my own one of theis for a wile thanks anyways tho
thanks for sharing this
Nice work. I did mine the same way back then, using the windows SDK macros, except I used a more sleek sprite.

Here it is, if anyone wants it:
Quote Originally Posted by CodeDemon View Post
Nice work. I did mine the same way back then, using the windows SDK macros, except I used a more sleek sprite.

Here it is, if anyone wants it:
that looks pretty slick.
Would be smaller and better to use in menus like mine i think.
Thanks for that,
good job GEEZUS!
Quote Originally Posted by ac1d_buRn View Post
Well i decided to release my color picker i made becuase i really only done it for fun.
I was going to put it in the DirectX section, But it will get more views here.

All it is, is a sprite, with a simple GetPixel to get the color of the selected mouse reigon.
You can then use that color to use on Chams, ESP, Crosshairs, Anything that you need to specify a color for really.

I have included the sprite bytes in a notepad file. as it is too big to post here.

Code:
RGBColors color;

class RGBColors
{
public:
	int xred;
	int xgreen;
	int xblue;
};
You will also need the class to use the colors whereva you want.
Thanks to GodHack2 for this.

Code:
D3DXVECTOR3 POS; 
POS.x = 20; 
POS.y = 600; 
POS.z = 0; 

Sprite->Begin(D3DXSPRITE_ALPHABLEND); 
Sprite->Draw(MenuTexture,NULL,NULL,&POS,0xFFFFFFFF);
Sprite->End();
That do draw the sprite.

Code:
POINT pos;
GetCursorPos(&pos);

if(pos.x > 10 && pos.x < 285 && pos.y > 570 && pos.y < 737)
{
	POINT pos;
	GetCursorPos (&pos);

	if(GetAsyncKeyState(VK_LBUTTON)<0) 				
	{
		HDC hScreenDC = GetDC (NULL);
		COLORREF Colors = GetPixel (hScreenDC, pos.x, pos.y);
		ReleaseDC (NULL, hScreenDC);

		color.xred = GetRValue (Colors);
		color.xgreen = GetGValue (Colors);
		color.xblue = GetBValue (Colors);
	}
	NewText(20, 580, White, " X-Hair Color:");
	if(color.xred && color.xgreen && color.xblue > 0) FillRGB( 100, 582, 80, 10, D3DCOLOR_XRGB(color.xred,color.xgreen,color.xblue), pDevice); //if(color.xred && color.xgreen && color.xblue > 0 -- some simple error handeling
}
The main function of code to get the color from the selected reigon.

Code:
if(CH_xhair) {
		if(color.xred && color.xgreen && color.xblue > 0) DrawCrosshair(pDevice,15,1,D3DCOLOR_XRGB(color.xred,color.xgreen,color.xblue));
	}
And an example of how to use the color

If you do use this, Please credit me.

Also, Here is the sprite image.



And how it looks in ca ( minus the tabs and background)



acid_buRn
your one is of the released one the simplest, thats good.

simple = not much code
not much code = not much work
etc.

i complettly rewrited it and made my personal one



and a snippet
Code:
void cGUI::DrawColorPicker(LPDIRECT3DDEVICE9 pDevice,cButton &Button,COLOR &Col)
{
	if(Button.Return){
		if(SPRCR){
			D3DXCreateTextureFromFileInMemory(pDevice,&Color,sizeof(Color),&D3D.Settings.MenuTexture);
			D3DXCreateSprite(pDevice,&D3D.Settings.Sprite);
			SPRCR = false;
		}

		D3D.Draw.Box(29,438,264,163,1,0x8D04A0A0,0xFF030303,pDevice,true,false);
		D3D.Draw.String(33,440,0xFF3DFFFF,D3D.Settings.pFont,"Color:");
		D3D.Draw.FillRGB(62,442,183,11,Col.ConvertToDWORD(),pDevice,false);
		D3D.Draw.String(60,585,LightAvacado,D3D.Settings.pFont,"Thx ac1d_buRn for the Idea. Its not copied!");

		D3DXVECTOR3 POS; 
		POS.x = 33; 
		POS.y = 457; 
		POS.z = 0; 

		D3D.Settings.Sprite->Begin(D3DXSPRITE_ALPHABLEND); 
		D3D.Settings.Sprite->Draw(D3D.Settings.MenuTexture,NULL,NULL,&POS,0xFFFFFFFF);
		D3D.Settings.Sprite->End();

		if(Hack.Readys.MouseIsIn(33,457,288,584))
		{
			if(GetAsyncKeyState(1))
			{
				HDC TheHDC = GetDC (NULL);
				DWORD Colors = GetPixel (TheHDC, Hack.Values.MousePos.x, Hack.Values.MousePos.y);
				ReleaseDC (NULL, TheHDC);

				Col.Red = GetRValue (Colors);
				Col.Green = GetGValue (Colors);
				Col.Blue = GetBValue (Colors);
			}
		}
		CloseC.Draw(pDevice);
		if(CloseC.Return){
			Button.Return = false;
			CloseC.Return = false;
		}
	}
}
U GET MY THANKS AND +REP!
Quote Originally Posted by kotentopf View Post
your one is of the released one the simplest, thats good.

simple = not much code
not much code = not much work
etc.

i complettly rewrited it and made my personal one



and a snippet
Code:
void cGUI::DrawColorPicker(LPDIRECT3DDEVICE9 pDevice,cButton &Button,COLOR &Col)
{
	if(Button.Return){
		if(SPRCR){
			D3DXCreateTextureFromFileInMemory(pDevice,&Color,sizeof(Color),&D3D.Settings.MenuTexture);
			D3DXCreateSprite(pDevice,&D3D.Settings.Sprite);
			SPRCR = false;
		}

		D3D.Draw.Box(29,438,264,163,1,0x8D04A0A0,0xFF030303,pDevice,true,false);
		D3D.Draw.String(33,440,0xFF3DFFFF,D3D.Settings.pFont,"Color:");
		D3D.Draw.FillRGB(62,442,183,11,Col.ConvertToDWORD(),pDevice,false);
		D3D.Draw.String(60,585,LightAvacado,D3D.Settings.pFont,"Thx ac1d_buRn for the Idea. Its not copied!");

		D3DXVECTOR3 POS; 
		POS.x = 33; 
		POS.y = 457; 
		POS.z = 0; 

		D3D.Settings.Sprite->Begin(D3DXSPRITE_ALPHABLEND); 
		D3D.Settings.Sprite->Draw(D3D.Settings.MenuTexture,NULL,NULL,&POS,0xFFFFFFFF);
		D3D.Settings.Sprite->End();

		if(Hack.Readys.MouseIsIn(33,457,288,584))
		{
			if(GetAsyncKeyState(1))
			{
				HDC TheHDC = GetDC (NULL);
				DWORD Colors = GetPixel (TheHDC, Hack.Values.MousePos.x, Hack.Values.MousePos.y);
				ReleaseDC (NULL, TheHDC);

				Col.Red = GetRValue (Colors);
				Col.Green = GetGValue (Colors);
				Col.Blue = GetBValue (Colors);
			}
		}
		CloseC.Draw(pDevice);
		if(CloseC.Return){
			Button.Return = false;
			CloseC.Return = false;
		}
	}
}
U GET MY THANKS AND +REP!
That looks good.
Glad someone found it usefull
Good job. Just trying to implement it in now , i will get a picture one i get it in. Thank you ^_^. +Thank + Rep
Posts 115 of 16 · Page 1 of 2
This thread is closed for replies.

Tags for this Thread

None

Need help?