~ubuntu-branches/ubuntu/utopic/gnustep-back/utopic

« back to all changes in this revision

Viewing changes to Source/gsc/GSStreamContext.m

  • Committer: Package Import Robot
  • Author(s): Yavor Doganov
  • Date: 2014-07-07 16:00:20 UTC
  • mfrom: (4.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20140707160020-0ukvke5ml6ibbezv
Tags: 0.24.0-2
* Upload to unstable; should finally fix the piuparts issue once
  mknfonts.tool is binNMUed (Closes: #663388).
* debian/compat: Bump to 9 to get .build-id debugging symbols.
* debian/control.m4 (Build-Depends): Require debhlper >= 9.
  (Description): Mention that the art backend is deprecated.
  (Suggests): Remove fonts-freefont-ttf as -common depends on it.
* debian/control: Regenerate.
* debian/rules (confflags): Define conditionally and pass --host to
  configure only if cross-compiling.

Show diffs side-by-side

added added

removed removed

Lines of Context:
134
134
/* ----------------------------------------------------------------------- */
135
135
/* Color operations */
136
136
/* ----------------------------------------------------------------------- */
137
 
- (void) DPSsetalpha: (float)a
 
137
- (void) DPSsetalpha: (CGFloat)a
138
138
{
139
139
  [super DPSsetalpha: a];
140
140
  /* This needs to be defined base on the the language level, etc. in
143
143
  fprintf(gstream, "GSsetalpha\n");
144
144
}
145
145
 
146
 
- (void) DPSsetcmykcolor: (float)c : (float)m : (float)y : (float)k
 
146
- (void) DPSsetcmykcolor: (CGFloat)c : (CGFloat)m : (CGFloat)y : (CGFloat)k
147
147
{
148
148
  [super DPSsetcmykcolor: c : m : y : k];
149
149
  fpfloat(gstream, c);
153
153
  fprintf(gstream, "setcmykcolor\n");
154
154
}
155
155
 
156
 
- (void) DPSsetgray: (float)gray
 
156
- (void) DPSsetgray: (CGFloat)gray
157
157
{
158
158
  [super DPSsetgray: gray];
159
159
  fpfloat(gstream, gray);
160
160
  fprintf(gstream, "setgray\n");
161
161
}
162
162
 
163
 
- (void) DPSsethsbcolor: (float)h : (float)s : (float)b
 
163
- (void) DPSsethsbcolor: (CGFloat)h : (CGFloat)s : (CGFloat)b
164
164
{
165
165
  [super DPSsethsbcolor: h : s : b];
166
166
  fpfloat(gstream, h);
169
169
  fprintf(gstream, "sethsbcolor\n");
170
170
}
171
171
 
172
 
- (void) DPSsetrgbcolor: (float)r : (float)g : (float)b
 
172
- (void) DPSsetrgbcolor: (CGFloat)r : (CGFloat)g : (CGFloat)b
173
173
{
174
174
  [super DPSsetrgbcolor: r : g : b];
175
175
  fpfloat(gstream, r);
196
196
/* ----------------------------------------------------------------------- */
197
197
/* Text operations */
198
198
/* ----------------------------------------------------------------------- */
199
 
- (void) DPSashow: (float)x : (float)y : (const char*)s
 
199
- (void) DPSashow: (CGFloat)x : (CGFloat)y : (const char*)s
200
200
{
201
201
  fpfloat(gstream, x);
202
202
  fpfloat(gstream, y);
205
205
  fprintf(gstream, ") ashow\n");
206
206
}
207
207
 
208
 
- (void) DPSawidthshow: (float)cx : (float)cy : (int)c : (float)ax : (float)ay : (const char*)s
 
208
- (void) DPSawidthshow: (CGFloat)cx : (CGFloat)cy : (int)c : (CGFloat)ax : (CGFloat)ay : (const char*)s
209
209
{
210
210
  fpfloat(gstream, cx);
211
211
  fpfloat(gstream, cy);
231
231
  fprintf(gstream, ") show\n");
232
232
}
233
233
 
234
 
- (void) DPSwidthshow: (float)x : (float)y : (int)c : (const char*)s
 
234
- (void) DPSwidthshow: (CGFloat)x : (CGFloat)y : (int)c : (const char*)s
235
235
{
236
236
  fpfloat(gstream, x);
237
237
  fpfloat(gstream, y);
240
240
  fprintf(gstream, ") widthshow\n");
241
241
}
242
242
 
243
 
- (void) DPSxshow: (const char*)s : (const float*)numarray : (int)size
244
 
{
245
 
  [self notImplemented: _cmd];
246
 
}
247
 
 
248
 
- (void) DPSxyshow: (const char*)s : (const float*)numarray : (int)size
249
 
{
250
 
  [self notImplemented: _cmd];
251
 
}
252
 
 
253
 
- (void) DPSyshow: (const char*)s : (const float*)numarray : (int)size
254
 
{
255
 
  [self notImplemented: _cmd];
256
 
}
257
 
 
258
 
 
259
 
- (void) GSSetCharacterSpacing: (float)extra
 
243
- (void) DPSxshow: (const char*)s : (const CGFloat*)numarray : (int)size
 
244
{
 
245
  [self notImplemented: _cmd];
 
246
}
 
247
 
 
248
- (void) DPSxyshow: (const char*)s : (const CGFloat*)numarray : (int)size
 
249
{
 
250
  [self notImplemented: _cmd];
 
251
}
 
252
 
 
253
- (void) DPSyshow: (const char*)s : (const CGFloat*)numarray : (int)size
 
254
{
 
255
  [self notImplemented: _cmd];
 
256
}
 
257
 
 
258
 
 
259
- (void) GSSetCharacterSpacing: (CGFloat)extra
260
260
{
261
261
  [self notImplemented: _cmd];
262
262
}
278
278
  [super GSSetFont: fontref];
279
279
}
280
280
 
281
 
- (void) GSSetFontSize: (float)size
 
281
- (void) GSSetFontSize: (CGFloat)size
282
282
{
283
283
  [self notImplemented: _cmd];
284
284
}
319
319
    }
320
320
}
321
321
 
 
322
- (void) GSShowGlyphsWithAdvances: (const NSGlyph *)glyphs
 
