Autor Beitrag
joelrodrigues
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 20



BeitragVerfasst: Sa 06.01.07 05:28 
Hi folks,

Imagine the following:
======================
I have an image in my TImage component. This image is a mouse with 3 buttons (LMB, MMB and RMB). The mouse is white.
I´d like to fill with color (paint) each button dynamically.... In other words, i´d like to paint on each button choosing a color dynamically.

For example: www.crytek-online.co...eymouseviewer_03.jpg
This is an image created on Photoshop... The Middle Mouse Button was not painted dynamically (the image already contains a MMB painted).


My questions:
======================
1) How i "map" each mouse button? In other words, i´d like to create a shape of each mouse button (so i would be able to paint on it).
2) How i fill with color (paint) on each mapped mouse button?


Any suggestions would be deeply appreciated.
You could recommend 3rd party components.

Best regards!

JOEL RODRIGUES
Muck
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 98
Erhaltene Danke: 8

Win 8, Win 7, Vista, Win XP
Delphi XE3, Delphi 2009, Delphi 2007, Delphi 5
BeitragVerfasst: Sa 06.01.07 06:31 
Hi,

you can use the property canvas to change the color of this mousebutton image.
You can try the method FILLRECT or here a little example of a fill i wrote long long ago, it will exchange every white pix within a black border to the color code $FF0000.


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
procedure TForm1.Mach(X,Y:Integer);
var I,J:Integer;
begin
with Image1.Canvas do for J:=1 to 4 do begin
  case j of
    1:Dec(y);
    2:begin inc(y);inc(x);end;
    3:begin dec(x);inc(y);end;
    4:begin dec(y);dec(x);end;
  end;
  I:=Pixels[x,y];
  if I and $00FFFF>0 then begin
    Pixels[x,y]:=$02FF0000;
    Mach(X,Y);
  end;
end;


oh yes, by the way, you start the procedure from somewhere out of your application with a one point inside the border from the mouse button.

if this all won't work, just go ahead and save different images in different colors and display a new images, this will be for an animation faster anyway.

cu bye und Tschues Markus

Falls jemande ne Uebersetzung wuenscht, einfach email an mich :-)
Ich weiss, rekursiv geht schief, aber ich hoffe einfach mal, dass die Anzahl der Pixel eines Mousbutton nicht so gross sind.

bis denne Der Markus