diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2010-08-05 04:01:01 +0000 |
|---|---|---|
| committer | Krzysztof KosiĆski <tweenk.pl@gmail.com> | 2010-08-05 04:01:01 +0000 |
| commit | 13e643c744ca21ea6f5a50d404bec8aac886a808 (patch) | |
| tree | 94f0ad849ad7f2ad60fb442848a46f31a89fe1a0 /src/libnrtype | |
| parent | Fix mask rendering to use luminance-to-alpha (diff) | |
| download | inkscape-13e643c744ca21ea6f5a50d404bec8aac886a808.tar.gz inkscape-13e643c744ca21ea6f5a50d404bec8aac886a808.zip | |
Wholesale cruft removal part 5; completely remove RasterFont
(bzr r9508.1.50)
Diffstat (limited to 'src/libnrtype')
| -rw-r--r-- | src/libnrtype/FontInstance.cpp | 76 | ||||
| -rw-r--r-- | src/libnrtype/Makefile_insert | 4 | ||||
| -rw-r--r-- | src/libnrtype/RasterFont.cpp | 435 | ||||
| -rw-r--r-- | src/libnrtype/RasterFont.h | 66 | ||||
| -rw-r--r-- | src/libnrtype/font-instance.h | 12 | ||||
| -rw-r--r-- | src/libnrtype/font-lister.cpp | 3 | ||||
| -rw-r--r-- | src/libnrtype/nrtype-forward.h | 3 | ||||
| -rw-r--r-- | src/libnrtype/raster-glyph.h | 49 | ||||
| -rw-r--r-- | src/libnrtype/raster-position.h | 46 |
9 files changed, 0 insertions, 694 deletions
diff --git a/src/libnrtype/FontInstance.cpp b/src/libnrtype/FontInstance.cpp index bdf700346..a41f7d370 100644 --- a/src/libnrtype/FontInstance.cpp +++ b/src/libnrtype/FontInstance.cpp @@ -24,7 +24,6 @@ #include "libnr/nr-rect.h" #include "libnrtype/font-glyph.h" #include "libnrtype/font-instance.h" -#include "libnrtype/RasterFont.h" #include "livarot/Path.h" #include "util/unordered-containers.h" @@ -44,8 +43,6 @@ struct font_style_equal : public std::binary_function<font_style, font_style, bo bool operator()(font_style const &a, font_style const &b) const; }; -typedef INK_UNORDERED_MAP<font_style, raster_font*, font_style_hash, font_style_equal> StyleMap; - static const double STROKE_WIDTH_THREASHOLD = 0.01; @@ -182,7 +179,6 @@ font_instance::font_instance(void) : nbGlyph(0), maxGlyph(0), glyphs(0), - loadedPtr(new StyleMap()), theFace(0) { //printf("font instance born\n"); @@ -190,12 +186,6 @@ font_instance::font_instance(void) : font_instance::~font_instance(void) { - if ( loadedPtr ) { - StyleMap* tmp = static_cast<StyleMap*>(loadedPtr); - delete tmp; - loadedPtr = 0; - } - if ( daddy ) { daddy->UnrefFace(this); daddy = 0; @@ -793,72 +783,6 @@ double font_instance::Advance(int glyph_id,bool vertical) return 0; } - -raster_font* font_instance::RasterFont(const Geom::Matrix &trs, double stroke_width, bool vertical, JoinType stroke_join, ButtType stroke_cap, float /*miter_limit*/) -{ - font_style nStyle; - nStyle.transform=trs; - nStyle.vertical=vertical; - nStyle.stroke_width=stroke_width; - nStyle.stroke_cap=stroke_cap; - nStyle.stroke_join=stroke_join; - nStyle.nbDash=0; - nStyle.dash_offset=0; - nStyle.dashes=NULL; - return RasterFont(nStyle); -} - -raster_font* font_instance::RasterFont(const font_style &inStyle) -{ - raster_font *res=NULL; - double *savDashes=NULL; - font_style nStyle=inStyle; - // for some evil reason font_style doesn't have a copy ctor, so the - // stuff that should be done there is done here instead (because the - // raster_font ctor copies nStyle). - if ( (nStyle.stroke_width > 0) && (nStyle.nbDash > 0) && nStyle.dashes ) { - savDashes=nStyle.dashes; - nStyle.dashes=(double*)malloc(nStyle.nbDash*sizeof(double)); - memcpy(nStyle.dashes,savDashes,nStyle.nbDash*sizeof(double)); - } - StyleMap& loadedStyles = *static_cast<StyleMap*>(loadedPtr); - if ( loadedStyles.find(nStyle) == loadedStyles.end() ) { - raster_font *nR = new raster_font(nStyle); - nR->Ref(); - nR->daddy=this; - loadedStyles[nStyle]=nR; - res=nR; - if ( res ) { - Ref(); - } - } else { - res=loadedStyles[nStyle]; - res->Ref(); - if ( nStyle.dashes ) { - free(nStyle.dashes); // since they're not taken by a new rasterfont - } - } - nStyle.dashes=savDashes; - return res; -} - -void font_instance::RemoveRasterFont(raster_font* who) -{ - if ( who ) { - StyleMap& loadedStyles = *static_cast<StyleMap*>(loadedPtr); - if ( loadedStyles.find(who->style) == loadedStyles.end() ) { - //g_print("RemoveRasterFont failed \n"); - // not found - } else { - loadedStyles.erase(loadedStyles.find(who->style)); - //g_print("RemoveRasterFont\n"); - Unref(); - } - } -} - - - /* Local Variables: mode:c++ diff --git a/src/libnrtype/Makefile_insert b/src/libnrtype/Makefile_insert index 8f45dc94d..7cd99e1a8 100644 --- a/src/libnrtype/Makefile_insert +++ b/src/libnrtype/Makefile_insert @@ -20,10 +20,6 @@ ink_common_sources += \ libnrtype/one-box.h \ libnrtype/one-glyph.h \ libnrtype/one-para.h \ - libnrtype/RasterFont.cpp \ - libnrtype/RasterFont.h \ - libnrtype/raster-glyph.h \ - libnrtype/raster-position.h \ libnrtype/text-boundary.h \ libnrtype/TextWrapper.cpp \ libnrtype/TextWrapper.h \ diff --git a/src/libnrtype/RasterFont.cpp b/src/libnrtype/RasterFont.cpp deleted file mode 100644 index 14f6c7afa..000000000 --- a/src/libnrtype/RasterFont.cpp +++ /dev/null @@ -1,435 +0,0 @@ -/* - * RasterFont.cpp - * testICU - * - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif -#include "RasterFont.h" - -#include <livarot/float-line.h> -#include <livarot/int-line.h> -#include <livarot/Path.h> -#include <livarot/Shape.h> -#include <libnr/nr-pixblock.h> -#include <libnrtype/font-instance.h> -#include <libnrtype/raster-glyph.h> -#include <libnrtype/raster-position.h> - - -static void glyph_run_A8_OR (raster_info &dest,void */*data*/,int st,float vst,int en,float ven); - -void font_style::Apply(Path* src,Shape* dest) { - src->Convert(1); - if ( stroke_width > 0 ) { - if ( nbDash > 0 ) { - double dlen = 0.0; - const float scale = 1/*Geom::expansion(transform)*/; - for (int i = 0; i < nbDash; i++) dlen += dashes[i] * scale; - if (dlen >= 0.01) { - float sc_offset = dash_offset * scale; - float *tdashs=(float*)malloc((nbDash+1)*sizeof(float)); - while ( sc_offset >= dlen ) sc_offset-=dlen; - tdashs[0]=dashes[0] * scale; - for (int i=1;i<nbDash;i++) tdashs[i] = tdashs[i - 1] + dashes[i] * scale; - src->DashPolyline(0.0,0.0,dlen,nbDash,tdashs,true,sc_offset); - free(tdashs); - } - } - src->Stroke(dest, false, 0.5*stroke_width, stroke_join, stroke_cap, 0.5*stroke_width*stroke_miter_limit); - } else { - src->Fill(dest,0); - } -} - -raster_font::raster_font(font_style const &fstyle) : - daddy(NULL), - refCount(0), - style(fstyle), - glyph_id_to_raster_glyph_no(), - nbBase(0), - maxBase(0), - bases(NULL) -{ - // printf("raster font born\n"); -} - -raster_font::~raster_font(void) -{ -// printf("raster font death\n"); - if ( daddy ) daddy->RemoveRasterFont(this); - daddy=NULL; - if ( style.dashes ) free(style.dashes); - style.dashes=NULL; - for (int i=0;i<nbBase;i++) delete bases[i]; - if ( bases ) free(bases); -} - -void raster_font::Unref(void) -{ - refCount--; -// printf("raster %x unref'd %i\n",this,refCount); - if ( refCount <= 0 ) { - if ( daddy ) daddy->RemoveRasterFont(this); - daddy=NULL; - delete this; - } -} -void raster_font::Ref(void) -{ - refCount++; -// printf("raster %x ref'd %i\n",this,refCount); -} -raster_glyph* raster_font::GetGlyph(int glyph_id) -{ - raster_glyph *res=NULL; - if ( glyph_id_to_raster_glyph_no.find(glyph_id) == glyph_id_to_raster_glyph_no.end() ) { - LoadRasterGlyph(glyph_id); - if ( glyph_id_to_raster_glyph_no.find(glyph_id) == glyph_id_to_raster_glyph_no.end() ) { // recheck - } else { - res=bases[glyph_id_to_raster_glyph_no[glyph_id]]; - } - } else { - res=bases[glyph_id_to_raster_glyph_no[glyph_id]]; - } - return res; -} -Geom::Point raster_font::Advance(int glyph_id) -{ - if ( daddy == NULL ) return Geom::Point(0,0); - double a=daddy->Advance(glyph_id,style.vertical); - Geom::Point f_a=(style.vertical)?Geom::Point(0,a):Geom::Point(a,0); - return f_a*style.transform; -} -void raster_font::BBox(int glyph_id,NRRect *area) -{ - area->x0=area->y0=area->x1=area->y1=0; - if ( daddy == NULL ) return; - Geom::OptRect res=daddy->BBox(glyph_id); - if (res) { - Geom::Point bmi=res->min(),bma=res->max(); - Geom::Point tlp(bmi[0],bmi[1]),trp(bma[0],bmi[1]),blp(bmi[0],bma[1]),brp(bma[0],bma[1]); - tlp=tlp*style.transform; - trp=trp*style.transform; - blp=blp*style.transform; - brp=brp*style.transform; - *res=Geom::Rect(tlp,trp); - res->expandTo(blp); - res->expandTo(brp); - area->x0=(res->min())[0]; - area->y0=(res->min())[1]; - area->x1=(res->max())[0]; - area->y1=(res->max())[1]; - } else { - nr_rect_d_set_empty(area); - } -} - -void raster_font::LoadRasterGlyph(int glyph_id) -{ - raster_glyph *res=NULL; - if ( glyph_id_to_raster_glyph_no.find(glyph_id) == glyph_id_to_raster_glyph_no.end() ) { - res=new raster_glyph(); - res->daddy=this; - res->glyph_id=glyph_id; - if ( nbBase >= maxBase ) { - maxBase=2*nbBase+1; - bases=(raster_glyph**)realloc(bases,maxBase*sizeof(raster_glyph*)); - } - bases[nbBase]=res; - glyph_id_to_raster_glyph_no[glyph_id]=nbBase; - nbBase++; - } else { - res=bases[glyph_id_to_raster_glyph_no[glyph_id]]; - } - if ( res == NULL ) return; - if ( res->polygon ) return; - if ( res->outline == NULL ) { - if ( daddy == NULL ) return; - Path* outline=daddy->Outline(glyph_id,NULL); - res->outline=new Path; - if ( outline ) { - res->outline->Copy(outline); - } - res->outline->Transform(style.transform); - } - Shape* temp=new Shape; - res->polygon=new Shape; - style.Apply(res->outline,temp); - if ( style.stroke_width > 0 ) { - res->polygon->ConvertToShape(temp,fill_nonZero); - } else { - res->polygon->ConvertToShape(temp,fill_oddEven); - } - delete temp; - - res->SetSubPixelPositionning(4); -} -void raster_font::RemoveRasterGlyph(raster_glyph* who) -{ - if ( who == NULL ) return; - int glyph_id=who->glyph_id; - if ( glyph_id_to_raster_glyph_no.find(glyph_id) == glyph_id_to_raster_glyph_no.end() ) { - int no=glyph_id_to_raster_glyph_no[glyph_id]; - if ( no >= nbBase-1 ) { - } else { - bases[no]=bases[--nbBase]; - glyph_id_to_raster_glyph_no[bases[no]->glyph_id]=no; - } - glyph_id_to_raster_glyph_no.erase(glyph_id_to_raster_glyph_no.find(glyph_id)); - } else { - // not here - } -} - -/*int top,bottom; // baseline is y=0 - int* run_on_line; // array of size (bottom-top+1): run_on_line[i] gives the number of runs on line top+i - int nbRun; - float_ligne_run* runs;*/ - -raster_position::raster_position(void) -{ - top=0; - bottom=-1; - run_on_line=NULL; - nbRun=0; - runs=NULL; -} -raster_position::~raster_position(void) -{ - if ( run_on_line ) free(run_on_line); - if ( runs ) free(runs); -} - -void raster_position::AppendRuns(std::vector<float_ligne_run> const &r,int y) -{ - if ( top > bottom ) { - top=bottom=y; - if ( run_on_line ) free(run_on_line); - run_on_line=(int*)malloc(sizeof(int)); - run_on_line[0]=0; - } else { - if ( y < top ) { - // printf("wtf?\n"); - return; - } else if ( y > bottom ) { - int ob=bottom; - bottom=y; - run_on_line=(int*)realloc(run_on_line,(bottom-top+1)*sizeof(int)); - for (int i=ob+1;i<=bottom;i++) run_on_line[i-top]=0; - } - } - - if ( r.empty() == false) { - run_on_line[y - top] = r.size(); - runs = (float_ligne_run *) realloc(runs, (nbRun + r.size()) * sizeof(float_ligne_run)); - - for (int i = 0; i < int(r.size()); i++) { - runs[nbRun + i] = r[i]; - } - - nbRun += r.size(); - } -} -void raster_position::Blit(float ph,int pv,NRPixBlock &over) -{ - int base_y=top+pv; - int first_y=top+pv,last_y=bottom+pv; - if ( first_y < over.area.y0 ) first_y=over.area.y0; - if ( last_y >= over.area.y1 ) last_y=over.area.y1-1; - if ( first_y > last_y ) return; - IntLigne *theIL=new IntLigne(); - FloatLigne *theI=new FloatLigne(); - - char* mdata=(char*)over.data.px; - if ( over.size == NR_PIXBLOCK_SIZE_TINY ) mdata=(char*)over.data.p; - - for (int y=first_y;y<=last_y;y++) { - int first_r=0,last_r=0; - for (int i=base_y;i<y;i++) first_r+=run_on_line[i-base_y]; - last_r=first_r+run_on_line[y-base_y]-1; - if ( first_r <= last_r ) { - theI->Reset(); - for (int i=first_r;i<=last_r;i++) theI->AddRun(runs[i].st+ph,runs[i].en+ph,runs[i].vst,runs[i].ven,runs[i].pente); -// for (int i=first_r;i<=last_r;i++) {runs[i].st+=ph;runs[i].en+=ph;} -// theI->nbRun=theI->maxRun=last_r-first_r+1; -// theI->runs=runs+first_r; - - theIL->Copy(theI); - raster_info dest; - dest.startPix=over.area.x0; - dest.endPix=over.area.x1; - dest.sth=over.area.x0; - dest.stv=y; - dest.buffer=((uint32_t*)(mdata+(over.rs*(y-over.area.y0)))); - theIL->Raster(dest,NULL,glyph_run_A8_OR); - -// theI->nbRun=theI->maxRun=0; -// theI->runs=NULL; -// for (int i=first_r;i<=last_r;i++) {runs[i].st-=ph;runs[i].en-=ph;} - } - } - delete theIL; - delete theI; -} - - -/* raster_font* daddy; - int glyph_id; - - Path* outline; - Shape* polygon; - - int nb_sub_pixel; - raster_position* sub_pixel;*/ - -raster_glyph::raster_glyph(void) -{ - daddy=NULL; - glyph_id=0; - outline=NULL; - polygon=NULL; - nb_sub_pixel=0; - sub_pixel=NULL; -} -raster_glyph::~raster_glyph(void) -{ - if ( outline ) delete outline; - if ( polygon ) delete polygon; - if ( sub_pixel ) delete [] sub_pixel; -} - - -void raster_glyph::SetSubPixelPositionning(int nb_pos) -{ - nb_sub_pixel=nb_pos; - if ( nb_sub_pixel <= 0 ) nb_sub_pixel=0; - if ( sub_pixel ) delete [] sub_pixel; - sub_pixel=NULL; - if ( nb_sub_pixel > 0 ) { - sub_pixel=new raster_position[nb_pos]; - if ( polygon ) { - for (int i=0;i<nb_sub_pixel;i++) LoadSubPixelPosition(i); - } - } -} -void raster_glyph::LoadSubPixelPosition(int no) -{ - if ( no < 0 || no >= nb_sub_pixel ) return; - if ( sub_pixel[no].top <= sub_pixel[no].bottom ) return; - if ( polygon == NULL ) { - if ( daddy == NULL ) return; - daddy->LoadRasterGlyph(glyph_id); - if ( polygon == NULL ) return; - } - - float sub_delta=((float)no)/((float)nb_sub_pixel); - - polygon->CalcBBox(); - - float l=polygon->leftX,r=polygon->rightX,t=polygon->topY,b=polygon->bottomY; - int il,ir,it,ib; - il=(int)floor(l); - ir=(int)ceil(r); - it=(int)floor(t); - ib=(int)ceil(b); - - // version par FloatLigne - int curPt; - float curY; - polygon->BeginQuickRaster(curY, curPt); - - FloatLigne* theI=new FloatLigne(); - - polygon->DirectQuickScan(curY,curPt,(float)(it-1)+sub_delta,true,1.0); - - for (int y=it-1;y<ib;y++) { - theI->Reset(); - polygon->QuickScan(curY,curPt,((float)(y+1))+sub_delta,theI,1.0); - theI->Flatten(); - - sub_pixel[no].AppendRuns(theI->runs, y); - } - polygon->EndQuickRaster(); - delete theI; -} - -void raster_glyph::Blit(const Geom::Point &at,NRPixBlock &over) -{ - if ( nb_sub_pixel <= 0 ) return; - int pv=(int)ceil(at[1]); - double dec=4*(ceil(at[1])-at[1]); - int no=(int)floor(dec); - sub_pixel[no].Blit(at[0],pv,over); -} - - - -static void -glyph_run_A8_OR (raster_info &dest,void */*data*/,int st,float vst,int en,float ven) -{ - if ( st >= en ) return; - if ( vst < 0 ) vst=0; - if ( vst > 1 ) vst=1; - if ( ven < 0 ) ven=0; - if ( ven > 1 ) ven=1; - float sv=vst; - float dv=ven-vst; - int len=en-st; - unsigned char* d=(unsigned char*)dest.buffer; - d+=(st-dest.startPix); - if ( fabs(dv) < 0.001 ) { - if ( vst > 0.999 ) { - /* Simple copy */ - while (len > 0) { - d[0] = 255; - d += 1; - len -= 1; - } - } else { - sv*=256; - unsigned int c0_24=(int)sv; - c0_24&=0xFF; - while (len > 0) { - unsigned int da; - /* Draw */ - da = 65025 - (255 - c0_24) * (255 - d[0]); - d[0] = (da + 127) / 255; - d += 1; - len -= 1; - } - } - } else { - if ( en <= st+1 ) { - sv=0.5*(vst+ven); - sv*=256; - unsigned int c0_24=(int)sv; - c0_24&=0xFF; - unsigned int da; - /* Draw */ - da = 65025 - (255 - c0_24) * (255 - d[0]); - d[0] = (da + 127) / 255; - } else { - dv/=len; - sv+=0.5*dv; // correction trapezoidale - sv*=16777216; - dv*=16777216; - int c0_24 = static_cast<int>(CLAMP(sv, 0, 16777216)); - int s0_24 = static_cast<int>(dv); - while (len > 0) { - unsigned int ca, da; - /* Draw */ - ca = c0_24 >> 16; - if ( ca > 255 ) ca=255; - da = 65025 - (255 - ca) * (255 - d[0]); - d[0] = (da + 127) / 255; - d += 1; - c0_24 += s0_24; - c0_24 = CLAMP (c0_24, 0, 16777216); - len -= 1; - } - } - } -} diff --git a/src/libnrtype/RasterFont.h b/src/libnrtype/RasterFont.h deleted file mode 100644 index 015121b42..000000000 --- a/src/libnrtype/RasterFont.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * RasterFont.h - * testICU - * - */ - -#ifndef my_raster_font -#define my_raster_font - -#include <map> - -#include <libnr/nr-forward.h> -#include <libnrtype/nrtype-forward.h> -#include <libnrtype/font-style.h> - -// one rasterfont is one way to draw a font on the screen -// the way it's drawn is stored in style -class raster_font { -public: - font_instance* daddy; - int refCount; - - font_style style; - - std::map<int,int> glyph_id_to_raster_glyph_no; - // an array of glyphs in this rasterfont. - // it's a bit redundant with the one in the daddy font_instance, but these glyphs - // contains the real rasterization data - int nbBase,maxBase; - raster_glyph** bases; - - explicit raster_font(font_style const &fstyle); - virtual ~raster_font(void); - - void Unref(void); - void Ref(void); - - // utility functions - Geom::Point Advance(int glyph_id); - void BBox(int glyph_id,NRRect *area); - - // attempts to load a glyph and return a raster_glyph on which you can call Blit - raster_glyph* GetGlyph(int glyph_id); - // utility - void LoadRasterGlyph(int glyph_id); // refreshes outline/polygon if needed - void RemoveRasterGlyph(raster_glyph* who); - -private: - /* Disable the default copy constructor and operator=: they do the wrong thing for refCount. */ - raster_font(raster_font const &); - raster_font &operator=(raster_font const &); -}; - -#endif - - -/* - Local Variables: - mode:c++ - c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) - indent-tabs-mode:nil - fill-column:99 - End: -*/ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : diff --git a/src/libnrtype/font-instance.h b/src/libnrtype/font-instance.h index d52bd723f..e9bd291d2 100644 --- a/src/libnrtype/font-instance.h +++ b/src/libnrtype/font-instance.h @@ -67,15 +67,6 @@ public: // for generating slanted cursors for oblique fonts Geom::OptRect BBox(int glyph_id); - // creates a rasterfont for the given style - raster_font* RasterFont(Geom::Matrix const &trs, double stroke_width, - bool vertical = false, JoinType stroke_join = join_straight, - ButtType stroke_cap = butt_straight, float miter_limit = 4.0); - // the dashes array in iStyle is copied - raster_font* RasterFont(font_style const &iStyle); - // private use: tells the font_instance that the raster_font 'who' has died - void RemoveRasterFont(raster_font *who); - // attribute queries unsigned Name(gchar *str, unsigned size); unsigned PSName(gchar *str, unsigned size); @@ -85,9 +76,6 @@ public: private: void FreeTheFace(); - // hashmap to get the raster_font for a given style - void* loadedPtr; - #ifdef USE_PANGO_WIN32 HFONT theFace; #else diff --git a/src/libnrtype/font-lister.cpp b/src/libnrtype/font-lister.cpp index a7160f5f0..bbed89b55 100644 --- a/src/libnrtype/font-lister.cpp +++ b/src/libnrtype/font-lister.cpp @@ -2,10 +2,7 @@ # include <config.h> #endif -#include <libnr/nr-blit.h> #include <libnrtype/font-instance.h> -#include <libnrtype/raster-glyph.h> -#include <libnrtype/RasterFont.h> #include <libnrtype/TextWrapper.h> #include <libnrtype/one-glyph.h> diff --git a/src/libnrtype/nrtype-forward.h b/src/libnrtype/nrtype-forward.h index f3344f2fd..6050ffa6b 100644 --- a/src/libnrtype/nrtype-forward.h +++ b/src/libnrtype/nrtype-forward.h @@ -5,9 +5,6 @@ class font_factory; struct font_glyph; class font_instance; struct font_style; -class raster_font; -class raster_glyph; -class raster_position; #endif /* !SEEN_LIBNRTYPE_NRTYPE_FORWARD_H */ diff --git a/src/libnrtype/raster-glyph.h b/src/libnrtype/raster-glyph.h deleted file mode 100644 index 82a0b3f8e..000000000 --- a/src/libnrtype/raster-glyph.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef SEEN_LIBNRTYPE_RASTER_GLYPH_H -#define SEEN_LIBNRTYPE_RASTER_GLYPH_H - -#include <libnr/nr-forward.h> -#include <libnrtype/nrtype-forward.h> -#include <livarot/livarot-forward.h> - -// a little utility class that holds data to render a styled glyph -// ie. it's like a polygon. its function is to wrap the subpixel positionning -class raster_glyph { -public: - // raster_font that created me - raster_font* daddy; - // the glyph i am (the style is in daddy) - int glyph_id; - // internal structure: the styled path, and the associated uncrossed polygon - // they could be removed after the raster_position have been computed - Path* outline; // transformed by the matrix in style (may be factorized, but is small) - Shape* polygon; - // subpixel positions - // nb_sub_pixel is set to 4 when the glyph is created (it's hardcoded) - int nb_sub_pixel; - raster_position* sub_pixel; - - raster_glyph(void); - virtual ~raster_glyph(void); - - // utility - void SetSubPixelPositionning(int nb_pos); - void LoadSubPixelPosition(int no); - - // the interesting function: blits the glyph onto over - // over should be a mask, ie a NRPixBlock with one 8bit plane - void Blit(Geom::Point const &at, NRPixBlock &over); // alpha only -}; - - -#endif /* !SEEN_LIBNRTYPE_RASTER_GLYPH_H */ - -/* - Local Variables: - mode:c++ - c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) - indent-tabs-mode:nil - fill-column:99 - End: -*/ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : diff --git a/src/libnrtype/raster-position.h b/src/libnrtype/raster-position.h deleted file mode 100644 index 744b6dddd..000000000 --- a/src/libnrtype/raster-position.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef SEEN_LIBNRTYPE_RASTER_POSITION_H -#define SEEN_LIBNRTYPE_RASTER_POSITION_H - -#include <vector> - -#include <libnr/nr-forward.h> -#include <libnrtype/nrtype-forward.h> -#include <livarot/livarot-forward.h> - -// one subpixel position -// it's basically a set of trapezoids (=float_ligne_run) representing the black areas of the glyph -// all trapezoids are in the same array, hence the run_on_line array to give the number of -// trapezoids on each line -// trapezoids store the x-positions as float, and are shifted to the x blit position -// so it's "exact" in the x direction and subpixel in the y direction -class raster_position { -public: - int top, bottom; // baseline is y=0 - // top is the first pixel, bottom is the last - int* run_on_line; // array of size (bottom-top+1): run_on_line[i] gives the number of runs on line top+i - int nbRun; - float_ligne_run* runs; - -public: - raster_position(); - virtual ~raster_position(); - - // stuff runs into the structure - void AppendRuns(std::vector<float_ligne_run> const &r, int y); - // blits the trapezoids. - void Blit(float ph, int pv, NRPixBlock &over); -}; - - -#endif /* !SEEN_LIBNRTYPE_RASTER_POSITION_H */ - -/* - Local Variables: - mode:c++ - c-file-style:"stroustrup" - c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) - indent-tabs-mode:nil - fill-column:99 - End: -*/ -// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : |
