NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/46189 (wsfb/genfb red and blue colours are reversed on bit depths 15 16 24 and 32)
The following reply was made to PR kern/46189; it has been noted by GNATS.
From: Nat Sloss <nathanialsloss%yahoo.com.au@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc:
Subject: Re: kern/46189 (wsfb/genfb red and blue colours are reversed on bit
depths 15 16 24 and 32)
Date: Tue, 5 Jun 2012 21:49:23 +1000
Hi
I can confirm that it has been fixed although I'm concerned that rasops24/32
which are still BGR are not involved when using genfb at colour depths 24 and
32 respectively.
I have also written a manual page for my colour bar programme as well as a
makefile which I think is good for testing and would be a good addition to
the games so here are the files:
--- /dev/null 2012-06-05 21:17:59.000000000 +1000
+++ src/games/colourbars/colourbars.c 2012-06-05 21:10:23.000000000 +1000
@@ -0,0 +1,123 @@
+/*-
+ * Copyright (c) 2012 Nathanial Sloss <nathanialsloss%yahoo.com.au@localhost>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <curses.h>
+#include <stdio.h>
+
+int
+main(void)
+{
+ char colourNames[8][8] = {
+ {"Black "},
+ {"Red "},
+ {"Green "},
+ {"Yellow "},
+ {"Blue "},
+ {"Magenta"},
+ {"Cyan "},
+ {"White "}
+ };
+
+ int colourOK;
+ int colour, line, spacing, xpos, offsetx, labeloffsety, labeloffsetx;
+ int numcolours = 8;
+ int labelwidth = 8;
+
+ if (!(initscr())) {
+ printf("\nUnknown terminal type.");
+ printf("\n");
+ return -1;
+ }
+
+ colourOK = has_colors();
+ spacing = COLS / numcolours;
+ offsetx = (COLS - (spacing * numcolours)) / 2;
+ labeloffsetx = spacing / 2;
+ labeloffsety = (LINES - 1 - labelwidth) / 2;
+
+ if (!colourOK) {
+ endwin();
+ printf("\nTerminal must be colour capable.");
+ printf("\n");
+ return -1;
+ }
+
+ if (COLS < 45 || LINES < 10) {
+ endwin();
+ printf("\nTerminal size must be at least 45x10.");
+ printf("\n");
+ return -1;
+ }
+
+ if (colourOK) {
+ start_color();
+
+ init_pair( 0, COLOR_WHITE, COLOR_BLACK );
+ init_pair( 1, COLOR_WHITE, COLOR_RED );
+ init_pair( 2, COLOR_WHITE, COLOR_GREEN );
+ init_pair( 3, COLOR_WHITE, COLOR_YELLOW );
+ init_pair( 4, COLOR_WHITE, COLOR_BLUE );
+ init_pair( 5, COLOR_WHITE, COLOR_MAGENTA );
+ init_pair( 6, COLOR_WHITE, COLOR_CYAN );
+ init_pair( 7, COLOR_WHITE, COLOR_WHITE );
+ }
+
+ clear();
+
+ move(0, 0);
+
+ for (colour = COLOR_BLACK; colour < numcolours; colour++) {
+ if (colourOK)
+ attrset(COLOR_PAIR(colour));
+ for (line = 0; line < LINES - 1; line++) {
+ for (xpos = (spacing * colour); xpos < (spacing
\
+ * (colour + 1)); xpos++)
+ mvprintw(line, xpos + offsetx, " ");
+ }
+
+ if (colourOK)
+ attrset(COLOR_PAIR(0));
+ for (line = labeloffsety; line < labeloffsety + labelwidth; \
+ line++) {
+ if (colourNames[colour][line - labeloffsety] != ' ')
+ mvprintw(line, (spacing * colour) + offsetx \
+ + labeloffsetx, "%c", \
+ colourNames[colour][line - labeloffsety]);
+ }
+ }
+
+ if (colourOK)
+ attrset(COLOR_PAIR(0));
+ mvprintw(LINES - 1, 0, "ANSI Colour chart - Press any key to exit: ");
+ refresh();
+
+ getch();
+
+ endwin();
+
+ return 0;
+}
+
--- /dev/null 2012-06-05 21:17:59.000000000 +1000
+++ src/games/colourbars/colourbars.6 2012-06-05 21:06:05.000000000 +1000
@@ -0,0 +1,39 @@
+.\"
+.\" Copyright (c) 2012 Nathanial Sloss <nathanialsloss%yahoo.com.au@localhost>
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED
+.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR
+.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
THE
+.\" POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd June 5, 2012
+.Dt COLOURBARS 6
+.Os
+.Sh NAME
+.Nm colourbars
+.Nd displays ANSI colour bars
+.Sh SYNOPSIS
+.Nm
+.Sh DESCRIPTION
+The
+.Nm
+command displays ANSI colour bars on a colour capable terminal.
+.Sh AUTHORS
+Software and manual page written by Nathanial Sloss for NetBSD 6.0.
--- /dev/null 2012-06-05 21:17:59.000000000 +1000
+++ src/games/colourbars/Makefile 2012-06-05 21:07:33.000000000 +1000
@@ -0,0 +1,6 @@
+PROG= colourbars
+MAN= colourbars.6
+DPADD= ${LIBCURSES}
+LDADD= -lcurses
+
+.include <bsd.prog.mk>
Note: This sottware and manual page are my own work which I submit under the
NetBSD license.
Regards,
Nat.
Home |
Main Index |
Thread Index |
Old Index