当前位置: 首页>>代码示例>>C++>>正文


C++ wxPaintEvent::GetEventObject方法代码示例

本文整理汇总了C++中wxPaintEvent::GetEventObject方法的典型用法代码示例。如果您正苦于以下问题:C++ wxPaintEvent::GetEventObject方法的具体用法?C++ wxPaintEvent::GetEventObject怎么用?C++ wxPaintEvent::GetEventObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在wxPaintEvent的用法示例。


在下文中一共展示了wxPaintEvent::GetEventObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnIndicatorPaint

//
// Handle Indicator paint events
//
// Really only needed for the Mac since SetBackgroundColour()
// doesn't seem to work with shaped frames.
//
void ToolManager::OnIndicatorPaint( wxPaintEvent & event )
{
   wxWindow *w = (wxWindow *)event.GetEventObject();
   wxPaintDC dc( w );
   dc.SetBackground( *wxBLUE_BRUSH );
   dc.Clear();
}
开发者ID:GYGit,项目名称:Audacity,代码行数:13,代码来源:ToolManager.cpp

示例2: dc

void wxdlg3dViewer::OnPaintPanelTexture( wxPaintEvent& event )
{
////@begin wxEVT_PAINT event handler for ID_PanelTexture in wxdlg3dViewer.
    // Before editing this code, remove the block markers.
    wxPaintDC dc(wxDynamicCast(event.GetEventObject(), wxWindow));
////@end wxEVT_PAINT event handler for ID_PanelTexture in wxdlg3dViewer. 
}
开发者ID:Ronmi,项目名称:desmume-debianlized,代码行数:7,代码来源:wxdlg3dViewer.cpp

示例3: OnPaint

//
// This draws the background of a toolbar
//
void ToolBar::OnPaint( wxPaintEvent & event )
{
   wxPaintDC dc( (wxWindow *) event.GetEventObject() );

   // Start with a clean background
   //
   // Under GTK, we specifically set the toolbar background to the background
   // colour in the system theme.
#if defined( __WXGTK__ )
   dc.SetBackground( wxBrush( wxSystemSettings::GetColour( wxSYS_COLOUR_BACKGROUND ) ) );
#endif

   dc.Clear();

// EXPERIMENTAL_THEMING is set to not apply the gradient
// on wxMAC builds.  on wxMAC we have the AQUA_THEME.
#ifdef USE_AQUA_THEME
   Repaint( &dc );
#else

#ifdef EXPERIMENTAL_THEMING
   wxImage * mpBackGradient =   &theTheme.Image( bmpRecoloredUpLarge  );

   if( mpBackGradient != NULL )
   {
      wxSize imSz( mpBackGradient->GetWidth(), mpBackGradient->GetHeight() );
      wxSize sz = GetSize();
      int y;
      for(y=0;y<sz.y;y++)
      {
         int yPix = ((float)y * imSz.y - 1.0f)/(sz.y-1);
         wxColour col(
            mpBackGradient->GetRed( 0, yPix),
            mpBackGradient->GetGreen( 0, yPix),
            mpBackGradient->GetBlue( 0, yPix));

         // Set background colour so that controls placed on this
         // toolbar such as radio buttons will draw reasonably.
         // It's a little tacky setting the background colour
         // here, but we can't do it in the constructor as the gradient
         // may not be available yet.
         // Better than this would be to set the colour when the image
         // is loaded.
         // We use the colour at the half way point as a suitable 'average'.
         if( y==(sz.y/2) )
         {
            SetBackgroundColour( col );
         }
         wxPen Pen( col );
         dc.SetPen(Pen );
         AColor::Line(dc, 0, y, sz.x, y );
      }
   }
#endif
#endif
}
开发者ID:jengelh,项目名称:audacity,代码行数:59,代码来源:ToolBar.cpp

示例4: OnPaintPlot

