Laxkit
0.0.7.1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
lax
interfaces
colorpatchinterface.h
1
//
2
//
3
// The Laxkit, a windowing toolkit
4
// Please consult http://laxkit.sourceforge.net about where to send any
5
// correspondence about this software.
6
//
7
// This library is free software; you can redistribute it and/or
8
// modify it under the terms of the GNU Library General Public
9
// License as published by the Free Software Foundation; either
10
// version 2 of the License, or (at your option) any later version.
11
//
12
// This library is distributed in the hope that it will be useful,
13
// but WITHOUT ANY WARRANTY; without even the implied warranty of
14
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
// Library General Public License for more details.
16
//
17
// You should have received a copy of the GNU Library General Public
18
// License along with this library; if not, write to the Free Software
19
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20
//
21
// Copyright (C) 2004-2013 by Tom Lechner
22
//
23
#ifndef _LAX_COLORPATCHINTERFACE_H
24
#define _LAX_COLORPATCHINTERFACE_H
25
26
#include <lax/interfaces/patchinterface.h>
27
#include <lax/interfaces/somedata.h>
28
#include <lax/interfaces/linestyle.h>
29
#include <lax/screencolor.h>
30
31
32
namespace
LaxInterfaces {
33
34
35
//-------------------------------------- ColorPatchData -------------------------
36
37
class
ColorPatchData
:
public
PatchData
38
{
39
protected
:
40
public
:
41
Laxkit::ScreenColor
*colors;
42
43
ColorPatchData
(
double
xx,
double
yy,
double
ww,
double
hh,
int
nr,
int
nc,
unsigned
int
stle);
44
ColorPatchData
();
45
virtual
~
ColorPatchData
();
46
const
char
*whattype() {
return
"ColorPatchData"
; }
47
virtual
SomeData
*duplicate(
SomeData
*dup);
48
49
virtual
void
Set
(
double
xx,
double
yy,
double
ww,
double
hh,
int
nr,
int
nc,
unsigned
int
stle);
50
virtual
void
SetColor
(
int
pr,
int
pc,
int
red=0,
int
green=0,
int
blue=0,
int
alpha=0xffff);
51
virtual
void
collapse
(
int
rr,
int
cc);
52
virtual
void
grow
(
int
where,
double
*tr);
53
virtual
int
subdivide
(
int
r,
double
rt,
int
c,
double
ct);
54
virtual
int
subdivide
(
int
xn=2,
int
yn=2);
55
56
virtual
int
WhatColor
(
double
s,
double
t,
Laxkit::ScreenColor
*color_ret);
57
virtual
int
hasColorData
();
58
59
virtual
void
dump_out
(FILE *f,
int
indent,
int
what,
Laxkit::anObject
*context);
60
virtual
void
dump_in_atts
(
LaxFiles::Attribute
*att,
int
flag,
Laxkit::anObject
*context);
61
};
62
63
64
65
//-------------------------------------- ColorPatchInterface -------------------------
66
67
class
ColorPatchInterface
:
public
PatchInterface
68
{
69
protected
:
70
double
Cx[16],Cy[16];
71
Laxkit::ScreenColor
*col1,*col2,*col3,*col4,col,cola,colb;
72
virtual
void
patchpoint
(
PatchRenderContext
*context,
double
s1,
double
t1,
double
s2,
double
t2);
// p1,p2 are s1,t1, s2,t2
73
virtual
void
patchpoint2
(
PatchRenderContext
*context);
74
virtual
int
sendcolor
(
Laxkit::ScreenColor
*col);
75
virtual
int
PerformAction(
int
action);
76
public
:
77
ColorPatchData
*cdata;
// just a dummy so not have to dynamic_cast<ColorPatchData *> data
78
79
ColorPatchInterface
(
int
nid,
Laxkit::Displayer
*ndp);
80
virtual
~ColorPatchInterface
();
81
virtual
Laxkit::ShortcutHandler
*GetShortcuts();
82
virtual
anInterface
*duplicate(
anInterface
*dup=NULL);
83
virtual
const
char
*IconId() {
return
"ColorPatch"
; }
84
virtual
const
char
*Name();
85
virtual
const
char
*whattype() {
return
"ColorPatchInterface"
; }
86
virtual
const
char
*whatdatatype() {
return
"ColorPatchData"
; }
87
88
virtual
void
drawpatch
(
int
roff,
int
coff);
89
virtual
void
drawControlPoint
(
int
i);
90
virtual
int
CharInput(
unsigned
int
ch,
const
char
*buffer,
int
len,
unsigned
int
state,
const
Laxkit::LaxKeyboard
*d);
91
// virtual int Refresh();
92
virtual
int
DrawData(
anObject
*ndata,
anObject
*a1=NULL,
anObject
*a2=NULL,
int
info=0);
93
virtual
int
UseThisObject(
ObjectContext
*oc);
94
virtual
int
UseThis(
anObject
*newdata,
unsigned
int
mask=0);
95
virtual
int
UseThis(
int
id
,
int
ndata);
96
virtual
PatchData
*
newPatchData
(
double
xx,
double
yy,
double
ww,
double
hh,
int
nr,
int
nc,
unsigned
int
stle);
97
virtual
int
SelectPoint(
int
c,
unsigned
int
state);
98
};
99
100
}
// namespace LaxInterfaces;
101
102
#endif
103
Mon Feb 17 2014 11:52:56, Laxkit