323
                                 : (const NSSize *)advances
 
324
                                 : (size_t)length
 
325
{
 
326
  // FIXME: Currently advances is ignored
 
327
  [self GSShowGlyphs: glyphs : length];
 
328
}
 
329
 
322
330
 
323
331
/* ----------------------------------------------------------------------- */
324
332
/* Gstate Handling */
371
379
/* ----------------------------------------------------------------------- */
372
380
/* Gstate operations */
373
381
/* ----------------------------------------------------------------------- */
374
 
- (void) DPSsetdash: (const float*)pat : (int)size : (float)offset
 
382
- (void) DPSsetdash: (const CGFloat*)pat : (NSInteger)size : (CGFloat)offset
375
383
{
376
384
  int i;
377
385
  fprintf(gstream, "[");
382
390
  fprintf(gstream, "setdash\n");
383
391
}
384
392
 
385
 
- (void) DPSsetflat: (float)flatness
 
393
- (void) DPSsetflat: (CGFloat)flatness
386
394
{
387
395
  [super DPSsetflat: flatness];
388
396
  fpfloat(gstream, flatness);
389
397
  fprintf(gstream, "setflat\n");
390
398
}
391
399
 
392
 
- (void) DPSsethalftonephase: (float)x : (float)y
 
400
- (void) DPSsethalftonephase: (CGFloat)x : (CGFloat)y
393
401
{
394
402
  [super DPSsethalftonephase: x : y];
395
403
  fpfloat(gstream, x);
409
417
  fprintf(gstream, "%d setlinejoin\n", linejoin);
410
418
}
411
419
 
412
 
- (void) DPSsetlinewidth: (float)width
 
420
- (void) DPSsetlinewidth: (CGFloat)width
413
421
{
414
422
  [super DPSsetlinewidth: width];
415
423
  fpfloat(gstream, width);
416
424
  fprintf(gstream, "setlinewidth\n");
417
425
}
418
426
 
419
 
- (void) DPSsetmiterlimit: (float)limit
 
