emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Q on performance with 10000 faces


From: Kim F. Storm
Subject: Re: Q on performance with 10000 faces
Date: Mon, 22 May 2006 10:15:34 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

"Drew Adams" <address@hidden> writes:

> I guess one alternative would be to insert an image of a complete palette
> (like the image attached) 

You can construct that image on the fly using eg. XPM format.

To overcome limitations in number of available colors, you could
construct 100 images covering one line each.

Then use the line-height property of the newline character to
make the display "tight":

      (insert (propertize "\n" 'line-height t)))))

Finally, you may use the :map property on images:

`:map MAP'
     This associates an image map of "hot spots" with this image.

     An image map is an alist where each element has the format `(AREA
     ID PLIST)'.  An AREA is specified as either a rectangle, a circle,
     or a polygon.

     A rectangle is a cons `(rect . ((X0 . Y0) . (X1 . Y1)))' which
     specifies the pixel coordinates of the upper left and bottom right
     corners of the rectangle area.

     A circle is a cons `(circle . ((X0 . Y0) . R))' which specifies
     the center and the radius of the circle; R may be a float or
     integer.

     A polygon is a cons `(poly . [X0 Y0 X1 Y1 ...])' where each pair
     in the vector describes one corner in the polygon.

     When the mouse pointer is above a hot-spot area of an image, the
     PLIST of that hot-spot is consulted; if it contains a `help-echo'
     property it defines a tool-tip for the hot-spot, and if it contains
     a `pointer' property, it defines the shape of the mouse cursor when
     it is over the hot-spot.  *Note Pointer Shape::, for available
     pointer shapes.

     When you click the mouse when the mouse pointer is over a
     hot-spot, an event is composed by combining the ID of the hot-spot
     with the mouse event; for instance, `[area4 mouse-1]' if the
     hot-spot's ID is `area4'.


Or simply use a common mouse click function and use the x,y coordinates
of the mouse event to calculate which color is clicked.  
See posn-x-y and posn-object-x-y.

-- 
Kim F. Storm <address@hidden> http://www.cua.dk





reply via email to

[Prev in Thread] Current Thread [Next in Thread]