예제 #1
0
void
BPictureButton::Draw(BRect updateRect)
{
	if (IsEnabled()) {
		if (Value() == B_CONTROL_ON)
			DrawPicture(fEnabledOn);
		else
			DrawPicture(fEnabledOff);
	} else {

		if (fDisabledOff == NULL
			|| (fDisabledOn == NULL && fBehavior == B_TWO_STATE_BUTTON))
			debugger("Need to set the 'disabled' pictures for this BPictureButton ");

		if (Value() == B_CONTROL_ON)
			DrawPicture(fDisabledOn);
		else
			DrawPicture(fDisabledOff);
	}

	if (IsFocus()) {
		SetHighColor(ui_color(B_KEYBOARD_NAVIGATION_COLOR));
		StrokeRect(Bounds(), B_SOLID_HIGH);
	}
}
예제 #2
0
pascal OSErr DragTrackingProc(
	DragTrackingMessage		theMessage,
	WindowPtr				/*window*/,
	void*					/*theRefCon*/,
	DragReference			/*drag*/)
{	
	switch (theMessage)
	{
	case kDragTrackingEnterWindow:
		SetPort(mac_PlayerWindow.ref);
		//ShowDragHilite(drag, receiveRgn, true);
		DrawPicture(logoDown, &rLogo);
		recieveHiliting=true;
		break;
	case kDragTrackingInWindow:				
		break;
	case kDragTrackingLeaveWindow:
		if( recieveHiliting )
		{
			SetPort(mac_PlayerWindow.ref);
			//HideDragHilite(drag);
			DrawPicture(logo, &rLogo);
			recieveHiliting=false;
		}
		break;
	}
	return noErr;
}
// レンダリング
HRESULT Render( void )
{
    HRESULT hr = S_OK;

    // 画面クリア
    float color[] = { 0.0f, 0.0f, 1.0f, 1.0f };
    g_pImmediateContext->ClearRenderTargetView( g_pRTV, color );

    // サンプラ・ラスタライザセット
    g_pImmediateContext->PSSetSamplers( 0, 1, &g_pSamplerState );
    g_pImmediateContext->RSSetState( g_pRS );
    
    // 描画設定
    UINT nStrides = sizeof( CUSTOMVERTEX );
    UINT nOffsets = 0;
    g_pImmediateContext->IASetVertexBuffers( 0, 1, &g_pD3D11VertexBuffer, &nStrides, &nOffsets );
    g_pImmediateContext->IASetPrimitiveTopology( D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST );
    g_pImmediateContext->IASetInputLayout( g_pInputLayout );

    // シェーダ設定
    g_pImmediateContext->VSSetShader( g_pVertexShader, NULL, 0 );
    g_pImmediateContext->VSSetConstantBuffers( 0, 1, &g_pCBNeverChanges );
    g_pImmediateContext->PSSetShader( g_pPixelShader, NULL, 0 );

    // 描画
    g_pImmediateContext->OMSetBlendState( NULL, NULL, 0xFFFFFFFF );
	DrawPicture( 0.0f, 0.0f, &g_tBack );
    g_pImmediateContext->OMSetBlendState( g_pbsAlphaBlend, NULL, 0xFFFFFFFF );
	DrawPicture( x, y, &g_tBall );

    // 表示
	FlushDrawingPictures();

    return S_OK;
}
예제 #4
0
파일: Lab3.cpp 프로젝트: nancy-bree/_bsuir
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    switch (message)
    {
	case WM_CREATE:
		{
			hBtnDraw = CreateWindowExW(WS_EX_APPWINDOW
			, L"BUTTON", NULL
			, WS_CHILD | WS_VISIBLE | BS_OWNERDRAW
			, 10, 10, 80, 30
			, hWnd, (HMENU)DRAW, hInst, NULL); 

			hBtnClear = CreateWindowExW(WS_EX_APPWINDOW
			, L"BUTTON", NULL
			, WS_CHILD | WS_VISIBLE | BS_OWNERDRAW
			, 10, 50, 80, 30
			, hWnd, (HMENU)CLEAR, hInst, NULL); 

			break;
		}
	case WM_DRAWITEM: 
		{
			int itemId = wParam;
			LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam;
			DrawButton(dis);
			break;
		}
	case WM_COMMAND:
		{
			switch(LOWORD(wParam))
			{
			case DRAW:
				{
					isDrawn = TRUE;
					DrawPicture(hWnd);
					break;
				}
			case CLEAR:
				{
					isDrawn = FALSE;
					DrawPicture(hWnd);
					break;
				}
			}
			break;
		}
    case WM_DESTROY:
        PostQuitMessage(0);
        break;
    default:
        return DefWindowProc(hWnd, message, wParam, lParam);
        break;
    }

    return 0;
}
예제 #5
0
void OnPaint(HWND hwnd)
{
	DrawGLScene();
	SwapBuffers(hDC);
	DrawPicture(hwnd);
	DrawFigure();
}
예제 #6
0
void _HYPlatformGraphicPane::_DrawPicRes (_HYRect& r, long id)
{
	PicHandle  aPic = GetPicture (id);
	if (aPic)
	{
		Rect		aRect = HYRect2Rect (r);
		PictInfo	pInfo; 
		GetPictInfo (aPic,&pInfo,0,0,0,0);
		
		if (aRect.right-aRect.left<=0)
			r.right = aRect.right = aRect.left + pInfo.sourceRect.right - pInfo.sourceRect.left;

		if (aRect.bottom-aRect.top<=0)
			r.bottom = aRect.bottom = aRect.top + pInfo.sourceRect.bottom - pInfo.sourceRect.top;

		DrawPicture (aPic, &aRect);
		
		ReleaseResource ((Handle)aPic);
	}
	else
	{
		_String errMsg = _String ("No picture resource with ID ") & id;
		ReportWarning (errMsg);
	}
}		
예제 #7
0
파일: tooltip.cpp 프로젝트: gitrider/wxsj2
void wxMacToolTip::Clear()
{
    m_mark++ ;
    if ( m_timer )
    {
        delete m_timer ;
        m_timer = NULL ;
    }
    if ( !m_shown )
        return ;
#if TARGET_CARBON
    HMHideTag() ;
    m_helpTextRef.Release() ;
#else         
    if ( m_window == s_ToolTipWindowRef && m_backpict )
    {
        wxMacPortStateHelper help( (GrafPtr) GetWindowPort(m_window) ) ;

        m_shown = false ;

        BackColor( whiteColor ) ;
        ForeColor(blackColor ) ;
        DrawPicture(m_backpict, &m_rect);
        KillPicture(m_backpict);
        m_backpict = NULL ;
    }
#endif
}
예제 #8
0
void DrawTriangle(Rect box, short bullet)
{
#ifdef MAC
	Rect frame;
	PicHandle p;

	p = GetPicture(bullet == BULLET_OPENTRIANGLE ? OPENLEPICT : CLOSEDLEPICT);
	if (!p) { SysBeep(1); return; }

	//frame = (**p).picFrame;
	frame = GetPICTFrame(p);
	MyOffsetRect(&frame, box.left - 1, box.top - 2);
	if (bullet == BULLET_OPENTRIANGLE)
		MyOffsetRect(&frame, 0, 2);
	else
		MyOffsetRect(&frame, 2, 0);
	DrawPicture(p, &frame);
#else
	POINT points[3];

	if (bullet == BULLET_OPENTRIANGLE) {
		points[0] = MakePOINT(box.left - 1, (box.top + box.bottom) / 2 - 1);
		points[1] = MakePOINT(box.right + 1, (box.top + box.bottom) / 2 - 1);
		points[2] = MakePOINT((box.right + box.left) / 2, box.bottom - 1);
		Polygon(currentHDC, points, 3);
	}
	else {
		MyMoveTo(box.left, box.top - 2);
		MyLineTo(box.right - 1, (box.top + box.bottom) / 2);
		MyLineTo(box.left, box.bottom + 1);
		MyLineTo(box.left, box.top - 2);
	}
#endif
}
void AuditoriumWrite()
{

    char filename[50]={0};
    FILE *AuditoriumData;
    
    system("CLS");
    DrawPicture();
    
    printf("What file would you like to write to?");
    fflush(stdin);
    gets(filename);
    AuditoriumData = fopen(filename,"w");
    
    for (int i=0;i<30;i++)
    {
        
        for (int j=0;j<50;j++)
        {
        if (auditorium[i][j].available == true) fprintf(AuditoriumData,"%d ", 1);
        else fprintf(AuditoriumData,"%d ",0);
        
        }
        fprintf(AuditoriumData,"\n");
    } 

    printf("The auditorium data has been written to the file: %s",filename);
    fflush(stdin);
    getchar();
    fclose(AuditoriumData);
    return;
}
void AuditoriumRead()
{
    char filename[50]={0};
    int fileseat=0;
    FILE *AuditoriumData;
    
    system("CLS");
    DrawPicture();
    
    printf("What file would you like to read from?");
    fflush(stdin);
    gets(filename);
    AuditoriumData = fopen(filename,"r");
    
    for (int i=0;i<30;i++)
    {
        
        for (int j=0;j<50;j++)
        {
         
        fscanf(AuditoriumData,"%d", &fileseat);
        if (fileseat == 1) auditorium[i][j].available = true;
        else auditorium[i][j].available = false;
        }
        
    } 

    printf("The auditorium data has been read from the file: %s",filename);
    fflush(stdin);
    getchar();
    fclose(AuditoriumData);
    return;
}
예제 #11
0
bool wxMetaFile::Play(wxDC *dc)
{
    if (!m_refData)
        return false;

    if (!dc->Ok() )
        return false;

    {
#if wxMAC_USE_CORE_GRAPHICS
        QDPictRef cgPictRef = M_METAFILEDATA->m_qdPictRef ;
        CGContextRef cg = ((wxMacCGContext*)(dc->GetGraphicContext()))->GetNativeContext() ;
        CGRect bounds = QDPictGetBounds( cgPictRef ) ;

        CGContextSaveGState(cg);
        CGContextTranslateCTM(cg, 0 , bounds.size.width );
        CGContextScaleCTM(cg, 1, -1);
        QDPictDrawToCGContext( cg , bounds , cgPictRef ) ;
        CGContextRestoreGState( cg ) ;
#else
        PicHandle pict = (PicHandle) GetHMETAFILE() ;
        wxMacPortSetter helper( dc ) ;
        DrawPicture( pict , &(**pict).picFrame ) ;
#endif
    }
    return true;
}
예제 #12
0
//Called to update the display.
//You should call glutSwapBuffers after all of your rendering to display what you rendered.
//If you need continuous updates of the screen, call glutPostRedisplay() at the end of the function.
void display()
{
	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
	glClearDepth(1.0f);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	if (g_pConeMesh && g_pCylinderMesh && g_pCubeTintMesh && g_pCubeColorMesh && g_pPlaneMesh)
	{
		const glm::vec3 &camPos = ResolveCamPosition();

		glutil::MatrixStack camMatrix;
		camMatrix.SetMatrix(CalcLookAtMatrix(camPos, g_camTarget, glm::vec3(0.0f, 1.0f, 0.0f)));

		glBindBuffer(GL_UNIFORM_BUFFER, g_GlobalMatricesUBO);
		glBufferSubData(GL_UNIFORM_BUFFER, sizeof(glm::mat4), sizeof(glm::mat4), glm::value_ptr(camMatrix.Top()));
		glBindBuffer(GL_UNIFORM_BUFFER, 0);

		glutil::MatrixStack modelMatrix;

		//Draw Scene
		DrawRoom(modelMatrix);
		DrawArmchair(modelMatrix);
		DrawTable(modelMatrix);
		DrawCarpet(modelMatrix);
		DrawLowTable(modelMatrix);
		DrawPicture(modelMatrix);
		DrawLamp(modelMatrix);
		DrawPlant(modelMatrix);
		DrawCandlesInLoop(modelMatrix);
	}

	glutSwapBuffers();
	glutPostRedisplay();
}
예제 #13
0
void createOffscreen(int pictItem)
{
	PicHandle	pict;
	Rect		rect;
	CGrafPtr	currentPort;
	GDHandle	currentDevice;
	
	if (gGWorld != nil)
		DisposeGWorld( gGWorld );
	
	pict = (PicHandle)GetResource( 'PICT', pictItem + 127 );
	
	rect = (**pict).picFrame;
	
	GetGWorld( &currentPort, &currentDevice );
	NewGWorld( &gGWorld, 32, &rect, nil, nil, 0 );
		
	LockPixels( GetPortPixMap(gGWorld));
	SetGWorld( gGWorld, nil );

	DrawPicture( pict, &rect );
	
	SetGWorld( currentPort, currentDevice );
	
	ReleaseResource( (Handle)pict );
}
예제 #14
0
// 렌더링 
HRESULT Render( void )
{
	int					i;

    // 화면 클리어 
	XMFLOAT4	v4Color = XMFLOAT4( 0.0f, 0.0f, 0.0f, 1.0f );
    g_pImmediateContext->ClearRenderTargetView( g_pRTV, ( float * )&v4Color );

    // 샘플러 래스터라이저 세트 
    g_pImmediateContext->PSSetSamplers( 0, 1, &g_pSamplerState );
    g_pImmediateContext->RSSetState( g_pRS );
    
    // 그리기 설정 
    UINT nStrides = sizeof( CUSTOMVERTEX );
    UINT nOffsets = 0;
    g_pImmediateContext->IASetVertexBuffers( 0, 1, &g_pD3D11VertexBuffer, &nStrides, &nOffsets );
    g_pImmediateContext->IASetPrimitiveTopology( D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST );
    g_pImmediateContext->IASetInputLayout( g_pInputLayout );

    // 셰이더 설정 
    g_pImmediateContext->VSSetShader( g_pVertexShader, NULL, 0 );
    g_pImmediateContext->VSSetConstantBuffers( 0, 1, &g_pCBNeverChanges );
    g_pImmediateContext->PSSetShader( g_pPixelShader, NULL, 0 );

    // 그리기 
    g_pImmediateContext->OMSetBlendState( NULL, NULL, 0xFFFFFFFF );
	DrawPicture( 0.0f, 0.0f, &g_tBack );
	FlushDrawingPictures();
    g_pImmediateContext->OMSetBlendState( g_pbsAlphaBlend, NULL, 0xFFFFFFFF );
	DrawPicture( 0.0f, 240.0f - 32.0f, &g_tPlayer );
 	FlushDrawingPictures();
    g_pImmediateContext->OMSetBlendState( g_pbsAddBlend, NULL, 0xFFFFFFFF );
	for ( i = 0; i < DIVIDE_NUM * 4; i += 4 ) {
		DrawQuadranglePic( v2Pos[i].x, v2Pos[i].y, v2Pos[i + 1].x, v2Pos[i + 1].y,
						   v2Pos[i + 2].x, v2Pos[i + 2].y, v2Pos[i + 3].x, v2Pos[i + 3].y, &g_tRay );
	}

    // 표시
	FlushDrawingPictures();

    return S_OK;
}
예제 #15
0
void SKPTask::draw() {
    SkBitmap bitmap;
    AllocatePixels(kN32_SkColorType, fPicture->width(), fPicture->height(), &bitmap);
    DrawPicture(fPicture, &bitmap);

    this->spawnChild(SkNEW_ARGS(RecordTask,
                                (*this, fPicture, bitmap, RecordTask::kNoOptimize_Mode)));
    this->spawnChild(SkNEW_ARGS(RecordTask,
                                (*this, fPicture, bitmap, RecordTask::kOptimize_Mode)));
    this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap)));
}
예제 #16
0
static void update_PlayerWin()
{
	short	y=((double)mac_amplitude/255)*(rVol.bottom-rVol.top-20);
	Rect	rFrame,rTab;
	
	SetPortWindowPort(win.ref);
	DrawButton();
	skin_f_repeat? PlotCIcon(&rLoop, iconLoop):PlotCIcon(&rLoop, iconNotLoop);
	PlotCIcon(&rVol, iconVol);
	SetRect(&rTab, rVol.left+2, rVol.top+49-y, rVol.right-2, rVol.top+59-y);
	PlotCIcon(&rTab, iconTab);
	
	rFrame=rFileName; InsetRect(&rFrame, -2, -2);	DrawPicture(GetPicture(129), &rFrame);
	rFrame=rTime; InsetRect(&rFrame, -2, -2);	DrawPicture(GetPicture(130), &rFrame);
	
	DrawPicture(logo, &rLogo);
	
	DrawTimeStr();
	DrawFileStr();
}
예제 #17
0
static int DrawPicture (lua_State * L)
{
	Picture_h picture = lua_touserdata(L, 1);
	float fX = static_cast<float>(lua_tonumber(L, 2));
	float fY = static_cast<float>(lua_tonumber(L, 3));
	float fW = static_cast<float>(lua_tonumber(L, 4));
	float fH = static_cast<float>(lua_tonumber(L, 5));

	DrawPicture(picture, fX, fY, fW, fH);

	return 0;
}
예제 #18
0
void
ShowLogo(Boolean bEraseRect)
{
	short 		reserr;
	Rect 		derefd, logoRect;
	PicHandle 	logoPicH;
	Handle		logoRectH; 

	/* draw the image well */
    ControlHandle imgWellH = GetNewControl(rLogoImgWell, gWPtr);
    if (!imgWellH)
    {
        ErrorHandler(eMem, nil);
        return;
	}

	/* initialize Netscape logo */
	logoPicH = GetPicture(rNSLogo);  
	reserr = ResError();
	
	if (reserr == noErr)
	{
		/* draw Netscape logo */
		if (logoPicH != nil)
		{		
			logoRectH = GetResource('RECT', rNSLogoBox);
			reserr = ResError();
			if (reserr == noErr && logoRectH)
			{
				HLock(logoRectH);
				derefd = (Rect) **((Rect**)logoRectH);
				SetRect(&logoRect, derefd.left, derefd.top, derefd.right, derefd.bottom);
				HUnlock(logoRectH);
				reserr = ResError();
				if (reserr == noErr)
				{
					if (bEraseRect)
					{
						EraseRect(&logoRect);
						InvalRect(&logoRect);
					}
					DrawPicture(logoPicH, &logoRect);
					ReleaseResource((Handle)logoPicH);
				}
				
				ReleaseResource((Handle)logoRectH);
			}
		}
	}
	
	if (reserr != noErr)
		ErrorHandler(reserr, nil);
}
예제 #19
0
void ReplayTask::draw() {
    const uint32_t flags = fUseRTree ? SkPicture::kOptimizeForClippedPlayback_RecordingFlag : 0;
    SkAutoTUnref<SkPicture> recorded(RecordPicture(fGM.get(), flags));

    SkBitmap bitmap;
    SetupBitmap(fReference.colorType(), fGM.get(), &bitmap);
    DrawPicture(recorded, &bitmap);
    if (!BitmapsEqual(bitmap, fReference)) {
        this->fail();
        this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap)));
    }
}
예제 #20
0
/*================================
	PastePicture
=================================*/
void PTPaintSelection::PastePicture( SUOffscreen *inParentBuffer, PicHandle inPict, RgnHandle inRegion )
{
	ThrowIfNil_( inParentBuffer );
	ThrowIfNil_( inPict );
	
	this->SelectNone();

	try
	{
			// note: this is after SelectNone() because it might destroy a gworld
		StSaveGWorld	aSaver;
		Rect			r;
		
		/****************************************
			width & height of our buffer match the picture
		****************************************/
		SInt32	width = (**inPict).picFrame.right - (**inPict).picFrame.left;
		SInt32	height = (**inPict).picFrame.bottom - (**inPict).picFrame.top;

		/****************************************
			create an offscreen gworld using the paint view's gworld as 
			  a base (use same depth, ctable)
		****************************************/
		mSelectionBuffer = inParentBuffer->CreateSimilarOffscreen( false /* device???*/, width, height );

		/****************************************
			image the picture into the offscreen buffer
		****************************************/
		mSelectionBuffer->BeginDrawing();
				// should we erase to the background color instead of white? no.
			SetRect( &r, 0, 0, width, height );
			DrawPicture( inPict, &r );
		mSelectionBuffer->EndDrawing();

		/****************************************
			restore the selection area from the clipboard
			 -- if none, use the entire picture frame
		****************************************/
		if ( inRegion )
			this->SetRawSelection( inRegion );
		else
		{
			RgnHandle tempRgn = SURegionUtils::NewRegionFromRect( r );
			this->SetRawSelection( tempRgn );
			SURegionUtils::DisposeRegion( tempRgn );
		}
	}
	catch( ... )
	{
		this->SelectNone();
		throw;
	}
}
예제 #21
0
void CMainDlg::OnBnClickedButton1()
{
	// TODO: 在此添加控件通知处理程序代码
	if (this->m_VMRCap.GrabRudeFrame(&(this->m_SBitmapEx)))
	{
		//m_PicEditStatus = true;
		m_pLeft = 0;
		m_pTop = 0;
		m_nScale = m_DefScale;
	}

	DrawPicture();	
}
예제 #22
0
BOOL CMainDlg::OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
{
	/*
	if (m_BitmapEx.IsValid())
	{
		if (m_PicEditStatus)
		{
			if (zDelta>0)
			{
				this->m_Factor = this->m_Factor + m_Factor_Radio;
				if (this->m_Factor < 1)
				{
					DrawPicture();
				}
				else
				{
					this->m_Factor = 1 - m_Factor_Radio;
				}
			}
			else
			{
				this->m_Factor = this->m_Factor - m_Factor_Radio;
				if (this->m_Factor > -1)
				{
					DrawPicture();
				}
				else
				{
					this->m_Factor = -1 + m_Factor_Radio;
				}
			}
		}
	}
	*/

	if (m_BitmapEx.IsValid())
	{
		if (zDelta>0){
			m_nScale = m_nScale + 2;
		}else
		{
			m_nScale = m_nScale - 2;
			if (m_nScale < 1) m_nScale = 1;
		}
		DrawPicture();
	}

	return true;

	return CDialog::OnMouseWheel(nFlags, zDelta, pt);
}
예제 #23
0
McoStatus BlankTwTab::UpdateWindow(void)	
{			
PicHandle	pict;
Rect r1;
short	iType;
Handle	iHandle;

pict = GetPicture(WAIT_PICT);
GetDItem (dp, WAIT_ID+startNum, &iType, (Handle*)&iHandle, &r1);
if (pict != 0L) 
	{
	DrawPicture(pict,&r1);
	ReleaseResource((Handle)pict);
	}
return MCO_SUCCESS;
}
void SerializeTask::draw() {
    SkPicture recorded;
    RecordPicture(fGM.get(), &recorded);

    SkDynamicMemoryWStream wStream;
    recorded.serialize(&wStream, &trivial_bitmap_encoder);
    SkAutoTUnref<SkStream> rStream(wStream.detachAsStream());
    SkAutoTUnref<SkPicture> reconstructed(SkPicture::CreateFromStream(rStream));

    SkBitmap bitmap;
    SetupBitmap(fReference.config(), fGM.get(), &bitmap);
    DrawPicture(reconstructed, &bitmap);
    if (!BitmapsEqual(bitmap, fReference)) {
        this->fail();
        this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap)));
    }
}
예제 #25
0
파일: scrap.c 프로젝트: LarBob/executor
PRIVATE GWorldPtr
gworld_from_pict (PicHandle ph)
{
  GWorldPtr retval;

  retval = NULL;
  if (ph)
    {
      CGrafPtr save_port;
      GDHandle save_device;
      Rect r;
      OSErr err;

      GetGWorld (&save_port, &save_device);
      save_port = MR (save_port);
      save_device = MR (save_device);
      r = HxX (ph, picFrame);
      err = NewGWorld (&retval, 32, &r, NULL, NULL, keepLocal);
      if (retval)
	{
	  PixMapHandle pm;

	  retval = MR (retval);
	  SetGWorld (retval, NULL);
	  pm = GetGWorldPixMap (retval);
	  LockPixels (pm);
	  DrawPicture (ph, &r);
#if 0
#warning THIS INTERFERES WITH PICT PASTING
	  {
	    char *p;

	    EraseRect (&r);
	    p = GetPixBaseAddr (pm);
	    memset (p, 0x00, 4 * RECT_HEIGHT(&r) * RECT_WIDTH (&r));
	    memset (p, 0xFF, 4 * RECT_HEIGHT(&r) * RECT_WIDTH (&r) / 2);
	  }
#endif
	  UnlockPixels (pm);
	}
      SetGWorld (save_port, save_device);
    }
  return retval;
}
예제 #26
0
/*------------------------------------------------------------------------------*\
	( )
		-	
\*------------------------------------------------------------------------------*/
void BmToolbarButton::Draw( BRect updateRect) {
	BView::Draw( updateRect);

	BRect rect(Bounds());
#ifdef __HAIKU__
	if (be_control_look && mHighlighted && IsEnabled()) {
		// draw higlighting border
		uint32 flags = 0;
		if (Value())
			flags |= BControlLook::B_ACTIVATED;
		rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR);
		be_control_look->DrawButtonFrame(this, rect, updateRect, base, base,
			flags);
		be_control_look->DrawButtonBackground(this, rect, updateRect, base,
			flags);
	}