void PlotDialog::OnPaintPlot(wxPaintEvent& event)
{
    wxWindow *window = dynamic_cast<wxWindow*>(event.GetEventObject());
    if(!window)
        return;

    double position = m_sPosition->GetValue() / 100.0;
    double scale = 100.0 / m_sScale->GetValue();

    wxPaintDC dc(window);
    dc.SetBackgroundMode(wxTRANSPARENT);

    int w, h;
    m_PlotWindow->GetSize( &w, &h);

    dc.SetBrush(*wxTRANSPARENT_BRUSH);

    wxChoice *cVariable[3] = {m_cVariable1, m_cVariable2, m_cVariable3};
    wxColour colors[3] = {wxColour(255, 0, 0), wxColour(0, 255, 0), wxColour(0, 0, 255)};
    for(int i=0; i<3; i++) {
        dc.SetPen(wxPen(colors[i], 3));

        int lx, ly;
        bool first = true;
        for(std::list<PlotData>::iterator it = m_PlotData.begin(); it != m_PlotData.end(); it++) {
            double time = ((*it).time - m_StartTime).GetSeconds().ToDouble();
            double value = GetValue(*it, cVariable[i]->GetSelection());

            int x = w * (scale * ((time - m_mintime) / (m_maxtime - m_mintime) - position) + position);
            int y = h * (1 - (value - m_minvalue) / (m_maxvalue - m_minvalue));
            if(first)
                first = false;
            else
                dc.DrawLine(lx, ly, x, y);
            lx = x, ly = y;
        }
    }

    dc.SetTextForeground(wxColour(0, 0, 0));
    const double steps = 10;
    for(double x=1/steps; x<1-1/steps; x+=1/steps) {
        wxString time = wxString::Format
            (_T("%.0f"), ((x - position)/scale + position) * (m_maxtime - m_mintime) + m_mintime);
        wxSize s = dc.GetTextExtent(time);
        dc.DrawText(time, x*w-s.x/2, 0);

        wxString value = wxString::Format(_T("%.1f"), (1-x)*(m_maxvalue - m_minvalue) + m_minvalue);
        s = dc.GetTextExtent(value);
        dc.DrawText(value, 0, x*h - s.y/2);
    }
}
开发者ID:Rasbats,项目名称:OpenCPN.3.3.1117_weather_routing,代码行数:51,代码来源:PlotDialog.cpp

示例5: OnPaint

void CMainWindow::OnPaint( wxPaintEvent& event )
{
    wxWindow* window = wxDynamicCast(event.GetEventObject(), wxWindow);
    wxPaintDC dc(window);
    wxRect rect = window->GetClientRect();
    if (m_pBackGroundImage->Ok() && m_pBackGroundImage->GetWidth() > 0 && m_pBackGroundImage->GetHeight() > 0)
    {
        int w = m_pBackGroundImage->GetWidth();
        int h = m_pBackGroundImage->GetHeight();

        wxMemoryDC dcMem;

        dcMem.SelectObjectAsSource(*m_pBackGroundImage);
        int i, j;
        for (i = rect.x; i < rect.x + rect.width; i += w)
        {
            for (j = rect.y; j < rect.y + rect.height; j+= h)
                dc.Blit(i, j, w, h, & dcMem, 0, 0);
        }
        dcMem.SelectObject(wxNullBitmap);
    }
}
开发者ID:beyondlwm,项目名称:YukiNailManager,代码行数:22,代码来源:MainWindow.cpp

示例6: OnPaint

