← Back to team overview

kicad-developers team mailing list archive

MacOS: PCBNEW Proposal of basic implementation of Alpha Channel

 

Follows a prototype of implementation of alpha channel, Marius, could you try to take a look ?
Obliusly is a raw implementation, but enough good for a first evaluation ofhow looks like.

Index: common/gr_basic.cpp
===================================================================
--- common/gr_basic.cpp	(revision 962)
+++ common/gr_basic.cpp	(working copy)
@@ -260,24 +260,42 @@
/* Routine de changement de couleurs et epaisseur de la plume courante */
void GRSetColorPen( wxDC* DC, int Color, int width, int style )
{
+#if defined(__WXMAC__) && wxMAC_USE_CORE_GRAPHICS
+ int transparent = wxALPHA_OPAQUE;
+ if(Color & TRACK_ALPHA_COLOR)
+ transparent = 150;
+#endif
+
Color &= MASKCOLOR; // Pour 32 couleurs Max
 
if( width < PenMinWidth )
width = PenMinWidth;
 
- if( ForceBlackPen && Color != WHITE )
+ if( ForceBlackPen && Color != WHITE ){
Color = BLACK;
+#if defined(__WXMAC__) && wxMAC_USE_CORE_GRAPHICS
+	transparent= wxALPHA_OPAQUE;
+#endif
+ }
 
if( (lastcolor != Color) || (lastwidth != width) || (s_Last_Pen_Style != style)
|| (lastDC != DC ) )
{
wxPen DrawPen;
+#if defined(__WXMAC__) && wxMAC_USE_CORE_GRAPHICS
+ DrawPen.SetColour(wxColour(
+ ColorRefs[Color].m_Red,
+ ColorRefs[Color].m_Green,
+ ColorRefs[Color].m_Blue,
+	transparent
+ ));
+#else
DrawPen.SetColour(
ColorRefs[Color].m_Red,
ColorRefs[Color].m_Green,
ColorRefs[Color].m_Blue
);
-
+#endif
DrawPen.SetWidth( width );
DrawPen.SetStyle( style );
 
Index: pcbnew/class_track.cpp
===================================================================
--- pcbnew/class_track.cpp	(revision 962)
+++ pcbnew/class_track.cpp	(working copy)
@@ -673,6 +673,7 @@
if( color & HIGHT_LIGHT_FLAG )
color = ColorRefs[color & MASKCOLOR].m_LightColor;
 
+ color+=TRACK_ALPHA_COLOR;
zoom = panel->GetZoom();
 
l_piste = m_Width >> 1;
Index: include/colors.h
===================================================================
--- include/colors.h	(revision 962)
+++ include/colors.h	(working copy)
@@ -10,6 +10,7 @@
#endif
 
/* Definitions des Numeros des Couleurs ( palette de 32) */
+#define TRACK_ALPHA_COLOR 64
#define NBCOLOR 32
#define MASKCOLOR 31	// masque pour bits significatifs
 
Index: include/gr_basic.h
===================================================================
--- include/gr_basic.h	(revision 962)
+++ include/gr_basic.h	(working copy)
@@ -14,7 +14,12 @@
/* Constantes utiles */
 
#define GR_COPY 0
+#if defined(__WXMAC__) && wxMAC_USE_CORE_GRAPHICS
+#define GR_OR GR_COPY
+#else
#define GR_OR 0x01000000
+#endif
+
#define GR_XOR 0x02000000
#define GR_AND 0x04000000
#define GR_NXOR 0x08000000