|
|
|
Узнать Цвет Пикселя на BUILDER 2006
|
|||
|---|---|---|---|
|
#18+
Привет! Я почти разобрался с тем, как мне работать с картой в компоненте TImage, осталось одно (и еще кое-что). Сейчас задача такая: мне нужно при клике мышки на компоненте TImage распознавать цвет пикселя, над которым в момент клика находился курсор мышки. Видимо это нужно сделать при помощи передачи координат, но куда?? кому?? какие свойства нужно использовать. Подскажите пожалуйста, кто знает или кто пробовал.. Пишу на BDS 2006. Заранее, большущее спасибо!! ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 19.06.2007, 03:18 |
|
||
|
Узнать Цвет Пикселя на BUILDER 2006
|
|||
|---|---|---|---|
|
#18+
Andrey Ohotin wrote: > мне нужно при клике мышки на компоненте TImage распознавать цвет пикселя, > над которым в момент клика находился курсор мышки. При клике передаются координаты щелчка. Если они в экранных координатах, то, если не ошибаюсь (билдером давно не пользовался), там должны быть функции типа ClientToScreen/ScreenToClient, которые переводят координаты из глобальных в локальные. Ну и дальше, если TImage поддерживает TCanvas (а он должен), то есть property Pixels и функции должны быть типа GetPixel/PutPixel... Posted via ActualForum NNTP Server 1.4 ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 19.06.2007, 04:42 |
|
||
|
Узнать Цвет Пикселя на BUILDER 2006
|
|||
|---|---|---|---|
|
#18+
Andrey Ohotin wrote: > Пишу на BDS 2006. То, что отписал выше, справедливо для Delphi 6/ Builder 6. Возможно, что в вашей версии немного по-другому. Рекомендую посмотреть спавку по TImage. Posted via ActualForum NNTP Server 1.4 ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 19.06.2007, 04:43 |
|
||
|
Узнать Цвет Пикселя на BUILDER 2006
|
|||
|---|---|---|---|
|
#18+
есть вот такие методы а Канваса.. но среди них того, что мне нужно.. GetPixel и SetPixel .. Как быть?? хочу узнать цвет пикселя.. ((((((( очень нужно.. Methods of TCanvas Method Description Arc (public) Draws an arc on the image along the perimeter of the ellipse bounded by the specified rectangle. BrushCopy (public) Copies a portion of a bitmap onto a rectangle on the canvas, replacing one of the colors of the bitmap with the brush of the canvas. Chord (public) Draws a closed figure represented by the intersection of a line and an ellipse. CopyRect (public) Copies part of an image from another canvas into the canvas. Draw (public) Renders the graphic specified by the Graphic parameter on the canvas at the location given by the coordinates (X, Y). DrawFocusRect (public) Draws a rectangle in the style used to indicate that the object inside the rectangle has focus. Ellipse (public) Draws the ellipse defined by a bounding rectangle on the canvas. FillRect (public) Fills the specified rectangle on the canvas using the current brush. FloodFill (public) Fills an area of the canvas using the current brush. FrameRect (public) Draws a rectangle using the Brush of the canvas to draw the border. HandleAllocated (public) Indicates whether the TCanvas object has acquired a handle to a device context. LineTo (public) Draws a line on the canvas from PenPos to the point specified by X and Y, and sets the pen position to (X, Y). Lock (public) Prevents other threads from drawing on the canvas. MoveTo (public) Changes the current drawing position to the point (X,Y). Pie (public) Draws a pie-shaped the section of the ellipse bounded by the rectangle (X1, Y1) and (X2, Y2) on the canvas. PolyBezier (public) Draws a set of Bezier curves. PolyBezierTo (public) Draws a set of Bezier curves and updates the value of PenPos. Polygon (public) Draws a series of lines on the canvas connecting the points passed in and closing the shape by drawing a line from the last point to the first point. Polyline (public) Draws a series of lines on the canvas with the current pen, connecting each of the points passed to it in Points. Rectangle (public) Draws a rectangle on the canvas. Refresh (public) Deselects the Pen, Brush, and Font from the device context. RoundRect (public) Draws a rectangle with rounded corners on the canvas. StretchDraw (public) Draws the graphic specified by the Graphic parameter in the rectangle specified by the Rect parameter. TextExtent (public) Returns the width and height, in pixels, of a string rendered in the current font. TextHeight (public) Returns the height, in pixels, of a string rendered in the current font. TextRect (public) Writes a string inside a clipping rectangle. TextWidth (public) Returns the width, in pixels, of a string rendered in the current font. TryLock (public) Locks the canvas if it is currently unlocked. Unlock (public) Decreases the LockCount property, allowing other threads to execute when LockCount reaches 0. Methods inherited from Classes::TPersistent Method Description Assign (public) Copies the contents of another, similar object. AssignTo (protected) Copies the properties of an object to a destination object. DefineProperties (protected) Provides an interface for a method that reads and writes otherwise unpublished data. GetNamePath (public) Returns the name of the object as it appears in the Object Inspector. GetOwner (protected) Returns the owner of an object. Methods inherited from System::TObject Method Description AfterConstruction (public) Responds after the last constructor has executed. BeforeDestruction (public) Responds before the first destructor executes. ClassInfo (public) Returns a pointer to the runtime type information (RTTI) table for the object type. ClassName (public) Returns a string indicating the type of the object instance (as opposed to the type of the variable passed as an argument). ClassNameIs (public) Determines whether an object is of a specific type. ClassParent (public) Returns the type of the immediate ancestor of a class. ClassType (public) Returns the class reference for the object's class. CleanupInstance (public) Performs finalization on long strings, variants, and interface variables within a class. DefaultHandler (public) Provides the interface for a method that processes message records. Dispatch (public) Calls message-handling methods for the object, based on the contents of the Message parameter. FieldAddress (public) Returns the address of a published object field. Free (public) Destroys an object and frees its associated memory, if necessary. FreeInstance (public) Deallocates memory allocated by a previous call to the NewInstance method. GetInterface (public) Retrieves a specified interface. GetInterfaceEntry (public) Returns the entry for a specific interface implemented in a class. GetInterfaceTable (public) Returns a pointer to a structure containing all of the interfaces implemented by a given class. InheritsFrom (public) Determines the relationship of two object types. InitInstance (public) Initializes a newly allocated object instance to all zeros and initializes the instance's virtual method table pointer. InstanceSize (public) Returns the size in bytes of each instance of the object type. NewInstance (protected) Allocates memory for an instance of an object type and returns a pointer to that new instance. SafeCallException (public) Handles exceptions in methods declared using the safecall calling convention. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 20.06.2007, 15:06 |
|
||
|
Узнать Цвет Пикселя на BUILDER 2006
|
|||
|---|---|---|---|
|
#18+
узнал еще кое-что: (стянул с разных форумов) ............................................ //Цвет пикселя на форме за координ. точки. var color:Tcolor; begin color:=form1.canvas.pixels[x,y]; end; //Цвет color будет равно прибл. =1000000; вот такому числу; //ето код цвета; //если нужно витянуть RGB, пиши я позже отвечу! //Насчет bmp и (jpg) файлов тоже просто! //Увы я могу помочь только с bmp var bit:Tbitmap; color:Tcolor; begin bit:=TBitmap.create; bit.LoadFromFile('*.bmp'); color:=bit.Canvas.Pixels[x,y]; end; ...................................... Еще пишут, что для того чтобы узнать цвет пикселя jpg-файла его неодходимо в bitmap перевести... но как? Как все это сделать на BDS?? КОШМАР... ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 20.06.2007, 15:54 |
|
||
|
Узнать Цвет Пикселя на BUILDER 2006
|
|||
|---|---|---|---|
|
#18+
Andrey Ohotin wrote: > узнал еще кое-что: о чем я раньше и писал: ErV wrote: >то есть property Pixels код цвета либо индекс, либо RGB закодирован. Вроде бы по типу $00bbggrr. Posted via ActualForum NNTP Server 1.4 ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 20.06.2007, 17:10 |
|
||
|
Узнать Цвет Пикселя на BUILDER 2006
|
|||
|---|---|---|---|
|
#18+
Нашел вот что: с формой работает. ...................................................................................... Код: plaintext 1. 2. 3. 4. 5. 6. ..................................................... Но если пишу вот так, то ругается на то, что картинка эта нея вляется bitmap'ом . Что делать? и на правильном ли я пути? .. Код: plaintext 1. ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 20.06.2007, 17:38 |
|
||
|
|

start [/forum/topic.php?fid=57&msg=34608681&tid=2028638]: |
0ms |
get settings: |
7ms |
get forum list: |
14ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
31ms |
get topic data: |
9ms |
get forum data: |
2ms |
get page messages: |
45ms |
get tp. blocked users: |
1ms |
| others: | 216ms |
| total: | 331ms |

| 0 / 0 |
