← Back to team overview

kicad-developers team mailing list archive

Re: OSX: pcbnew with CORE_GRAPHICS.

 

> On Apr 1, 2008, at 1:54 PM, jean-pierre charras - INPG wrote:
> > This is *exactly* the case.
> > I never used blend/alpha functionality instead of OR mode (it did not
> > exists when i started kicad), but i think this is a good idea.
> Thanks for clearing this up :)
> Since COPY may hide some layers, we should have some kind of blending  
> functionality.
> However, this is probably not critical, so using COPY for now (only  
> for the Mac port) is a good start I think.

I've added a "basic" transparency support to compensate the missing of the wxOR :)
Could you try to get a look ?

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









Follow ups

References