[cairo] Fwd: Re: [Mesa3d-dev] more glitz points

Jon Smirl jonsmirl at yahoo.com
Wed Apr 21 09:33:13 PDT 2004


--- Brian Paul <brian.paul at tungstengraphics.com> wrote:
> Date: Wed, 21 Apr 2004 10:35:47 -0600
> From: Brian Paul <brian.paul at tungstengraphics.com>
> To: Jon Smirl <jonsmirl at yahoo.com>
> CC: mesa3d-dev <mesa3d-dev at lists.sourceforge.net>
> Subject: Re: [Mesa3d-dev] more glitz points
> 
> 
> A few comments below.
> 
> -Brian
> 
> 
> Jon Smirl wrote:
> > Here's the whole text...
> > 
> >     \subsection{Programmatic Surfaces}
> >                                                                             
>    
> >              
> >     \Libname{} allows you to create programmatic surfaces. A
> >     programmatic surface does not contain any actual image data, only
> >     a minimal set of attributes. These attributes describe how to calculate
> >     the color for each fragment of the surface.
> >                                                                             
>    
> >              
> >     Not containing any actual image data makes initialization time for
> >     programmatic surfaces very low. Having a low initialization time
> >     makes them ideal for representing solid colors.
> >                                                                             
>    
> >              
> >     \Libname{} also support programmatic surfaces that represent linear or
> >     radial transition vector patterns. A linear pattern defines two points,
> >     which form a transition vector. A radial gradient defines a center point
> >     and a radius, which together form a dynamic transition vector around the
> >     center point. The color of each fragment in these programmatic surfaces
> >     is fetched from a color range, using the fragments offset along the
> >     transition vector.
> >                                                                             
>    
> >              
> >     A color range is a one dimensional surface. The color range data is
> >     generated by the application and then transfered to graphics hardware
> >     where it can be used with linear and radial patterns. This allows
> >     applications to use linear and radial patterns for a wide range of
> >     shading effects. For example, linear color gradients and Gaussian
> shading.
> >     By setting the \emph{extend} attribute of a color range to
> >     \emph{pad, repeat} or \emph{reflect}, the application can also control
> >     what should happen when patterns try to fetch color values outside
> >     of the color range.
> >                                                                             
>    
> >              
> >     Most programmatic surfaces are implemented using fragment programs and
> >     they will only be available on hardware supporting the fragment program
> >     extension.
> 
> You certainly don't need fragment programs to do color gradients like 
> those.  At worst, you have to just compute per-vertex texcoords to do 
> radial gradients.  You can use texgen for texcoords for linear 
> gradients.  I've done both in past projects (long before fragment 
> programs existed).
> 
> 
> >     Figure ~\ref{fig:linear-gradients} shows the results from using
> >     programmatic surfaces for linear color gradients.
> >                                                                             
>    
> >              
> >     \begin{figure}[htbp]
> >       \begin{centering}
> >         \epsfig{file=linear-gradients.eps}
> >         \small\itshape
> >         \caption{\small\itshape Programmatic surfaces used for linear
> >                                 color gradients}
> >         \label{fig:linear-gradients}
> >       \end{centering}
> >     \end{figure}
> >                                                                             
>    
> >              
> >     \subsection{Convolution Filters}
> 
> It's not clear if the position of the gradients is window-relative or 
> object-relative, BTW.
> 
> 
> >     Convolutions can be used to perform many common image processing
> operations
> >     including sharpening, blurring, noise reduction, embossing and
> >     edge enhancement.
> >                                                                             
>    
> >              
> >     A convolution is a mathematical function that replaces each pixel by a
> >     weighted sum of its neighbors. The matrix defining the neighborhood of
> >     the pixel also specifies the weight assigned to each neighbor. This
> >     matrix is called the convolution kernel.
> >                                                                             
>    
> >              
> >     \Libname{} supports user defined convolution kernels. If a
> >     convolution kernel has been set for a surface, the convolution filter
> >     will be applied when the surface is used as a source in a compositing
> >     operation. The original source surface remains unmodified.
> >                                                                             
>    
> >              
> >     In \libname{}, convolution filtering is implemented using fragment
> >     programs and is only available on hardware with fragment program
> support.
> >     The alternative would be to use OpenGL's imaging extension, which would
> >     require a transfer of all pixels through OpenGL's pixel pipeline to an
> >     intermediate texture. Even though the alternative method would be
> >     supported by older hardware, \libname{} uses fragment programs in favor
> >     of performance.
> 
> Fragment programs would be fine for convolution, but I hope a lack of 
> fragment programs wouldn't totally preclude the feature.
>  
> 
> 
> >     \subsubsection{Useful Convolution Kernels}
> >                                                                             
>    
> >              
> >     Table~\ref{table:conv} presents three useful convolution kernels and
> >     figure ~\ref{fig:conv_original} and ~\ref{fig:conv_gaussian} show the
> >     results of filtering an image using a Gaussian convolution kernel.
> > 
> > Examples of Guassian, High Pass, Emboss
> > 
> >                                                                             
>    
> >              
> > 
> > 
> > 
> > 
> > --- Brian Paul <brian.paul at tungstengraphics.com> wrote:
> > 
> >>Jon Smirl wrote:
> >>
> >>>Both of these require fragment programs to implement....
> >>>
> >>>3.11 Programmatic Surfaces
> >>>
> >>>Glitz allows you to create programmatic surfaces. A programmatic surface
> >>
> >>does
> >>
> >>>not contain any actual image data, only a minimal set of attributes. These
> >>>attributes describe how to calculate the color for each fragment of the
> >>
> >>surface.
> >>
> >>If I understand this correctly a programmatic surface might be 
> >>something really simple like:
> >>
> >>* solid color fill
> >>* linear gradient fill
> >>* repeated pattern (texture) fill
> >>
> >>You don't need a fragment program for those.
> >>
> >>I guess I'd like to see a concrete example of a programmatic surface 
> >>that would require a fragment program.
> >>
> >>
> >>
> >>>3.12 Convolution Filters
> >>>
> >>>Glitz allows you to create programmatic surfaces. Convolutions can be used
> >>
> >>to
> >>
> >>>perform many common image processing operations including sharpening,
> >>
> >>blurring,
> >>
> >>>noise reduction, embossing and edge enhancement.
> >>
> >>Convolution can be done without fragment programs.  Unfortunately, few 
> >>consumer-level cards (any?) hardware-accelerate the convolution 
> >>operations defined by OpenGL.  They're typically done in software.
> >>
> >>-Brian
> >>
> > 
> > 
> > 
> > =====
> > Jon Smirl
> > jonsmirl at yahoo.com
> > 
> > 
> > 	
> > 		
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Photos: High-quality 4x6 digital prints for 25¢
> > http://photos.yahoo.com/ph/print_splash
> > 
> 
> 


=====
Jon Smirl
jonsmirl at yahoo.com


	
		
__________________________________
Do you Yahoo!?
Yahoo! Photos: High-quality 4x6 digital prints for 25¢
http://photos.yahoo.com/ph/print_splash




More information about the cairo mailing list