* bug#9175: [PATCH] 24.0.50: Images colors on NextStep do not default correctly
@ 2011-07-26 18:44 Alp Aker
2011-07-28 18:29 ` Chong Yidong
0 siblings, 1 reply; 2+ messages in thread
From: Alp Aker @ 2011-07-26 18:44 UTC (permalink / raw)
To: 9175
Image types that support :foreground and :background keywords in their
image descriptors are supposed to default to the frame foreground and
background colors when the relevant colors aren't specified. On NS,
however, these default to black. An easy test case is provided by
visiting a mono PBM image file (such as etc/images/splash.pbm) in
image-mode; what one will see is simply a black square.
Diagnostic: The image loading functions in image.c take the default
colors from the frame's foreground_pixel and background_pixel fields,
but on NS the relevant frame parameter handlers don't set those
fields. The following patch corrects that.
2011-07-25 Alp Aker <alp.tekin.aker@gmail.com>
* nsfns.m (x_set_foreground_color): Set f->foreground_pixel when
setting frame foreground color.
(x_set_background_color): Likewise.
=== modified file 'src/nsfns.m'
--- src/nsfns.m 2011-07-08 15:39:40 +0000
+++ src/nsfns.m 2011-07-25 17:22:05 +0000
@@ -321,6 +321,7 @@
x_set_foreground_color (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
{
NSColor *col;
+ CGFloat r, g, b, alpha;
if (ns_lisp_to_color (arg, &col))
{
@@ -332,6 +333,10 @@
[f->output_data.ns->foreground_color release];
f->output_data.ns->foreground_color = col;
+ [col getRed: &r green: &g blue: &b alpha: &alpha];
+ FRAME_FOREGROUND_PIXEL (f) =
+ ARGB_TO_ULONG ((int)(alpha*0xff), (int)(r*0xff), (int)(g*0xff),
(int)(b*0xff));
+
if (FRAME_NS_VIEW (f))
{
update_face_from_frame_parameter (f, Qforeground_color, arg);
@@ -348,7 +353,7 @@
struct face *face;
NSColor *col;
NSView *view = FRAME_NS_VIEW (f);
- float alpha;
+ CGFloat r, g, b, alpha;
if (ns_lisp_to_color (arg, &col))
{
@@ -364,10 +369,14 @@
[col retain];
[f->output_data.ns->background_color release];
f->output_data.ns->background_color = col;
+
+ [col getRed: &r green: &g blue: &b alpha: &alpha];
+ FRAME_BACKGROUND_PIXEL (f) =
+ ARGB_TO_ULONG ((int)(alpha*0xff), (int)(r*0xff), (int)(g*0xff),
(int)(b*0xff));
+
if (view != nil)
{
[[view window] setBackgroundColor: col];
- alpha = [col alphaComponent];
if (alpha != 1.0)
[[view window] setOpaque: NO];
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#9175: [PATCH] 24.0.50: Images colors on NextStep do not default correctly
2011-07-26 18:44 bug#9175: [PATCH] 24.0.50: Images colors on NextStep do not default correctly Alp Aker
@ 2011-07-28 18:29 ` Chong Yidong
0 siblings, 0 replies; 2+ messages in thread
From: Chong Yidong @ 2011-07-28 18:29 UTC (permalink / raw)
To: Alp Aker; +Cc: 9175
Alp Aker <alptekin.aker@gmail.com> writes:
> Image types that support :foreground and :background keywords in their
> image descriptors are supposed to default to the frame foreground and
> background colors when the relevant colors aren't specified. On NS,
> however, these default to black. An easy test case is provided by
> visiting a mono PBM image file (such as etc/images/splash.pbm) in
> image-mode; what one will see is simply a black square.
>
> Diagnostic: The image loading functions in image.c take the default
> colors from the frame's foreground_pixel and background_pixel fields,
> but on NS the relevant frame parameter handlers don't set those
> fields. The following patch corrects that.
Thanks, applied.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-07-28 18:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-07-26 18:44 bug#9175: [PATCH] 24.0.50: Images colors on NextStep do not default correctly Alp Aker
2011-07-28 18:29 ` Chong Yidong
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.