libspectre 0.2.11
Data Structures | Functions
spectre-page.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include "spectre-page.h"
#include "spectre-device.h"
#include "spectre-private.h"
#include "spectre-utils.h"

Data Structures

struct  SpectrePage
 

Functions

SpectrePage_spectre_page_new (unsigned int page_index, struct document *doc)
 
void spectre_page_free (SpectrePage *page)
 
SpectreStatus spectre_page_status (SpectrePage *page)
 
unsigned int spectre_page_get_index (SpectrePage *page)
 
const char * spectre_page_get_label (SpectrePage *page)
 
SpectreOrientation spectre_page_get_orientation (SpectrePage *page)
 
void spectre_page_get_size (SpectrePage *page, int *width, int *height)
 
void spectre_page_render (SpectrePage *page, SpectreRenderContext *rc, unsigned char **page_data, int *row_length)
 
void spectre_page_render_slice (SpectrePage *page, SpectreRenderContext *rc, int x, int y, int width, int height, unsigned char **page_data, int *row_length)
 

Function Documentation

◆ _spectre_page_new()

SpectrePage * _spectre_page_new ( unsigned int  page_index,
struct document *  doc 
)

◆ spectre_page_free()

void spectre_page_free ( SpectrePage page)

Frees the memory of the given page

Parameters
pageThe page whose memory will be freed

◆ spectre_page_get_index()

unsigned int spectre_page_get_index ( SpectrePage page)

Returns the index of the page inside the document. First page has index 0

Parameters
pageThe page whose index will be returned

◆ spectre_page_get_label()

const char * spectre_page_get_label ( SpectrePage page)

Returns the label of the page inside the document.

Parameters
pageThe page whose label will be returned

◆ spectre_page_get_orientation()

SpectreOrientation spectre_page_get_orientation ( SpectrePage page)

Returns the orientation of the page

Parameters
pageThe page whose orientation will be returned

◆ spectre_page_get_size()

void spectre_page_get_size ( SpectrePage page,
int *  width,
int *  height 
)

Returns the size of the page. It always returns the page size according to the page bounding box without taking into account the page orientation.

Parameters
pageThe page whose size will be returned
widthThe page width will be returned here, or NULL
heightThe page height will be returned here, or NULL
See also
spectre_page_get_orientation

◆ spectre_page_render()

void spectre_page_render ( SpectrePage page,
SpectreRenderContext rc,
unsigned char **  page_data,
int *  row_length 
)

Renders the page to RGB32 format. This function can fail

Parameters
pageThe page to renderer
rcThe rendering context specifying how the page has to be rendered
page_dataA pointer that will point to the image data if the call succeeds
row_lengthThe length of an image row will be returned here. It can happen that row_length is different than width * 4
See also
spectre_page_status

◆ spectre_page_render_slice()

void spectre_page_render_slice ( SpectrePage page,
SpectreRenderContext rc,
int  x,
int  y,
int  width,
int  height,
unsigned char **  page_data,
int *  row_length 
)

◆ spectre_page_status()

SpectreStatus spectre_page_status ( SpectrePage page)

Returns the status of the given page

Parameters
pageThe page whose status will be returned