//
// This draws the background of a toolbar
//
void ToolBar::OnPaint( wxPaintEvent & event )
{
   wxPaintDC dc( (wxWindow *) event.GetEventObject() );

   // Start with a clean background
   //
   // Under GTK, clearing will cause the background to be white and
   // rather than setting a background color, just bypass the clear.
#if !defined(__WXGTK__)
   dc.Clear();
#endif

   // Go repaint the rest
   Repaint( &dc );

   if( IsResizable() && IsDocked() )
   {
      wxSize sz = GetSize();

      AColor::Dark( &dc, false );
      dc.DrawLine( sz.x - 4,  0, sz.x - 4, sz.y );
      dc.DrawLine( sz.x - 1,  0, sz.x - 1, sz.y );
   }
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:27,代码来源:ToolBar.cpp

示例7: OnPaintPanelTexture

	virtual void OnPaintPanelTexture( wxPaintEvent& event )
	{
		wxPaintDC dc(wxDynamicCast(event.GetEventObject(), wxWindow));
		dc.SetBackground(*wxBLACK_BRUSH); dc.Clear();

		int selection = GetSelectedListviewItem(listPolys);
		if(selection < 0) return;
		if(selection>=viewer3d_state->polylist.count) return;

		POLY& poly = viewer3d_state->polylist.list[selection];

		TexCacheItem* texkey = TexCache_SetTexture(TexFormat_32bpp,poly.texParam,poly.texPalette);
		const u32 w = texkey->sizeX;
		const u32 h = texkey->sizeY;
		u8* const bmpdata = new u8[w*h*4];
		for(u32 i=0;i<w*h;i++) {
				bmpdata[i*3] = texkey->decoded[i*4];
				bmpdata[i*3+1] = texkey->decoded[i*4+1];
				bmpdata[i*3+2] = texkey->decoded[i*4+2];
			}
		for(u32 i=0;i<w*h;i++)
			bmpdata[w*h*3+i] = texkey->decoded[i*4+3];

		
		wxImage image(w,h,false);
		image.InitAlpha();
		image.SetData(bmpdata,true);
		image.SetAlpha(bmpdata+w*h*3,true);
		wxBitmap bitmap(image);
		double xscale = (double)panelTexture->GetSize().x / w;
		double yscale = (double)panelTexture->GetSize().y / h;

		dc.SetUserScale(xscale,yscale);
		dc.DrawBitmap(bitmap,0,0);
		delete[] bmpdata;
	}
开发者ID:Ronmi,项目名称:desmume-debianlized,代码行数:36,代码来源:driver.cpp

示例8: PlotPaint

void FreqWindow::PlotPaint(wxPaintEvent & evt)
{
   wxPaintDC dc( (wxWindow *) evt.GetEventObject() );

   dc.DrawBitmap( *mBitmap, 0, 0, true );
   if( mProcessed == NULL )
      return;

   int alg = mAlgChoice->GetSelection();

   dc.SetFont(mFreqFont);

   wxRect r = mPlotRect;

   int width = r.width - 2;

   float xMin, xMax, xPos, xRatio, xLast, xStep;

   if (alg == 0) {
      xMin = mRate / mWindowSize;
      xMax = mRate / 2;
      xRatio = xMax / xMin;
      xPos = xMin;
      xLast = xPos / 2.0;
      if (mLogAxis)
         xStep = pow(2.0f, (log(xRatio) / log(2.0f)) / width);
      else
         xStep = (xMax - xMin) / width;
   } else {
      xMin = 0;
      xMax = mProcessedSize / mRate;
      xPos = xMin;
      xLast = xPos / 2.0;
      xStep = (xMax - xMin) / width;
   }

   // Find the peak nearest the cursor and plot it

   float bestpeak = float(0.0);
   if ( r.Contains(mMouseX, mMouseY) & (mMouseX!=0) & (mMouseX!=r.width-1) ) {
      if (mLogAxis)
         xPos = xMin * pow(xStep, mMouseX - (r.x + 1));
      else
         xPos = xMin + xStep * (mMouseX - (r.x + 1));

      bool up = (mProcessed[1] > mProcessed[0]);
      float bestdist = 1000000;
      float bestValue = 0.0;
      for (int bin = 2; bin < mProcessedSize; bin++) {
         bool nowUp = mProcessed[bin] > mProcessed[bin - 1];
         if (!nowUp && up) {
            // Local maximum.  Find actual value by cubic interpolation
            int leftbin = bin - 2;
            if (leftbin < 1)
               leftbin = 1;
            float valueAtMax = 0.0;
            float max = leftbin + CubicMaximize(mProcessed[leftbin],
                                                mProcessed[leftbin + 1],
                                                mProcessed[leftbin + 2],
                                                mProcessed[leftbin + 3], &valueAtMax);

            float thispeak;
            if (alg == 0)
               thispeak = max * mRate / mWindowSize;
            else
               thispeak = max / mRate;

            if (fabs(thispeak - xPos) < bestdist) {
               bestpeak = thispeak;
               bestdist = fabs(thispeak - xPos);
               bestValue = valueAtMax;
               if (thispeak > xPos)
                  break;
            }
         }
         up = nowUp;
      }

      int px;
      if (mLogAxis)
         px = int (log(bestpeak / xMin) / log(xStep));
      else
         px = int ((bestpeak - xMin) * width / (xMax - xMin));

      dc.SetPen(wxPen(wxColour(160,160,160), 1, wxSOLID));
      AColor::Line(dc, r.x + 1 + px, r.y, r.x + 1 + px, r.y + r.height);

       // print out info about the cursor location

      float value;

      if (mLogAxis) {
         xPos = xMin * pow(xStep, mMouseX - (r.x + 1));
         value = GetProcessedValue(xPos, xPos * xStep);
      } else {
         xPos = xMin + xStep * (mMouseX - (r.x + 1));
         value = GetProcessedValue(xPos, xPos + xStep);
      }

      wxString info;
//.........这里部分代码省略.........
开发者ID:ruthmagnus,项目名称:audacity,代码行数:101,代码来源:FreqWindow.cpp

示例9: PlotPaint

void FreqWindow::PlotPaint(wxPaintEvent & event)
{
   wxPaintDC dc( (wxWindow *) event.GetEventObject() );

   dc.DrawBitmap( *mBitmap, 0, 0, true );
   // Fix for Bug 1226 "Plot Spectrum freezes... if insufficient samples selected"
   if (!mData || mDataLen < mWindowSize)
      return;

   dc.SetFont(mFreqFont);

   wxRect r = mPlotRect;

   int width = r.width - 2;

   float xMin, xMax, xRatio, xStep;

   if (mAlg == SpectrumAnalyst::Spectrum) {
      xMin = mRate / mWindowSize;
      xMax = mRate / 2;
      xRatio = xMax / xMin;
      if (mLogAxis)
         xStep = pow(2.0f, (log(xRatio) / log(2.0f)) / width);
      else
         xStep = (xMax - xMin) / width;
   } else {
      xMin = 0;
      xMax = mAnalyst->GetProcessedSize() / mRate;
      xStep = (xMax - xMin) / width;
   }

   float xPos = xMin;

   // Find the peak nearest the cursor and plot it
   if ( r.Contains(mMouseX, mMouseY) & (mMouseX!=0) & (mMouseX!=r.width-1) ) {
      if (mLogAxis)
         xPos = xMin * pow(xStep, mMouseX - (r.x + 1));
      else
         xPos = xMin + xStep * (mMouseX - (r.x + 1));

      float bestValue = 0;
      float bestpeak = mAnalyst->FindPeak(xPos, &bestValue);

      int px;
      if (mLogAxis)
         px = (int)(log(bestpeak / xMin) / log(xStep));
      else
         px = (int)((bestpeak - xMin) * width / (xMax - xMin));

      dc.SetPen(wxPen(wxColour(160,160,160), 1, wxSOLID));
      AColor::Line(dc, r.x + 1 + px, r.y, r.x + 1 + px, r.y + r.height);

       // print out info about the cursor location

      float value;

      if (mLogAxis) {
         xPos = xMin * pow(xStep, mMouseX - (r.x + 1));
         value = mAnalyst->GetProcessedValue(xPos, xPos * xStep);
      } else {
         xPos = xMin + xStep * (mMouseX - (r.x + 1));
         value = mAnalyst->GetProcessedValue(xPos, xPos + xStep);
      }

      wxString cursor;
      wxString peak;
      wxString xpitch;
      wxString peakpitch;
      const wxChar *xp;
      const wxChar *pp;

      if (mAlg == SpectrumAnalyst::Spectrum) {
         xpitch = PitchName_Absolute(FreqToMIDInote(xPos));
         peakpitch = PitchName_Absolute(FreqToMIDInote(bestpeak));
         xp = xpitch;
         pp = peakpitch;
         /* i18n-hint: The %d's are replaced by numbers, the %s by musical notes, e.g. A#*/
         cursor.Printf(_("%d Hz (%s) = %d dB"), (int)(xPos + 0.5), xp, (int)(value + 0.5));
         peak.Printf(_("%d Hz (%s) = %.1f dB"), (int)(bestpeak + 0.5), pp, bestValue);
      } else if (xPos > 0.0 && bestpeak > 0.0) {
         xpitch = PitchName_Absolute(FreqToMIDInote(1.0 / xPos));
         peakpitch = PitchName_Absolute(FreqToMIDInote(1.0 / bestpeak));
         xp = xpitch;
         pp = peakpitch;
         /* i18n-hint: The %d's are replaced by numbers, the %s by musical notes, e.g. A#
          * the %.4f are numbers, and 'sec' should be an abbreviation for seconds */
         cursor.Printf(_("%.4f sec (%d Hz) (%s) = %f"),
                     xPos, (int)(1.0 / xPos + 0.5), xp, value);
         peak.Printf(_("%.4f sec (%d Hz) (%s) = %.3f"),
                     bestpeak, (int)(1.0 / bestpeak + 0.5), pp, bestValue);
      }
      mCursorText->SetValue(cursor);
      mPeakText->SetValue(peak);
   }
   else {
      mCursorText->SetValue(wxT(""));
      mPeakText->SetValue(wxT(""));
   }


//.........这里部分代码省略.........
开发者ID:RaphaelMarinier,项目名称:audacity,代码行数:101,代码来源:FreqWindow.cpp

示例10: on_paint_sprite

void ggscfg_ColorEditSheet::on_paint_sprite(wxPaintEvent& event) {
  draw_image(&wxPaintDC((wxWindow*)event.GetEventObject()), false);
}
开发者ID:assick,项目名称:ggspc,代码行数:3,代码来源:ggscfg_ColorEditSheet.cpp

示例11: OnPaint

//
// This draws the background of a toolbar
//
void ToolBar::OnPaint( wxPaintEvent & event )
{
   wxPaintDC dc( (wxWindow *) event.GetEventObject() );

   // Start with a clean background
   //
   // Under GTK, clearing will cause the background to be white and
   // rather than setting a background color, just bypass the clear.
#if !defined(__WXGTK__)
   dc.Clear();
#endif

// EXPERIMENTAL_THEMING is set to not apply the gradient
// on wxMAC builds.  on wxMAC we have the AQUA_THEME.
#ifdef USE_AQUA_THEME
   Repaint( &dc );
#else

#ifdef EXPERIMENTAL_THEMING
   wxImage * mpBackGradient =   &theTheme.Image( bmpRecoloredUpLarge  );

   if( mpBackGradient != NULL )
   {
      wxSize imSz( mpBackGradient->GetWidth(), mpBackGradient->GetHeight() );
      wxSize sz = GetSize();
      int y;
      for(y=0;y<sz.y;y++)
      {
         int yPix = ((float)y * imSz.y - 0.0001f)/(sz.y-1);
         wxColour col( 
            mpBackGradient->GetRed( 0, yPix),
            mpBackGradient->GetGreen( 0, yPix),
            mpBackGradient->GetBlue( 0, yPix));

         // Set background colour so that controls placed on this
         // toolbar such as radio buttons will draw reasonably.
         // It's a little tacky setting the background colour 
         // here, but we can't do it in the constructor as the gradient
         // may not be available yet.
         // Better than this would be to set the colour when the image 
         // is loaded.
         // We use the colour at the half way point as a suitable 'average'.
         if( y==(sz.y/2) )
         {
            SetBackgroundColour( col );
         }
         wxPen Pen( col );
         dc.SetPen(Pen );
         dc.DrawLine( 0, y, sz.x, y );
      }
   }
#endif
#endif

   if( IsResizable() && IsDocked() )
   {
      wxSize sz = GetSize();

      AColor::Dark( &dc, false );
      dc.DrawLine( sz.x - 4,  0, sz.x - 4, sz.y );
      dc.DrawLine( sz.x - 1,  0, sz.x - 1, sz.y );
   }
}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:66,代码来源:ToolBar.cpp

示例12: _OnPaintPanel

	virtual void _OnPaintPanel( wxPaintEvent& event )
	{
		wxClientDC dc(wxDynamicCast(event.GetEventObject(), wxWindow));
		RedrawPanel(&dc);
	}
开发者ID:Ronmi,项目名称:desmume-debianlized,代码行数:5,代码来源:driver.cpp

示例13: on_paint_palette

void ggscfg_ColorEditSheet::on_paint_palette(wxPaintEvent& event) {
  draw_palette(&wxPaintDC((wxWindow*)event.GetEventObject()));
}
开发者ID:assick,项目名称:ggspc,代码行数:3,代码来源:ggscfg_ColorEditSheet.cpp

示例14: OnPaint

void MainWindow::OnPaint( wxPaintEvent& event )
{
	wxPaintDC dc(wxDynamicCast(event.GetEventObject(), wxWindow)); 

	int id = wxDynamicCast(event.GetEventObject(), wxWindow)->GetId();
	BlendingModeRef blendingmode = _blendingModes->GetBlendingModeByBitmapId(id);
	std::string s = blendingmode.GetRenderModeLabel();
	
	WXHDC wxHDC = wxPaintDC::FindDCInCache((wxWindow*) event.GetEventObject());
	HDC hDC = (HDC) wxHDC;

	bool isCacheAvailable = _cachedOutputBitmaps.find(id) != _cachedOutputBitmaps.end();
	if (isCacheAvailable) {
		// Cache available
		BITMAP *cachedBmp = _cachedOutputBitmaps.find(id)->second;
		draw_to_hdc(hDC, cachedBmp, 0, 0); 
		return;
	}

	BITMAP *imageBitmap = create_bitmap(250, 188);
	clear_to_color(imageBitmap, makecol(0, 0, 0));

	BITMAP *baseBitmap = load_bitmap("images/Base_250x188.bmp", NULL);
	BITMAP *blendBitmap = load_bitmap("images/Blend_250x188.bmp", NULL);

	blit(baseBitmap, baseBitmap, 0, 0, 0, 0, baseBitmap->w, baseBitmap->h);
	
	wxString type(blendingmode.GetRenderModeLabel().c_str(), wxConvUTF8);
	for (int w=0; w<baseBitmap->w; w++) {
		for (int h=0; h<baseBitmap->h; h++) {
			if (type.IsSameAs(_T("Lighten"))) {
				put_blended_pixel(baseBitmap, w, h, getpixel(blendBitmap, w, h), blender_lighten);
			} else if (type.IsSameAs(_T("Darken"))) {
				put_blended_pixel(baseBitmap, w, h, getpixel(blendBitmap, w, h), blender_darken);
			} else if (type.IsSameAs(_T("Multiply"))) {
				put_blended_pixel(baseBitmap, w, h, getpixel(blendBitmap, w, h), blender_multiply);
			} else if (type.IsSameAs(_T("Average"))) {
				put_blended_pixel(baseBitmap, w, h, getpixel(blendBitmap, w, h), blender_average);
			} else if (type.IsSameAs(_T("Add"))) {
				put_blended_pixel(baseBitmap, w, h, getpixel(blendBitmap, w, h), blender_add);
			} else if (type.IsSameAs(_T("Subtract"))) {
				put_blended_pixel(baseBitmap, w, h, getpixel(blendBitmap, w, h), blender_subtract);
			} else if (type.IsSameAs(_T("Difference"))) {
				put_blended_pixel(baseBitmap, w, h, getpixel(blendBitmap, w, h), blender_difference);
			} else if (type.IsSameAs(_T("Negation"))) {
				put_blended_pixel(baseBitmap, w, h, getpixel(blendBitmap, w, h), blender_negation);
			} else if (type.IsSameAs(_T("Screen"))) {
				put_blended_pixel(baseBitmap, w, h, getpixel(blendBitmap, w, h), blender_screen);
			} else if (type.IsSameAs(_T("Exclusion"))) {
				put_blended_pixel(baseBitmap, w, h, getpixel(blendBitmap, w, h), blender_exclusion);
			} else if (type.IsSameAs(_T("Overlay"))) {
				put_blended_pixel(baseBitmap, w, h, getpixel(blendBitmap, w, h), blender_overlay);
			} else if (type.IsSameAs(_T("SoftLight"))) {
				put_blended_pixel(baseBitmap, w, h, getpixel(blendBitmap, w, h), blender_softlight);
			} else if (type.IsSameAs(_T("HardLight"))) {
				put_blended_pixel(baseBitmap, w, h, getpixel(blendBitmap, w, h), blender_hardlight);
			} else if (type.IsSameAs(_T("ColorDodge"))) {
				put_blended_pixel(baseBitmap, w, h, getpixel(blendBitmap, w, h), blender_colordodge);
			} else if (type.IsSameAs(_T("ColorBurn"))) {
				put_blended_pixel(baseBitmap, w, h, getpixel(blendBitmap, w, h), blender_colorburn);
			} else if (type.IsSameAs(_T("LinearDodge"))) {
				put_blended_pixel(baseBitmap, w, h, getpixel(blendBitmap, w, h), blender_lineardodge);
			} else if (type.IsSameAs(_T("LinearBurn"))) {
				put_blended_pixel(baseBitmap, w, h, getpixel(blendBitmap, w, h), blender_linearburn);
			} else if (type.IsSameAs(_T("LinearLight"))) {
				put_blended_pixel(baseBitmap, w, h, getpixel(blendBitmap, w, h), blender_linearlight);
			} else if (type.IsSameAs(_T("VividLight"))) {
				put_blended_pixel(baseBitmap, w, h, getpixel(blendBitmap, w, h), blender_vividlight);
			} else if (type.IsSameAs(_T("PinLight"))) {
				put_blended_pixel(baseBitmap, w, h, getpixel(blendBitmap, w, h), blender_pinlight);
			} else if (type.IsSameAs(_T("HardMix"))) {
				put_blended_pixel(baseBitmap, w, h, getpixel(blendBitmap, w, h), blender_hardmix);
			} else if (type.IsSameAs(_T("Reflect"))) {
				put_blended_pixel(baseBitmap, w, h, getpixel(blendBitmap, w, h), blender_reflect);
			} else if (type.IsSameAs(_T("Glow"))) {
				put_blended_pixel(baseBitmap, w, h, getpixel(blendBitmap, w, h), blender_glow);
			} else if (type.IsSameAs(_T("Phoenix"))) {
				put_blended_pixel(baseBitmap, w, h, getpixel(blendBitmap, w, h), blender_phoenix);
			} else if (type.IsSameAs(_T("Hue"))) {
				put_blended_pixel(baseBitmap, w, h, getpixel(blendBitmap, w, h), blender_hue);
			} else if (type.IsSameAs(_T("Saturation"))) {
				put_blended_pixel(baseBitmap, w, h, getpixel(blendBitmap, w, h), blender_saturation);
			} else if (type.IsSameAs(_T("Color"))) {
				put_blended_pixel(baseBitmap, w, h, getpixel(blendBitmap, w, h), blender_color);
			} else if (type.IsSameAs(_T("Luminosity"))) {
				put_blended_pixel(baseBitmap, w, h, getpixel(blendBitmap, w, h), blender_luminosity);
			}
		}
	}

	draw_to_hdc(hDC, baseBitmap, 0, 0); 
	
	// Store in cache
	_cachedOutputBitmaps[id] = baseBitmap;

	destroy_bitmap(imageBitmap);
	destroy_bitmap(blendBitmap);
}
开发者ID:rayburgemeestre,项目名称:AllegroBlenders,代码行数:98,代码来源:MainWindow.cpp

示例15: OnPaintCrossOverChart

void BoatDialog::OnPaintCrossOverChart(wxPaintEvent& event)
{
    wxWindow *window = dynamic_cast<wxWindow*>(event.GetEventObject());
    if(!window)
        return;

    wxGCDC dc(window);
    dc.SetBackgroundMode(wxTRANSPARENT);

    long index = SelectedPolar();
    bool polar = !m_cPlotType->GetSelection();

    int w, h;
    m_CrossOverChart->GetSize( &w, &h);

    dc.SetPen(wxPen(wxColor(0, 0, 0)));
    dc.SetBrush(*wxTRANSPARENT_BRUSH);
    dc.SetTextForeground(wxColour(0, 55, 75));

    bool full = m_cbFullPlot->GetValue();
    double scale;
    int xc = full ? w / 2 : 0;
    if(polar) {
        scale = wxMin(full ? w/2 : w, h/2) / 40.0;
    }
    
    for(double VW = 0; VW < 40; VW += 10) {
        if(polar) {
            dc.DrawCircle(xc, h/2, VW * scale);
            dc.DrawText(wxString::Format(_T("%.0f"), VW), xc, h/2+(int)VW*scale);
        } else {
            int y = h - VW * h / 40;
            dc.DrawLine(0, y, w, y);
            dc.DrawText(wxString::Format(_T("%.0f"), VW), 0, y);
        }
    }

    for(double H = 0; H < 180; H += 10) {
        if(polar) {
            double x = scale*sin(deg2rad(H));
            double y = scale*cos(deg2rad(H));
            if(H < 180)
                dc.DrawLine(xc - x, h/2 + y, xc + x, h/2 - y);

            wxString str = wxString::Format(_T("%.0f"), H);
            int sw, sh;
            dc.GetTextExtent(str, &sw, &sh);
            dc.DrawText(str, xc + .9*x - sw/2, h/2 - .9*y - sh/2);
        } else {
            int x = H * w / 180;
            dc.DrawLine(x, 0, x, h);
            dc.DrawText(wxString::Format(_T("%.0f"), H), x, 0);
        }
    }
    
    wxColour colors[] = {*wxRED, *wxGREEN, *wxBLUE, *wxCYAN, *wxYELLOW,
                         wxColour(255, 0, 255)};
    int c = 0;
    for(unsigned int i=0; i<m_Boat.Polars.size(); i++) {
        bool bold = i == index;

//        dc.SetPen(wxPen(colors[c], bold ? 1 : 3));
        dc.SetPen(*wxTRANSPARENT_PEN);
        dc.SetBrush(wxColour(colors[c].Red(),
                             colors[c].Green(),
                             colors[c].Blue(),
                             bold ? 230 : 60));
        if(++c == (sizeof colors) / (sizeof *colors))
            c = 0;

        bool tri = true;
        TESStesselator *tess = m_Boat.Polars[i].CrossOverRegion.Tesselate(tri);

        if(!tess)
            continue;
          
        const float* verts = tessGetVertices(tess);
//        const int* vinds = tessGetVertexIndices(tess);
        const int* elems = tessGetElements(tess);
//        const int nverts = tessGetVertexCount(tess);
        const int nelems = tessGetElementCount(tess);
	
        // Draw polygons.
        for (int i = 0; i < nelems; ++i)
        {
            if(tri) {
                const int* p = &elems[i*3];
                wxPoint points[3];
                for (unsigned j = 0; j < 3 && p[j] != TESS_UNDEF; ++j) {
                    double H = verts[p[j]*2+0];
                    double VW = verts[p[j]*2+1];
                    points[j] = wxPoint(H * w / 180, h - VW * h / 40);
                }
                if(polar) {
                    int count[3] = {CalcPolarPoints(points[0], points[1]),
                                    CalcPolarPoints(points[1], points[2]),
                                    CalcPolarPoints(points[2], points[0])};
                    wxPoint *pts = new wxPoint[count[0] + count[1] + count[2]];
                    int c = 0;
                    for(int j = 0; j<3; j++) {
//.........这里部分代码省略.........
开发者ID:cagscat,项目名称:weather_routing_pi,代码行数:101,代码来源:BoatDialog.cpp


注:本文中的wxPaintEvent::GetEventObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。