init commit
This commit is contained in:
@@ -1,3 +1,25 @@
|
||||
// Copyright (C) 2004-2021 Artifex Software, Inc.
|
||||
//
|
||||
// This file is part of MuPDF.
|
||||
//
|
||||
// MuPDF is free software: you can redistribute it and/or modify it under the
|
||||
// terms of the GNU Affero General Public License as published by the Free
|
||||
// Software Foundation, either version 3 of the License, or (at your option)
|
||||
// any later version.
|
||||
//
|
||||
// MuPDF is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||
// FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||
// details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with MuPDF. If not, see <https://www.gnu.org/licenses/agpl-3.0.en.html>
|
||||
//
|
||||
// Alternative licensing terms are available from the licensor.
|
||||
// For commercial licensing, see <https://www.artifex.com/> or contact
|
||||
// Artifex Software, Inc., 39 Mesa Street, Suite 108A, San Francisco,
|
||||
// CA 94129, USA, for further information.
|
||||
|
||||
#ifndef MUPDF_FITZ_GLYPH_H
|
||||
#define MUPDF_FITZ_GLYPH_H
|
||||
|
||||
@@ -5,71 +27,33 @@
|
||||
#include "mupdf/fitz/context.h"
|
||||
#include "mupdf/fitz/geometry.h"
|
||||
#include "mupdf/fitz/store.h"
|
||||
#include "mupdf/fitz/colorspace.h"
|
||||
#include "mupdf/fitz/font.h"
|
||||
#include "mupdf/fitz/path.h"
|
||||
|
||||
/*
|
||||
/**
|
||||
Glyphs represent a run length encoded set of pixels for a 2
|
||||
dimensional region of a plane.
|
||||
*/
|
||||
typedef struct fz_glyph_s fz_glyph;
|
||||
typedef struct fz_glyph fz_glyph;
|
||||
|
||||
/*
|
||||
fz_glyph_bbox: Return the bounding box for a glyph.
|
||||
/**
|
||||
Return the bounding box of the glyph in pixels.
|
||||
*/
|
||||
fz_irect *fz_glyph_bbox(fz_context *ctx, fz_glyph *glyph, fz_irect *bbox);
|
||||
fz_irect fz_glyph_bbox(fz_context *ctx, fz_glyph *glyph);
|
||||
fz_irect fz_glyph_bbox_no_ctx(fz_glyph *src);
|
||||
|
||||
/*
|
||||
fz_glyph_width: Return the width of the glyph in pixels.
|
||||
/**
|
||||
Return the width of the glyph in pixels.
|
||||
*/
|
||||
int fz_glyph_width(fz_context *ctx, fz_glyph *glyph);
|
||||
|
||||
/*
|
||||
fz_glyph_height: Return the height of the glyph in pixels.
|
||||
/**
|
||||
Return the height of the glyph in pixels.
|
||||
*/
|
||||
int fz_glyph_height(fz_context *ctx, fz_glyph *glyph);
|
||||
|
||||
/*
|
||||
fz_new_glyph_from_pixmap: Create a new glyph from a pixmap
|
||||
|
||||
Returns a pointer to the new glyph. Throws exception on failure to
|
||||
allocate.
|
||||
*/
|
||||
fz_glyph *fz_new_glyph_from_pixmap(fz_context *ctx, fz_pixmap *pix);
|
||||
|
||||
/*
|
||||
fz_new_glyph_from_8bpp_data: Create a new glyph from 8bpp data
|
||||
|
||||
x, y: X and Y position for the glyph
|
||||
|
||||
w, h: Width and Height for the glyph
|
||||
|
||||
sp: Source Pointer to data
|
||||
|
||||
span: Increment from line to line of data
|
||||
|
||||
Returns a pointer to the new glyph. Throws exception on failure to
|
||||
allocate.
|
||||
*/
|
||||
fz_glyph *fz_new_glyph_from_8bpp_data(fz_context *ctx, int x, int y, int w, int h, unsigned char *sp, int span);
|
||||
|
||||
/*
|
||||
fz_new_glyph_from_1bpp_data: Create a new glyph from 1bpp data
|
||||
|
||||
x, y: X and Y position for the glyph
|
||||
|
||||
w, h: Width and Height for the glyph
|
||||
|
||||
sp: Source Pointer to data
|
||||
|
||||
span: Increment from line to line of data
|
||||
|
||||
Returns a pointer to the new glyph. Throws exception on failure to
|
||||
allocate.
|
||||
*/
|
||||
fz_glyph *fz_new_glyph_from_1bpp_data(fz_context *ctx, int x, int y, int w, int h, unsigned char *sp, int span);
|
||||
|
||||
/*
|
||||
fz_keep_glyph: Take a reference to a glyph.
|
||||
/**
|
||||
Take a reference to a glyph.
|
||||
|
||||
pix: The glyph to increment the reference for.
|
||||
|
||||
@@ -77,57 +61,21 @@ fz_glyph *fz_new_glyph_from_1bpp_data(fz_context *ctx, int x, int y, int w, int
|
||||
*/
|
||||
fz_glyph *fz_keep_glyph(fz_context *ctx, fz_glyph *pix);
|
||||
|
||||
/*
|
||||
fz_drop_glyph: Drop a reference and free a glyph.
|
||||
/**
|
||||
Drop a reference and free a glyph.
|
||||
|
||||
Decrement the reference count for the glyph. When no
|
||||
references remain the glyph will be freed.
|
||||
*/
|
||||
void fz_drop_glyph(fz_context *ctx, fz_glyph *pix);
|
||||
|
||||
/*
|
||||
Glyphs represent a set of pixels for a 2 dimensional region of a
|
||||
plane.
|
||||
/**
|
||||
Look a glyph up from a font, and return the outline of the
|
||||
glyph using the given transform.
|
||||
|
||||
x, y: The minimum x and y coord of the region in pixels.
|
||||
|
||||
w, h: The width and height of the region in pixels.
|
||||
|
||||
samples: The sample data. The sample data is in a compressed format
|
||||
designed to give reasonable compression, and to be fast to plot from.
|
||||
|
||||
The first sizeof(int) * h bytes of the table, when interpreted as
|
||||
ints gives the offset within the data block of that lines data. An
|
||||
offset of 0 indicates that that line is completely blank.
|
||||
|
||||
The data for individual lines is a sequence of bytes:
|
||||
00000000 = end of lines data
|
||||
LLLLLL00 = extend the length given in the next run by the 6 L bits
|
||||
given here.
|
||||
LLLLLL01 = A run of length L+1 transparent pixels.
|
||||
LLLLLE10 = A run of length L+1 solid pixels. If E then this is the
|
||||
last run on this line.
|
||||
LLLLLE11 = A run of length L+1 intermediate pixels followed by L+1
|
||||
bytes of literal pixel data. If E then this is the last run
|
||||
on this line.
|
||||
The caller owns the returned path, and so is responsible for
|
||||
ensuring that it eventually gets dropped.
|
||||
*/
|
||||
struct fz_glyph_s
|
||||
{
|
||||
fz_storable storable;
|
||||
int x, y, w, h;
|
||||
fz_pixmap *pixmap;
|
||||
size_t size;
|
||||
unsigned char data[1];
|
||||
};
|
||||
|
||||
fz_irect *fz_glyph_bbox_no_ctx(fz_glyph *src, fz_irect *bbox);
|
||||
|
||||
static inline size_t
|
||||
fz_glyph_size(fz_context *ctx, fz_glyph *glyph)
|
||||
{
|
||||
if (glyph == NULL)
|
||||
return 0;
|
||||
return sizeof(fz_glyph) + glyph->size + fz_pixmap_size(ctx, glyph->pixmap);
|
||||
}
|
||||
fz_path *fz_outline_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix ctm);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user