#endif // __HAIKU__

	BPicture* pic = NULL;
	if (!IsEnabled())
		pic = DisabledOff();
	else
		pic = Value() ? EnabledOn() : EnabledOff();
	if (pic)
		DrawPicture(pic, BPoint(0, 0));

#ifndef __HAIKU__
	if (mHighlighted && IsEnabled()) {
		// draw higlighting border
		BeginLineArray(4);
		AddLine( rect.LeftBottom(), rect.LeftTop(), 
					ui_color( B_SHINE_COLOR));
		AddLine( rect.LeftTop(), rect.RightTop(), 
					ui_color( B_SHINE_COLOR));
		AddLine( rect.LeftBottom(), rect.RightBottom(), 
					BmWeakenColor(B_SHADOW_COLOR, BeShadowMod));
		AddLine( rect.RightBottom(), rect.RightTop(), 
					BmWeakenColor(B_SHADOW_COLOR, BeShadowMod));
		EndLineArray();
	}
#endif
}
예제 #27
0
void CMainDlg::OnBnClickedSet()
{
	//CString m_sFilename;

	CDlgSet dialog;

	if (IDOK == dialog.DoModal())
	{
		if (GetParm()){
			m_CutRect.left = (m_ImageRect.Width() - m_pWidth)/2;
			m_CutRect.top = (m_ImageRect.Height() - m_pHeight)/2;
			m_CutRect.right = m_CutRect.left + m_pWidth;
			m_CutRect.bottom = m_CutRect.top + m_pHeight;
			SetDlgItemInt(IDC_EDIT_WIDTH,m_pWidth,1);
			SetDlgItemInt(IDC_EDIT_HEIGHT,m_pHeight,1);
		}
	}

	DrawPicture();
}
예제 #28
0
void DrawLobsterPICTtoGWorld(CGrafPtr destGWorld, Rect *srcRect)
{
        // put the overlay into the GWorld, move the picture to the bottom right of the movie
    PicHandle	pict = GetPicture(129);
    if (pict)
    {
        CGrafPtr	oldPort;
        GDHandle	oldDevice;
        Rect		frame = (**pict).picFrame;

        GetGWorld(&oldPort, &oldDevice);
        SetGWorld(destGWorld, nil);
        // normalize coordinates
        OffsetRect(&frame, -frame.left, -frame.left);
        // grow frame to be as big as source rect
        OffsetRect(&frame, srcRect->right - frame.right, srcRect->bottom - frame.bottom);
        DrawPicture(pict, &frame);
        SetGWorld(oldPort, oldDevice);
        ReleaseResource((Handle)pict);
    }
}
예제 #29
0
void CMainDlg::OnBnClickedButton2()
{
	// TODO: 在此添加控件通知处理程序代码
	CString m_sFilename;

	CFileDialog dialog(TRUE, NULL, m_sFilename, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, 
		_T("Images (*.bmp, *.gif, *.jpeg, *.jpg)|*.bmp;*.gif;*.jpeg;*.jpg||"));

	if (IDOK == dialog.DoModal())
	{
		m_sFilename = dialog.GetPathName();
		m_SBitmapEx.LoadImageFile((LPTSTR)m_sFilename.GetBuffer());

		m_pLeft = 0;
		m_pTop = 0;
		m_nScale = 100;
	}

	//m_PicEditStatus = true;
	DrawPicture();
}
예제 #30
0
void CMainDlg::OnMouseMove(UINT nFlags, CPoint point)
{
	if (m_BitmapEx.IsValid() && m_bFocus)
	{
		CRect myRect;
		m_ctl_image.GetWindowRect(myRect);
		ScreenToClient(myRect);

		if (PtInRect(&myRect,point))
		{
			SetCursor(LoadCursor(NULL,IDC_CROSS));
			m_pLeft = m_pLeft + (m_pDownPoint.x - point.x);
			m_pTop = m_pTop + (m_pDownPoint.y - point.y);
			m_pDownPoint.x = point.x;
			m_pDownPoint.y = point.y;
			DrawPicture();
		}	
	}

	CDialog::OnMouseMove(nFlags, point);
}