427
- (void) DPSsetmiterlimit: (CGFloat)limit
420
428
{
421
429
  [super DPSsetmiterlimit: limit];
422
430
  fpfloat(gstream, limit);
433
441
/* ----------------------------------------------------------------------- */
434
442
/* Matrix operations */
435
443
/* ----------------------------------------------------------------------- */
436
 
- (void) DPSconcat: (const float*)m
 
444
- (void) DPSconcat: (const CGFloat*)m
437
445
{
438
446
  [super DPSconcat: m];
439
447
 
466
474
  fprintf(gstream, "initmatrix\n");
467
475
}
468
476
 
469
 
- (void) DPSrotate: (float)angle
 
477
- (void) DPSrotate: (CGFloat)angle
470
478
{
471
479
  [super DPSrotate: angle];
472
480
  fpfloat(gstream, angle);
473
481
  fprintf(gstream, "rotate\n");
474
482
}
475
483
 
476
 
- (void) DPSscale: (float)x : (float)y
 
484
- (void) DPSscale: (CGFloat)x : (CGFloat)y
477
485
{
478
486
  [super DPSscale: x : y];
479
487
  fpfloat(gstream, x);
481
489
  fprintf(gstream, "scale\n");
482
490
}
483
491
 
484
 
- (void) DPStranslate: (float)x : (float)y
 
492
- (void) DPStranslate: (CGFloat)x : (CGFloat)y
485
493
{
486
494
  [super DPStranslate: x : y];
487
495
  fpfloat(gstream, x);
521
529
/* ----------------------------------------------------------------------- */
522
530
/* Paint operations */
523
531
/* ----------------------------------------------------------------------- */
524
 
- (void) DPSarc: (float)x : (float)y : (float)r : (float)angle1 : (float)angle2
 
532
- (void) DPSarc: (CGFloat)x : (CGFloat)y : (CGFloat)r : (CGFloat)angle1 : (CGFloat)angle2
525
533
{
526
534
  fpfloat(gstream, x);
527
535
  fpfloat(gstream, y);
531
539
  fprintf(gstream, "arc\n");
532
540
}
533
541
 
534
 
- (void) DPSarcn: (float)x : (float)y : (float)r : (float)angle1 : (float)angle2
 
542
- (void) DPSarcn: (CGFloat)x : (CGFloat)y : (CGFloat)r : (CGFloat)angle1 : (CGFloat)angle2
535
543
{
536
544
  fpfloat(gstream, x);
537
545
  fpfloat(gstream, y);
541
549
  fprintf(gstream, "arcn\n");
542
550
}
543
551
 
544
 
- (void) DPSarct: (float)x1 : (float)y1 : (float)x2 : (float)y2 : (float)r
 
552
- (void) DPSarct: (CGFloat)x1 : (CGFloat)y1 : (CGFloat)x2 : (CGFloat)y2 : (CGFloat)r
545
553
{
546
554
  fpfloat(gstream, x1);
547
555
  fpfloat(gstream, y1);
561
569
  fprintf(gstream, "closepath\n");
562
570
}
563
571
 
564
 
- (void)DPScurveto: (float)x1 : (float)y1 : (float)x2 : (float)y2 
565
 
                  : (float)x3 : (float)y3
 
572
- (void)DPScurveto: (CGFloat)x1 : (CGFloat)y1 : (CGFloat)x2 : (CGFloat)y2 
 
573
                  : (CGFloat)x3 : (CGFloat)y3
566
574
{
567
575
  fpfloat(gstream, x1);
568
576
  fpfloat(gstream, y1);
598
606
  fprintf(gstream, "initclip\n");
599
607
}
600
608
 
601
 
- (void) DPSlineto: (float)x : (float)y
 
609
- (void) DPSlineto: (CGFloat)x : (CGFloat)y
602
610
{
603
611
  fpfloat(gstream, x);
604
612
  fpfloat(gstream, y);
605
613
  fprintf(gstream, "lineto\n");
606
614
}
607
615
 
608
 
- (void) DPSmoveto: (float)x : (float)y
 
616
- (void) DPSmoveto: (CGFloat)x : (CGFloat)y
609
617
{
610
618
  fpfloat(gstream, x);
611
619
  fpfloat(gstream, y);
617
625
  fprintf(gstream, "newpath\n");
618
626
}
619
627
 
620
 
- (void) DPSpathbbox: (float*)llx : (float*)lly : (float*)urx : (float*)ury
 
628
- (void) DPSpathbbox: (CGFloat*)llx : (CGFloat*)lly : (CGFloat*)urx : (CGFloat*)ury
621
629
{
622
630
}
623
631
 
624
 
- (void) DPSrcurveto: (float)x1 : (float)y1 : (float)x2 : (float)y2 
625
 
                    : (float)x3 : (float)y3
 
632
- (void) DPSrcurveto: (CGFloat)x1 : (CGFloat)y1 : (CGFloat)x2 : (CGFloat)y2 
 
633
                    : (CGFloat)x3 : (CGFloat)y3
626
634
{
627
635
  fpfloat(gstream, x1);
628
636
  fpfloat(gstream, y1);
633
641
  fprintf(gstream, "rcurveto\n");
634
642
}
635
643
 
636
 
- (void) DPSrectclip: (float)x : (float)y : (float)w : (float)h
 
644
- (void) DPSrectclip: (CGFloat)x : (CGFloat)y : (CGFloat)w : (CGFloat)h
637
645
{
638
646
  fpfloat(gstream, x);
639
647
  fpfloat(gstream, y);
642
650
  fprintf(gstream, "rectclip\n");
643
651
}
644
652
 
645
 
- (void) DPSrectfill: (float)x : (float)y : (float)w : (float)h
 
653
- (void) DPSrectfill: (CGFloat)x : (CGFloat)y : (CGFloat)w : (CGFloat)h
646
654
{
647
655
  fpfloat(gstream, x);
648
656
  fpfloat(gstream, y);
651
659
  fprintf(gstream, "rectfill\n");
652
660
}
653
661
 
654
 
- (void) DPSrectstroke: (float)x : (float)y : (float)w : (float)h
 
662
- (void) DPSrectstroke: (CGFloat)x : (CGFloat)y : (CGFloat)w : (CGFloat)h
655
663
{
656
664
  fpfloat(gstream, x);
657
665
  fpfloat(gstream, y);
665
673
  fprintf(gstream, "reversepath\n");
666
674
}
667
675
 
668
 
- (void) DPSrlineto: (float)x : (float)y
 
676
- (void) DPSrlineto: (CGFloat)x : (CGFloat)y
669
677
{
670
678
  fpfloat(gstream, x);
671
679
  fpfloat(gstream, y);
672
680
  fprintf(gstream, "rlineto\n");
673
681
}
674
682
 
675
 
- (void) DPSrmoveto: (float)x : (float)y
 
683
- (void) DPSrmoveto: (CGFloat)x : (CGFloat)y
676
684
{
677
685
  fpfloat(gstream, x);
678
686
  fpfloat(gstream, y);
688
696
{
689
697
  NSBezierPathElement type;
690
698
  NSPoint pts[3];
691
 
  int i, count = 10;
692
 
  float pattern[10];
693
 
  float phase = 0.0;
 
699
  NSInteger i, count = 10;
 
700
  CGFloat pattern[10];
 
701
  CGFloat phase = 0.0;
694
702
 
695
703
  [self DPSnewpath];
696
704
  [self DPSsetlinewidth: [path lineWidth]];
728
736
    }
729
737
}
730
738
 
731
 
- (void) GSRectClipList: (const NSRect *)rects: (int)count
 
739
- (void) GSRectClipList: (const NSRect *)rects : (int)count
732
740
{
733
741
  int i;
734
742
  NSRect union_rect;
749
757
          : NSWidth(union_rect) : NSHeight(union_rect)];
750
758
}
751
759
 
752
 
- (void) GSRectFillList: (const NSRect *)rects: (int)count
 
760
- (void) GSRectFillList: (const NSRect *)rects : (int)count
753
761
{
754
762
  int i;
755
763
  for (i = 0; i < count; i++)
784
792
/*-------------------------------------------------------------------------*/
785
793
/* Graphics Extensions Ops */
786
794
/*-------------------------------------------------------------------------*/
787
 
- (void) DPScomposite: (float)x : (float)y : (float)w : (float)h 
788
 
                     : (int)gstateNum : (float)dx : (float)dy : (int)op
 
795
- (void) DPScomposite: (CGFloat)x : (CGFloat)y : (CGFloat)w : (CGFloat)h 
 
796
                     : (NSInteger)gstateNum : (CGFloat)dx : (CGFloat)dy : (NSCompositingOperation)op
789
797
{
790
798
  fpfloat(gstream, x);
791
799
  fpfloat(gstream, y);
792
800
  fpfloat(gstream, w);
793
801
  fpfloat(gstream, h);
794
 
  fprintf(gstream, "%d ", gstateNum);
 
802
  fprintf(gstream, "%d ", (int)gstateNum);
795
803
  fpfloat(gstream, dx);
796
804
  fpfloat(gstream, dy);
797
 
 fprintf(gstream, "%d composite\n", op);
 
805
  fprintf(gstream, "%d composite\n", (int)op);
798
806
}
799
807
 
800
 
- (void) DPScompositerect: (float)x : (float)y : (float)w : (float)h : (int)op
 
808
- (void) DPScompositerect: (CGFloat)x : (CGFloat)y : (CGFloat)w : (CGFloat)h : (NSCompositingOperation)op
801
809
{
802
810
  fpfloat(gstream, x);
803
811
  fpfloat(gstream, y);
804
812
  fpfloat(gstream, w);
805
813
  fpfloat(gstream, h);
806
 
  fprintf(gstream, "%d compositerect\n", op);
 
814
  fprintf(gstream, "%d compositerect\n", (int)op);
807
815
}
808
816
 
809
 
- (void) DPSdissolve: (float)x : (float)y : (float)w : (float)h 
810
 
                    : (int)gstateNum : (float)dx : (float)dy : (float)delta
 
817
- (void) DPSdissolve: (CGFloat)x : (CGFloat)y : (CGFloat)w : (CGFloat)h 
 
818
                    : (NSInteger)gstateNum : (CGFloat)dx : (CGFloat)dy : (CGFloat)delta
811
819
{
812
820
  NSLog(@"DPSinvalidcontext: dissolve in a stream context");
813
821
}
814
822
 
815
 
- (void) GScomposite: (int)gstateNum
 
823
- (void) GScomposite: (NSInteger)gstateNum
816
824
             toPoint: (NSPoint)aPoint
817
825
            fromRect: (NSRect)srcRect
818
826
           operation: (NSCompositingOperation)op
819
 
            fraction: (float)delta
 
827
            fraction: (CGFloat)delta
820
828
{
821
829
 [self DPScomposite: NSMinX(srcRect) : NSMinY(srcRect) : NSWidth(srcRect) : NSHeight(srcRect) 
822
830
                   : gstateNum : aPoint.x : aPoint.y : op];
880
888
 
881
889
@implementation GSStreamContext (Graphics)
882
890
 
883
 
- (void) NSDrawBitmap: (NSRect)rect : (int)pixelsWide : (int)pixelsHigh
884
 
                     : (int)bitsPerSample : (int)samplesPerPixel 
885
 
                     : (int)bitsPerPixel : (int)bytesPerRow : (BOOL)isPlanar
 
891
- (void) NSDrawBitmap: (NSRect)rect : (NSInteger)pixelsWide : (NSInteger)pixelsHigh
 
892
                     : (NSInteger)bitsPerSample : (NSInteger)samplesPerPixel 
 
893
                     : (NSInteger)bitsPerPixel : (NSInteger)bytesPerRow : (BOOL)isPlanar
886
894
                     : (BOOL)hasAlpha : (NSString *)colorSpaceName
887
895
                     : (const unsigned char *const [5])data
888
896
{
889
 
  int bytes, spp;
890
 
  float y;
 
897
  NSInteger bytes, spp;
 
898
  CGFloat y;
891
899
  BOOL flipped = NO;
892
900
 
893
901
  /* In a flipped view, we don't want to flip the image again, which would
913
921
    (bitsPerSample * pixelsWide * pixelsHigh + 7) / 8;
914
922
  if (bytes * samplesPerPixel != bytesPerRow * pixelsHigh) 
915
923
    {
916
 
      NSLog(@"Image Rendering Error: Dodgy bytesPerRow value %d", bytesPerRow);
 
924
      NSLog(@"Image Rendering Error: Dodgy bytesPerRow value %d", (int)bytesPerRow);
917
925
      NSLog(@"   pixelsHigh=%d, bytes=%d, samplesPerPixel=%d",
918
 
            bytesPerRow, pixelsHigh, bytes);
 
926
            (int)bytesPerRow, (int)pixelsHigh, (int)bytes);
919
927
      return;
920
928
    }
921
929
  if (hasAlpha)
934
942
            }
935
943
        }
936
944
      fprintf(gstream, "%d %d %d [%d 0 0 %d 0 %d]\n",
937
 
              pixelsWide, pixelsHigh, bitsPerSample, pixelsWide,
938
 
              (flipped) ? pixelsHigh : -pixelsHigh, pixelsHigh);
 
945
              (int)pixelsWide, (int)pixelsHigh, (int)bitsPerSample, (int)pixelsWide,
 
946
              (flipped) ? (int)pixelsHigh : (int)-pixelsHigh, (int)pixelsHigh);
939
947
      fprintf(gstream, "{currentfile %d string readhexstring pop}\n",
940
 
              pixelsWide * spp);
941
 
      fprintf(gstream, "false %d colorimage\n", spp);
 
948
              (int)(pixelsWide * spp));
 
949
      fprintf(gstream, "false %d colorimage\n", (int)spp);
942
950
    } 
943
951
  else
944
952
    {
945
953
      fprintf(gstream, "%d %d %d [%d 0 0 %d 0 %d]\n",
946
 
              pixelsWide, pixelsHigh, bitsPerSample, pixelsWide,
947
 
              (flipped) ? pixelsHigh : -pixelsHigh, pixelsHigh);
 
954
              (int)pixelsWide, (int)pixelsHigh, (int)bitsPerSample, (int)pixelsWide,
 
955
              (flipped) ? (int)pixelsHigh : (int)-pixelsHigh, (int)pixelsHigh);
948
956
      fprintf(gstream, "currentfile image\n");
949
957
    }
950
958