# PetscDrawRegister
Adds a method to the graphics package. 
## Synopsis
```
#include "petscdraw.h" 
#include "petscviewer.h" 
PetscErrorCode PetscDrawRegister(const char *sname, PetscErrorCode (*function)(PetscDraw))
```
Not Collective


## Input Parameters

- ***name_solver -*** name of a new user-defined graphics class
- ***routine_create -*** routine to create method context





## Note
`PetscDrawRegister()` may be called multiple times to add several user-defined graphics classes


## Sample usage
```none
   PetscDrawRegister("my_draw_type", MyDrawCreate);
```


Then, your specific graphics package can be chosen with the procedural interface via
```none
PetscDrawSetType(ksp,"my_draw_type")
```
or at runtime via the option
```none
-draw_type my_draw_type
```


## See Also
 `PetscDraw`, `PetscDrawRegisterAll()`, `PetscDrawRegisterDestroy()`, `PetscDrawType`, `PetscDrawSetType()`

## Level
developer

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/classes/draw/interface/drawreg.c.html#PetscDrawRegister">src/sys/classes/draw/interface/drawreg.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/classes/draw/interface/drawreg.c)


[Index of all Draw routines](index.md)  
[Table of Contents for all manual pages](/docs/manualpages/index.md)  
[Index of all manual pages](/docs/manualpages/singleindex.md)  
