1 /****************************************************************************
3 * palette_editor.c -- Lunapaint, *
4 * http://developer.berlios.de/projects/lunapaintami/ *
5 * Copyright (C) 2006, 2007, Hogne Titlestad <hogga@sub-ether.org> *
6 * Copyright (C) 2009-2011 LunaPaint Development Team *
8 * This program is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU General Public License as published by *
10 * the Free Software Foundation; either version 2 of the License, or *
11 * (at your option) any later version. *
13 * This program is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU General Public License for more details. *
18 * You should have received a copy of the GNU General Public License *
19 * along with this program; if not, write to the Free Software Foundation, *
20 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
22 ****************************************************************************/
24 #include "palette_editor.h"
26 Object
*paletteWindow
;
35 Object
*palStrFileSave
;
41 Object
*palBtnReverse
;
45 unsigned int tempCopiedColor
;
46 BOOL tempCopiedColorExists
;
48 struct Hook rgbslider_hook
;
49 struct Hook paletteSave_hook
;
50 struct Hook paletteLoad_hook
;
51 struct Hook paletteClose_hook
;
55 Call the function that opens a palette file requestor and
56 save on the resulting file...
59 HOOKPROTONHNO(paletteSave_func
, ULONG
, int *param
)
66 We do this when we close the palette window
69 HOOKPROTONHNO(paletteClose_func
, ULONG
, int *param
)
71 set ( paletteWindow
, MUIA_Window_Open
, FALSE
);
72 DoMethod ( tbxAreaPalette
, MUIM_Draw
);
77 Call the function that opens a palette file requestor and
78 load the resulting file...
81 HOOKPROTONHNO (paletteLoad_func
, ULONG
, int *param
)
89 To this every time a slider RGB moves...
91 HOOKPROTONHNO(rgbslider_func
, ULONG
, int *param
)
94 // Set current selected color
96 int R
= XGET ( palSlideR
, MUIA_Numeric_Value
);
97 int G
= XGET ( palSlideG
, MUIA_Numeric_Value
);
98 int B
= XGET ( palSlideB
, MUIA_Numeric_Value
);
100 if ( currColor
>= 0 && currColor
< 256 )
101 globalPalette
[ currColor
] = RGBtoPaletteColor ( R
, G
, B
);
103 updateColorPreview ( ); PaletteRedraw ( currColor
);
110 Dispatcher for our palette area
113 BOOPSI_DISPATCHER(IPTR
, PaletteArea
, cl
, obj
, msg
)
115 switch ( msg
->MethodID
)
118 return ( IPTR
)PaletteRedraw ( -1 );
120 case MUIM_HandleInput
:
121 return ( IPTR
)PaletteEvents ( cl
, obj
, ( struct MUIP_HandleInput
* )msg
);
127 // Update slider positions when the window is initialized
128 struct rgbData colors
= paletteColorToRGB ( globalPalette
[ currColor
] );
129 set ( palSlideR
, MUIA_Numeric_Value
, colors
.r
);
130 set ( palSlideG
, MUIA_Numeric_Value
, colors
.g
);
131 set ( palSlideB
, MUIA_Numeric_Value
, colors
.b
);
133 MUI_RequestIDCMP( obj
, IDCMP_MOUSEBUTTONS
| IDCMP_MOUSEMOVE
| IDCMP_RAWKEY
);
134 return DoSuperMethodA ( cl
, obj
, msg
);
136 case MUIM_Luna_Palette_Copy
:
137 return ( IPTR
)PaletteActions ( MUIM_Luna_Palette_Copy
);
139 case MUIM_Luna_Palette_Paste
:
140 return ( IPTR
)PaletteActions ( MUIM_Luna_Palette_Paste
);
142 case MUIM_Luna_Palette_Swap
:
143 return ( IPTR
)PaletteActions ( MUIM_Luna_Palette_Swap
);
145 case MUIM_Luna_Palette_Reverse
:
146 return ( IPTR
)PaletteActions ( MUIM_Luna_Palette_Reverse
);
148 case MUIM_Luna_Palette_Spread
:
149 return ( IPTR
)PaletteActions ( MUIM_Luna_Palette_Spread
);
151 case MUIM_Luna_Palette_Clear
:
152 return ( IPTR
)PaletteActions ( MUIM_Luna_Palette_Clear
);
154 /* Tool stuff (should be in a dispatcher in the toolbox! */
156 case MUIM_Luna_SetTool_Draw
:
157 if ( globalCurrentTool
!= LUNA_TOOL_CLIPBRUSH
)
159 globalBrushMode
= 0; // normal drawing mode
160 DoMethod ( tbxAreaPalette
, MUIM_Luna_Canvas_AlterBrushShape
);
162 globalCurrentTool
= LUNA_TOOL_BRUSH
;
163 setToolbarActive ( );
166 case MUIM_Luna_SetTool_Fill
:
168 // Make a small brush now
169 globalCurrentTool
= LUNA_TOOL_FILL
;
170 setToolbarActive ( );
173 case MUIM_Luna_SetTool_Line
:
174 globalCurrentTool
= LUNA_TOOL_LINE
;
175 setToolbarActive ( );
178 case MUIM_Luna_SetTool_Rectangle
:
179 globalCurrentTool
= LUNA_TOOL_RECTANGLE
;
180 setToolbarActive ( );
183 case MUIM_Luna_SetTool_Circle
:
184 globalCurrentTool
= LUNA_TOOL_CIRCLE
;
185 setToolbarActive ( );
188 case MUIM_Luna_SetTool_ClipBrush
:
189 globalCurrentTool
= LUNA_TOOL_CLIPBRUSH
;
190 globalBrushMode
= 1; // clipbrush mode
191 setToolbarActive ( );
194 case MUIM_Luna_SetTool_Colorpicker
:
195 globalCurrentTool
= LUNA_TOOL_COLORPICKER
;
196 setToolbarActive ( );
199 case MUIM_Luna_ExecuteRevert
:
200 checkMenuEvents ( 595 );
207 return DoSuperMethodA ( cl
, obj
, msg
);
211 BOOPSI_DISPATCHER_END
213 IPTR
PaletteRedraw ( int colorIndex
)
215 BOOL WeAreOpen
= FALSE
; get ( paletteWindow
, MUIA_Window_Open
, &WeAreOpen
);
216 if ( !WeAreOpen
) return ( IPTR
)NULL
;
218 int Y
= XGET ( paletteRect
, MUIA_TopEdge
);
219 int X
= XGET ( paletteRect
, MUIA_LeftEdge
);
220 int W
= XGET ( paletteRect
, MUIA_Width
);
221 int H
= XGET ( paletteRect
, MUIA_Height
);
223 ULONG
*tempBuf
= AllocVec ( W
* H
* 4, MEMF_ANY
);
225 double xslice
= ( ( double )W
/ 16 );
226 double yslice
= ( ( double )H
/ 16 );
227 double targetx
= xslice
* ( currColor
% 16 );
228 double targety
= yslice
* ( currColor
/ 16 );
230 int y
= 0; for ( ; y
< H
; y
++ )
232 int x
= 0; for ( ; x
< W
; x
++ )
234 int inX
= ( double )x
/ W
* 16;
235 int inY
= ( double )y
/ H
* 16;
236 int index
= inY
* 16 + inX
;
237 char check
= ( y
+ x
) % 2;
240 index
== currColor
&&
242 x
== ( int )targetx
|| x
== ( int )( targetx
+ xslice
- 1 ) ||
243 y
== ( int )targety
|| y
== ( int )( targety
+ yslice
- 1 )
248 tempBuf
[ y
* W
+ x
] = 0xFFFFFF;
251 tempBuf
[ y
* W
+ x
] = globalPalette
[ index
];
255 if ( globalBrushMode
== 0 ) makeToolBrush ( );
257 // Plot all colors on screen
258 if ( colorIndex
== -1 )
261 tempBuf
, 0, 0, 4 * W
, _rp ( paletteRect
), X
, Y
, W
, H
, RECTFMT_RGBA
265 // Write only the selected color on screen
266 // and the previous selected color
268 // Draw over previous color
269 int targetx
= ( prevColor
% 16 ) * xslice
;
270 int targety
= ( prevColor
/ 16 ) * yslice
;
272 tempBuf
, targetx
, targety
, 4 * W
,
273 _rp ( paletteRect
), targetx
+ X
, targety
+ Y
, ( int )xslice
, ( int )yslice
,
277 targetx
= ( currColor
% 16 ) * xslice
;
278 targety
= ( currColor
/ 16 ) * yslice
;
280 tempBuf
, targetx
, targety
, 4 * W
,
281 _rp ( paletteRect
), targetx
+ X
, targety
+ Y
, ( int )xslice
, ( int )yslice
,
288 updateColorPreview ( );
293 IPTR
PaletteEvents ( Class
*CLASS
, Object
*self
, struct MUIP_HandleInput
*msg
)
297 switch ( msg
->imsg
->Class
)
299 case IDCMP_MOUSEBUTTONS
:
300 if ( msg
->imsg
->Code
== SELECTDOWN
)
302 // Set a color based on click in palette
303 int mousex
, mousey
, topedge
=0, leftedge
=0, wi
=0, he
=0;
304 double slicex
, slicey
;
305 get ( paletteRect
, MUIA_TopEdge
, &topedge
);
306 get ( paletteRect
, MUIA_LeftEdge
, &leftedge
);
307 get ( paletteRect
, MUIA_Width
, &wi
);
308 get ( paletteRect
, MUIA_Height
, &he
);
309 slicex
= ( ( double )wi
/ 16 );
310 slicey
= ( ( double )he
/ 16 );
311 mousex
= ( int )msg
->imsg
->MouseX
- leftedge
;
312 mousey
= ( int )msg
->imsg
->MouseY
- topedge
;
314 // Only regard things happening in the palette area
316 if ( mousex
>= 0 && mousey
>= 0 && mousex
< wi
&& mousey
< he
)
318 int indexX
= ( int )( ( double )mousex
/ slicex
);
319 int indexY
= ( int )( ( double )mousey
/ slicey
);
320 int index
= ( unsigned int )( ( indexY
* 16 ) + indexX
);
321 if ( index
>= 0 && index
< 256 )
323 prevColor
= currColor
;
324 currColor
= ( unsigned int )( ( indexY
* 16 ) + indexX
);
325 globalColor
= globalPalette
[ currColor
];
326 DoMethod ( tbxAreaPalette
, MUIM_Draw
);
329 // Update slider positions
330 struct rgbData colors
= paletteColorToRGB ( globalPalette
[ currColor
] );
331 set ( palSlideR
, MUIA_Numeric_Value
, colors
.r
);
332 set ( palSlideG
, MUIA_Numeric_Value
, colors
.g
);
333 set ( palSlideB
, MUIA_Numeric_Value
, colors
.b
);
344 IPTR
PaletteActions ( ULONG action
)
348 case MUIM_Luna_Palette_Copy
:
349 tempCopiedColor
= *( globalPalette
+ currColor
);
350 tempCopiedColorExists
= TRUE
;
353 case MUIM_Luna_Palette_Paste
:
355 if ( tempCopiedColorExists
)
357 // Paste copied color
358 *( globalPalette
+ currColor
) = tempCopiedColor
;
359 // Update slider positions
360 struct rgbData colors
= paletteColorToRGB ( *( globalPalette
+ currColor
) );
361 set ( palSlideR
, MUIA_Numeric_Value
, colors
.r
);
362 set ( palSlideG
, MUIA_Numeric_Value
, colors
.g
);
363 set ( palSlideB
, MUIA_Numeric_Value
, colors
.b
);
368 case MUIM_Luna_Palette_Swap
:
371 if ( prevColor
!= currColor
)
373 unsigned int tempcol
= *( globalPalette
+ prevColor
);
374 *( globalPalette
+ prevColor
) = *( globalPalette
+ currColor
);
375 *( globalPalette
+ currColor
) = tempcol
;
376 // Update slider positions
377 struct rgbData colors
= paletteColorToRGB ( *( globalPalette
+ currColor
) );
378 set ( palSlideR
, MUIA_Numeric_Value
, colors
.r
);
379 set ( palSlideG
, MUIA_Numeric_Value
, colors
.g
);
380 set ( palSlideB
, MUIA_Numeric_Value
, colors
.b
);
382 PaletteRedraw ( -1 );
387 case MUIM_Luna_Palette_Reverse
:
389 if ( currColor
!= prevColor
)
391 unsigned int firstCol
= ( currColor
> prevColor
) ? prevColor
: currColor
;
392 unsigned int lastCol
= ( currColor
> prevColor
) ? currColor
: prevColor
;
393 int span
= ( int )lastCol
- ( int )firstCol
+ 1;
394 unsigned int *temp
= AllocVec ( 4 * span
, MEMF_ANY
);
395 // Copy the present order
396 unsigned int i
= 0; for ( ; i
< span
; i
++ )
398 temp
[ i
] = globalPalette
[ firstCol
+ i
];
400 // Place the reverse order
401 for ( i
= 0; i
< span
; i
++ )
403 globalPalette
[ lastCol
- i
] = temp
[ i
];
408 // Update slider positions
409 struct rgbData colors
= paletteColorToRGB ( *( globalPalette
+ currColor
) );
410 set ( palSlideR
, MUIA_Numeric_Value
, colors
.r
);
411 set ( palSlideG
, MUIA_Numeric_Value
, colors
.g
);
412 set ( palSlideB
, MUIA_Numeric_Value
, colors
.b
);
414 PaletteRedraw ( -1 );
419 case MUIM_Luna_Palette_Spread
:
420 if ( currColor
!= prevColor
)
422 unsigned int firstCol
= ( currColor
> prevColor
) ? prevColor
: currColor
;
423 unsigned int lastCol
= ( currColor
> prevColor
) ? currColor
: prevColor
;
424 struct rgbData source
= paletteColorToRGB ( *( globalPalette
+ firstCol
) );
425 struct rgbData dest
= paletteColorToRGB ( *( globalPalette
+ lastCol
) );
426 int span
= lastCol
- firstCol
;
427 unsigned int i
; for ( i
= 1; i
< span
; i
++ )
429 struct rgbData result
;
430 int dr
= ( int )dest
.r
;
431 int dg
= ( int )dest
.g
;
432 int db
= ( int )dest
.b
;
433 int sr
= ( int )source
.r
;
434 int sg
= ( int )source
.g
;
435 int sb
= ( int )source
.b
;
436 result
.r
= ( unsigned int )( sr
- ( ( double )( sr
- dr
) * ( ( double )i
/ span
) ) );
437 result
.g
= ( unsigned int )( sg
- ( ( double )( sg
- dg
) * ( ( double )i
/ span
) ) );
438 result
.b
= ( unsigned int )( sb
- ( ( double )( sb
- db
) * ( ( double )i
/ span
) ) );
439 *( globalPalette
+ firstCol
+ i
) = RGBtoPaletteColor ( result
.r
, result
.g
, result
.b
);
442 PaletteRedraw ( -1 );
446 case MUIM_Luna_Palette_Clear
:
449 // Clear all colors in palette with current color
450 unsigned int tempColor
= *( globalPalette
+ currColor
);
451 unsigned int a
= 0; for ( a
= 0; a
< 256; a
++ )
452 *( globalPalette
+ a
) = tempColor
;
453 // Update slider positions
454 struct rgbData colors
= paletteColorToRGB ( *( globalPalette
+ currColor
) );
455 set ( palSlideR
, MUIA_Numeric_Value
, colors
.r
);
456 set ( palSlideG
, MUIA_Numeric_Value
, colors
.g
);
457 set ( palSlideB
, MUIA_Numeric_Value
, colors
.b
);
459 PaletteRedraw ( -1 );
469 void updateColorPreview ( )
471 // Update only color preview if we have an open window!
475 get ( paletteWindow
, MUIA_Window_Open
, &state
);
479 int R
=0, G
=0, B
=0, W
=0, H
=0, TE
=0, LE
=0;
481 get ( palSlideR
, MUIA_Numeric_Value
, &R
);
482 get ( palSlideG
, MUIA_Numeric_Value
, &G
);
483 get ( palSlideB
, MUIA_Numeric_Value
, &B
);
484 get ( palColRect
, MUIA_TopEdge
, &TE
);
485 get ( palColRect
, MUIA_LeftEdge
, &LE
);
486 get ( palColRect
, MUIA_Width
, &W
);
487 get ( palColRect
, MUIA_Height
, &H
);
489 ULONG
*tempBuf
= AllocVec ( 4 * ( W
* H
), MEMF_ANY
);
490 unsigned int tempCol
= RGBtoPaletteColor ( R
, G
, B
);
492 int Y
= 0; for ( ; Y
< H
; Y
++ )
494 int X
= 0; for ( ; X
< W
; X
++ )
495 tempBuf
[ ( W
* Y
) + X
] = tempCol
;
498 tempBuf
, 0, 0, W
* 4, _rp ( palColRect
),
499 LE
, TE
, W
, H
, RECTFMT_RGBA
505 void Init_PaletteWindow ( )
507 struct MUI_CustomClass
*mcc
=
508 MUI_CreateCustomClass (
509 NULL
, MUIC_Rectangle
, NULL
,
514 paletteWindow
= WindowObject
,
515 MUIA_Window_Title
, __(MSG_PALETTE_WIN
),
516 MUIA_Window_SizeGadget
, FALSE
,
517 MUIA_Window_Screen
, ( IPTR
)lunaPubScreen
,
518 MUIA_Window_ID
, MAKE_ID('L','P','P','W'),
519 WindowContents
, ( IPTR
)VGroup
,
520 Child
, ( IPTR
)GroupObject
,
521 MUIA_Frame
, MUIV_Frame_Group
,
522 Child
, ( IPTR
)HGroup
,
523 Child
, ( IPTR
)VGroup
,
524 Child
, ( IPTR
)HGroup
,
525 Child
, ( IPTR
)VGroup
,
526 Child
, ( IPTR
)( palBtnCopy
= SimpleButton ( __(MSG_PALETTE_COPY
) )),
527 Child
, ( IPTR
)( palBtnPaste
= SimpleButton ( __(MSG_PALETTE_PASTE
) )),
528 Child
, ( IPTR
)( palBtnClear
= SimpleButton ( __(MSG_PALETTE_CLEAR
) )),
530 Child
, ( IPTR
)VGroup
,
531 Child
, ( IPTR
)( palBtnReverse
= SimpleButton ( __(MSG_PALETTE_REVERSE
) )),
532 Child
, ( IPTR
)( palBtnSwap
= SimpleButton ( __(MSG_PALETTE_SWAP
) )),
533 Child
, ( IPTR
)( palBtnSpread
= SimpleButton ( __(MSG_PALETTE_SPREAD
) )),
536 Child
, ( IPTR
)VGroup
,
537 Child
, ( IPTR
)RectangleObject
,
538 MUIA_Frame
, MUIV_Frame_None
,
540 MUIA_Rectangle_HBar
, TRUE
,
542 Child
, ( IPTR
)StringObject
,
543 MUIA_String_MaxLen
, 8,
544 MUIA_String_Format
, MUIV_String_Format_Center
,
545 MUIA_Frame
, MUIV_Frame_String
,
547 Child
, ( IPTR
)SimpleButton ( __(MSG_PALETTE_WEB
) ),
550 Child
, ( IPTR
)VGroup
,
551 Child
, ( IPTR
)HGroup
,
552 Child
, ( IPTR
)GroupObject
,
553 MUIA_Frame
, MUIV_Frame_Group
,
554 Child
, ( IPTR
)( palColRect
= RectangleObject
,
559 Child
, ( IPTR
)HGroup
,
560 Child
, ( IPTR
)( palSlideR
= SliderObject
,
561 MUIA_Slider_Horiz
, FALSE
,
563 MUIA_Numeric_Max
, 255,
564 MUIA_Numeric_Value
, 0,
566 Child
, ( IPTR
)( palSlideG
= SliderObject
,
567 MUIA_Slider_Horiz
, FALSE
,
569 MUIA_Numeric_Max
, 255,
570 MUIA_Numeric_Value
, 0,
572 Child
, ( IPTR
)( palSlideB
= SliderObject
,
573 MUIA_Slider_Horiz
, FALSE
,
575 MUIA_Numeric_Max
, 255,
576 MUIA_Numeric_Value
, 0,
581 Child
, ( IPTR
)VGroup
,
582 Child
, ( IPTR
)RectangleObject
,
583 MUIA_Frame
, MUIV_Frame_None
,
585 MUIA_Rectangle_HBar
, TRUE
,
587 Child
, ( IPTR
)GroupObject
,
588 MUIA_Frame
, MUIV_Frame_Group
,
589 Child
, ( IPTR
)( paletteRect
= NewObject (
590 mcc
->mcc_Class
, NULL
,
598 Child
, ( IPTR
)( palBtnLoad
= SimpleButton ( __(MSG_PALETTE_LOAD
) ) ),
599 Child
, ( IPTR
)( palBtnSave
= SimpleButton ( __(MSG_PALETTE_SAVE
) ) ),
600 Child
, ( IPTR
)( palBtnUse
= SimpleButton ( __(MSG_PALETTE__USE
) )),
607 void Init_PaletteMethods ( )
610 MakeStaticHook(rgbslider_hook
, &rgbslider_func
);
611 MakeStaticHook(paletteLoad_hook
, &paletteLoad_func
);
612 MakeStaticHook(paletteSave_hook
, &paletteSave_func
);
613 MakeStaticHook(paletteClose_hook
, &paletteClose_func
);
615 // Set initial slider positions
616 struct rgbData colors
= paletteColorToRGB ( globalPalette
[ currColor
] );
617 set ( palSlideR
, MUIA_Numeric_Value
, colors
.r
);
618 set ( palSlideG
, MUIA_Numeric_Value
, colors
.g
);
619 set ( palSlideB
, MUIA_Numeric_Value
, colors
.b
);
622 palSlideR
, MUIM_Notify
, MUIA_Numeric_Value
, MUIV_EveryTime
,
623 palSlideR
, 3, MUIM_CallHook
, &rgbslider_hook
, MUIV_TriggerValue
626 palSlideG
, MUIM_Notify
, MUIA_Numeric_Value
, MUIV_EveryTime
,
627 palSlideG
, 3, MUIM_CallHook
, &rgbslider_hook
, MUIV_TriggerValue
630 palSlideB
, MUIM_Notify
, MUIA_Numeric_Value
, MUIV_EveryTime
,
631 palSlideB
, 3, MUIM_CallHook
, &rgbslider_hook
, MUIV_TriggerValue
634 palBtnUse
, MUIM_Notify
,
636 paletteWindow
, 3, MUIM_CallHook
, &paletteClose_hook
639 paletteWindow
, MUIM_Notify
,
640 MUIA_Window_CloseRequest
, TRUE
,
641 paletteWindow
, 3, MUIM_CallHook
, &paletteClose_hook
646 palBtnCopy
, MUIM_Notify
,
648 paletteRect
, 1, MUIM_Luna_Palette_Copy
651 palBtnPaste
, MUIM_Notify
,
653 paletteRect
, 1, MUIM_Luna_Palette_Paste
656 palBtnSpread
, MUIM_Notify
,
658 paletteRect
, 1, MUIM_Luna_Palette_Spread
661 palBtnSwap
, MUIM_Notify
,
663 paletteRect
, 1, MUIM_Luna_Palette_Swap
666 palBtnReverse
, MUIM_Notify
,
668 paletteRect
, 1, MUIM_Luna_Palette_Reverse
671 palBtnClear
, MUIM_Notify
,
673 paletteRect
, 1, MUIM_Luna_Palette_Clear
678 palBtnSave
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
679 palBtnSave
, 3, MUIM_CallHook
, &paletteSave_hook
, MUIV_TriggerValue
682 palBtnLoad
, MUIM_Notify
, MUIA_Pressed
, FALSE
,
683 palBtnLoad
, 3, MUIM_CallHook
, &paletteLoad_hook
, MUIV_TriggerValue
687 ULONG
savePalette ( )
689 // We have a filename!!
690 char *filename
= getFilename ( );
691 if ( filename
!= NULL
)
695 if ( ( myfile
= Open ( filename
, MODE_NEWFILE
) ) != BNULL
)
697 Write ( myfile
, globalPalette
, 4 * 256 );
700 else printf ( "Failed to write palette..\n" );
701 FreeVec ( filename
);
706 ULONG
loadPalette ( )
708 // We have a filename!!
709 char *filename
= getFilename ( );
710 if ( filename
!= NULL
)
714 if ( ( myfile
= Open ( filename
, MODE_OLDFILE
) ) != BNULL
)
716 Read ( myfile
, globalPalette
, 4 * 256 );
719 else printf ( "Failed to load palette..\n" );
720 FreeVec ( filename
);