Esempio n. 1
0
void GUIXDrawTextRGB( gui_window *wnd, char *text, size_t length, gui_coord *pos,
                      gui_rgb fore, gui_rgb back, gui_ord extentx,
                      bool draw_extent )
{
    GUIDrawTextBitmapRGB( wnd, text, length, 0, pos, GETRGB(fore), GETRGB(back),
                          extentx, draw_extent, 0 );
}
Esempio n. 2
0
bool GUISetRGB( gui_colour colour, gui_rgb rgb )
{
    if( colour <= GUI_LAST_COLOUR  ) {
        GUIColours[colour] = GETRGB( rgb );
        return( true );
    }
    return( false );
}
Esempio n. 3
0
bool GUISetRGB( gui_colour colour, gui_rgb rgb )
{
    if( colour <= GUI_LAST_COLOUR  ) {
        GUIColours[colour] = GETRGB( rgb );
        return( TRUE );
    }
    return( FALSE );
}
Esempio n. 4
0
bool GUIGetRGBFromUser( gui_rgb init_rgb, gui_rgb *new_rgb )
{
#ifdef __OS2_PM__
    init_rgb = init_rgb;
    new_rgb = new_rgb;
    return( false );
#else
    CHOOSECOLOR     choose;
    bool            ret;
#if defined(__WINDOWS__)
    HINSTANCE       h;
    FARPROC         func;
#ifdef __WINDOWS_386__
    HINDIR          hIndir;
    DWORD           guiColoursAlias;
#endif
#endif

    if( new_rgb == NULL ) {
        return( false );
    }
    memset( &choose, 0, sizeof( CHOOSECOLOR ) );
    choose.Flags = CC_PREVENTFULLOPEN;
    choose.hInstance = (HWND)GUIMainHInst;
    choose.Flags |= CC_RGBINIT;
    choose.rgbResult = GETRGB( init_rgb );
#ifndef __WINDOWS_386__
    choose.lpCustColors = GUIColours;
#endif
    choose.lStructSize = sizeof( CHOOSECOLOR );

#if defined(__NT__)
    ret = ( ChooseColor( &choose ) != 0 );
#else
    h = LoadLibrary( "COMMDLG.DLL" );
    if( (UINT)h < 32 ) {
        return( false );
    }
    func = GetProcAddress( h, "ChooseColor" );
    if( func == NULL ) {
        return( false );
    }
#ifdef __WINDOWS_386__
    hIndir = GetIndirectFunctionHandle( func, INDIR_PTR, INDIR_ENDLIST );
    if( hIndir == NULL ) {
        FreeLibrary( h );
        return( false );
    }
    guiColoursAlias = AllocAlias16( (void *)GUIColours );
    choose.lpCustColors = (void *)guiColoursAlias;
    ret = (short)InvokeIndirectFunction( hIndir, &choose ) != 0;
    if( guiColoursAlias != NULL ) {
        FreeAlias16( guiColoursAlias );
    }
#else
    ret = ((BOOL(WINAPI *)(LPCHOOSECOLOR))func)( &choose ) != 0;
#endif
    FreeLibrary( h );
#endif
    if( ret ) {
        FillInRGB( choose.rgbResult, new_rgb );
    }
    return( ret );
#endif
}
Esempio n. 5
0
ULONG PIC_Convolve(PIC *pic, KERNEL *kernel, TAGLIST tags)
{
	BOOL success = FALSE;
	UWORD destwidth, destheight, destx, desty;

	if (pic)
	{
		if (!kernel) kernel = &defaultkernel;

		ObtainSemaphore(&pic->semaphore);

		destwidth = GetTagData(GGFX_DestWidth, pic->width, tags);
		destheight = GetTagData(GGFX_DestHeight, pic->height, tags);
		destx = GetTagData(GGFX_DestX, 0, tags);
		desty = GetTagData(GGFX_DestY, 0, tags);


		if (ExtractAlphaArray(pic))
		{
			if (PIC_Render(pic, PIXFMT_0RGB_32, NULL))
			{
				ULONG *dest;
				ULONG *source = ((ULONG *) pic->array) + destx + desty * pic->width;
				
				if (dest = AllocRenderVec(MemHandler, destwidth * destheight * 4))
				{
					int x,y,c,d;
					ULONG *sbufptr = source;
					ULONG *dbufptr = dest;
					int SUMR, SUMG, SUMB;
					int k, div, inc;
					ULONG rgb;
					
					div = kernel->divisor;
					inc = kernel->increment;
					
					for (y = 0; y < destheight; y++) 
					{
						for (x = 0; x < destwidth; x++) 
						{
							SUMR = 0;
							SUMG = 0;
							SUMB = 0;
							
							for (d = -kernel->spatheight; d < kernel->spatheight + 1; d++)
							{
								for (c = -kernel->spatwidth; c < kernel->spatwidth + 1; c++)
								{
									k = *GETSPAT(kernel, c, d);
									rgb = *GETRGB(sbufptr, x + c, y + d);
									
									SUMR += ((rgb & 0xff0000) >> 16) * k;
									SUMG += ((rgb & 0x00ff00) >> 8) * k;
									SUMB += (rgb & 0x0000ff) * k;
								}
							}
							
							*dbufptr++ =	((RNG(0, (SUMR / div), 255)) << 16) +
														((RNG(0, (SUMG / div), 255)) << 8) +
														 RNG(0, (SUMB / div), 255);
						}
					}
				
					dbufptr = dest;	
					for (y = 0; y < destheight; ++y)
					{
						for (x = 0; x < destwidth; ++x)
						{
							*source++ = *dbufptr++;
						}
						dbufptr += destwidth - pic->width;
					}
	
					FreeRenderVec(dest);
				}
	
				success = TRUE;
			}
		}
	}
Esempio n. 6
0
bool GUIDrawLineRGB( gui_window *wnd, gui_point *start, gui_point *end,
                     gui_line_styles style, gui_ord thickness, gui_rgb rgb )
{
    return( DrawLine( wnd, start, end, style, thickness,
                      GETRGB( rgb ) ) );
}
Esempio n. 7
0
bool GUIDrawRectRGB( gui_window *wnd, gui_rect *rect, gui_rgb rgb )
{
    return( DrawRect( wnd, rect, GETRGB( rgb ), false, true ) );
}