1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef __com_sun_star_rendering_XCanvas_idl__
#define __com_sun_star_rendering_XCanvas_idl__
#include <com/sun/star/uno/XInterface.idl>
#include <com/sun/star/lang/IllegalArgumentException.idl>
#include <com/sun/star/geometry/RealPoint2D.idl>
#include <com/sun/star/geometry/RealBezierSegment2D.idl>
#include <com/sun/star/geometry/RealRectangle2D.idl>
#include <com/sun/star/geometry/Matrix2D.idl>
#include <com/sun/star/rendering/ViewState.idl>
#include <com/sun/star/rendering/RenderState.idl>
#include <com/sun/star/rendering/FontRequest.idl>
#include <com/sun/star/rendering/FontInfo.idl>
#include <com/sun/star/rendering/Texture.idl>
#include <com/sun/star/rendering/StringContext.idl>
#include <com/sun/star/rendering/StrokeAttributes.idl>
#include <com/sun/star/rendering/VolatileContentDestroyedException.idl>
#include <com/sun/star/beans/PropertyValue.idl>
module com { module sun { module star { module geometry {
interface XMapping2D;
}; }; }; };
module com { module sun { module star { module rendering {
interface XCanvasFont;
interface XPolyPolygon2D;
interface XCachedPrimitive;
interface XBitmap;
interface XGraphicDevice;
interface XTextLayout;
/** Central interface for rendering.<p>
This is the central interface for graphical output production, and
the place where all draw methods are located.<p>
Some notes are in order to explain the concepts used here. The
XCanvas interface is free of client-modifiable state,
i.e. it can be used safely and without external synchronization in
a multi-threaded environment. On the other hand, this implies that
for nearly every canvas operation, external state is
required. This is provided by ViewState and
RenderState in a unified fashion, supplemented by a
few extra state parameters for some methods (e.g. textured
polygons or text rendering).<p>
When used careless, this scheme can be inefficient to some extend,
because internally, view, render and other states have to be
combined before rendering. This is especially expensive for
complex clip polygons, i.e. when both ViewState and
RenderState have a complex clip polygon set, which
have to be intersected before rendering. It is therefore
recommended to combine ViewState and
RenderState already at the client side, when objects
are organized in a hierarchical way: the classic example are
grouped draw shapes, whose parent group object imposes a
common clipping and a common transformation on its siblings. The
group object would therefore merge the ViewState and
the RenderState it is called with into a new
ViewState, and call its siblings with a
RenderState containing only the local offset (and no
extra clipping).<p>
Further on, this stateless nature provides easy ways for
caching. Every non-trivial operation on XCanvas can
return a cache object, which, when called to redraw, renders the
primitive usually much more quickly than the original method. Note
that such caching is a lot more complicated, should the actual
rendering a method yields depend on internal state (which is the
case e.g. for the
::com::sun::star::awt::XGraphics
interface). Please note, though, that deciding whether to return
an XCachedPrimitive is completely up to the
implementation - don't rely on the methods returning something
(this is because there might be cases when returning such a cache
object will actually be a pessimization, since it involves memory
allocation and comparisons).<p>
Things that need more than a small, fixed amount of data are
encapsulated in own interfaces, e.g. polygons and bitmaps. You
can, in principle, roll your own implementations of these
interfaces, wrap it around your internal representation of
polygons and bitmaps, and render them. It might just not be overly
fast, because the XCanvas would need to convert for
each render call. It is therefore recommended to create such
objects via the XGraphicDevice factory (to be
retrieved from every canvas object via the
getDevice() call) - they will then internally
optimize to the underlying graphics subsystem.<p>
@since OOo 2.0
*/
interface XCanvas : ::com::sun::star::uno::XInterface
{
/** Clear the whole canvas area.<p>
This method clears the whole canvas area to the device default
color (e.g. white for a printer, transparent for an
XCustomSprite).
*/
void clear();
/** Draw a point in device resolution on the device.
@param aPoint
The point to draw.
@param aViewState
The view state to be used when drawing this point.
@param aRenderState
The render state to be used when drawing this point.
@throws com::sun::star::lang::IllegalArgumentException
if one of the view and render state parameters are outside the
specified range.
*/
void drawPoint( [in] ::com::sun::star::geometry::RealPoint2D aPoint, [in] ViewState aViewState, [in] RenderState aRenderState )
raises (com::sun::star::lang::IllegalArgumentException);
/** Draw a line in device resolution width (i.e. one device pixel
wide).
@param aStartPoint
The start point of the line to draw.
@param aEndPoint
The end point of the line to draw.
@param aViewState
The view state to be used when drawing this line.
@param aRenderState
The render state to be used when drawing this line.
@throws com::sun::star::lang::IllegalArgumentException
if one of the view and render state parameters are outside the
specified range.
*/
void drawLine( [in] ::com::sun::star::geometry::RealPoint2D aStartPoint, [in] ::com::sun::star::geometry::RealPoint2D aEndPoint, [in] ViewState aViewState, [in] RenderState aRenderState )
raises (com::sun::star::lang::IllegalArgumentException);
/** Draw a cubic Bezier curve in device resolution width (i.e. one
device pixel wide).
@param aBezierSegment
The start and the two control points of the Bezier curve.
@param aEndPoint
The end point of the Bezier curve.
@param aViewState
The view state to be used when drawing this curve.
@param aRenderState
The render state to be used when drawing this curve.
@throws com::sun::star::lang::IllegalArgumentException
if one of the view and render state parameters are outside the
specified range.
*/
void drawBezier( [in] ::com::sun::star::geometry::RealBezierSegment2D aBezierSegment, [in] ::com::sun::star::geometry::RealPoint2D aEndPoint, [in] ViewState aViewState, [in] RenderState aRenderState )
raises (com::sun::star::lang::IllegalArgumentException);
/** Draw a poly-polygon in device resolution line width (i.e. the
lines are one device pixel wide).
@param xPolyPolygon
The poly-polygon to draw.
@param aViewState
The view state to be used when drawing this polygon.
@param aRenderState
The render state to be used when drawing this polygon.
@return a handle to the cached rendering output.
@throws com::sun::star::lang::IllegalArgumentException
if one of the view and render state parameters are outside the
specified range.
*/
XCachedPrimitive drawPolyPolygon( [in] XPolyPolygon2D xPolyPolygon, [in] ViewState aViewState, [in] RenderState aRenderState )
raises (com::sun::star::lang::IllegalArgumentException);
/** Stroke each polygon of the provided poly-polygon with the
specified stroke attributes.<p>
This method considers the stroking of all polygons as an
atomic operation in relation to the RenderState's
CompositeOperationy operation. That means,
overlapping strokes from distinct polygons will look exactly
as overlapping segments of the same polygon, even with
transparency.<p>
@param xPolyPolygon
The poly-polygon to render.
@param aViewState
The view state to be used when stroking this polygon.
@param aRenderState
The render state to be used when stroking this polygon.
@param aStrokeAttributes
Further attributes used to parameterize the stroking.
@return a handle to the cached rendering output.
@throws com::sun::star::lang::IllegalArgumentException
if one of the view and render state parameters are outside the
specified range.
*/
XCachedPrimitive strokePolyPolygon( [in] XPolyPolygon2D xPolyPolygon, [in] ViewState aViewState, [in] RenderState aRenderState, [in] StrokeAttributes aStrokeAttributes )
raises (com::sun::star::lang::IllegalArgumentException);
/** Stroke each polygon of the provided poly-polygon with the
specified stroke attributes, fill the stroked outline
with the specified texture graphics.<p>
This method considers the stroking of all polygons as an
atomic operation in relation to the RenderState's
CompositeOp operation. That means, overlapping
strokes from distinct polygons will look exactly as
overlapping segments of the same polygon, even with
transparency.<p>
@param xPolyPolygon
The poly-polygon to render.
@param aViewState
The view state to be used when strokes this polygon.
@param aRenderState
The render state to be used when stroking this polygon.
@param aTextures
A sequence of texture definitions, with which to fill the
stroked area.
@param aStrokeAttributes
Further attributes used to parameterize the stroking.
@return a handle to the cached rendering output.
@throws com::sun::star::lang::IllegalArgumentException
if one of the view and render state parameters are outside the
specified range.
@throws VolatileContentDestroyedException
if a texture bitmap was volatile, and the content was
destroyed before the rendering could take place.
*/
XCachedPrimitive strokeTexturedPolyPolygon( [in] XPolyPolygon2D xPolyPolygon, [in] ViewState aViewState, [in] RenderState aRenderState, [in] sequence<Texture> aTextures, [in] StrokeAttributes aStrokeAttributes )
raises (com::sun::star::lang::IllegalArgumentException,
VolatileContentDestroyedException);
/** Stroke each polygon of the provided poly-polygon with the
specified stroke attributes, fill the stroked outline
with the specified texture graphics, map the texture to the
outline via the specified texture mapping.<p>
This method considers the stroking of all polygons as an
atomic operation in relation to the RenderState's
CompositeOp operation. That means, overlapping
strokes from distinct polygons will look exactly as
overlapping segments of the same polygon, even with
transparency.
@param xPolyPolygon
The poly-polygon to render.
@param aViewState
The view state to be used when stroking this polygon.
@param aRenderState
The render state to be used when stroking this polygon.
@param aTextures
A sequence of texture definitions, with which to fill the
stroked area.
@param xMapping
A bilinear mapping function which defines the warping of the
textures on the output area.
@param aStrokeAttributes
Further attributes used to parameterize the stroking.
@return a handle to the cached rendering output.
@throws com::sun::star::lang::IllegalArgumentException
if one of the view and render state parameters are outside the
specified range.
@throws VolatileContentDestroyedException
if a texture bitmap was volatile, and the content was
destroyed before the rendering could take place.
*/
XCachedPrimitive strokeTextureMappedPolyPolygon( [in] XPolyPolygon2D xPolyPolygon, [in] ViewState aViewState, [in] RenderState aRenderState, [in] sequence<Texture> aTextures, [in] ::com::sun::star::geometry::XMapping2D xMapping, [in] StrokeAttributes aStrokeAttributes )
raises (com::sun::star::lang::IllegalArgumentException,
VolatileContentDestroyedException);
// [TODO: Method misplaced at this interface?]
/** Query the polygonal representation of the stroke outlines, as
it would be generated by the strokePolyPolygon methods.<p>
This method can be used to e.g. set a clipping which covers the same
area as a stroke.<p>
@param xPolyPolygon
The poly-polygon to render.
@param aViewState
The view state to be used when generating the outline.
@param aRenderState
The render state to be used when generating the outline.
@param aStrokeAttributes
Further attributes used to parameterize the stroking.
@return a poly-polygon describing the outline of the stroked
area.
@throws com::sun::star::lang::IllegalArgumentException
if one of the view and render state parameters are outside the
specified range.
*/
XPolyPolygon2D queryStrokeShapes( [in] XPolyPolygon2D xPolyPolygon, [in] ViewState aViewState, [in] RenderState aRenderState, [in] StrokeAttributes aStrokeAttributes )
raises (com::sun::star::lang::IllegalArgumentException);
/** Fill the given poly-polygon.<p>
This method fills the given poly-polygon according to the
RenderState's color and the poly-polygon's fill
rule.<p>
@param xPolyPolygon
The poly-polygon to render.
@param aViewState
The view state to be used when filling this polygon.
@param aRenderState
The render state to be used when filling this polygon.
@return a handle to the cached rendering output.
@throws com::sun::star::lang::IllegalArgumentException
if one of the view and render state parameters are outside the
specified range.
*/
XCachedPrimitive fillPolyPolygon( [in] XPolyPolygon2D xPolyPolygon, [in] ViewState aViewState, [in] RenderState aRenderState )
raises (com::sun::star::lang::IllegalArgumentException);
/** Fill the given poly-polygon with a texture.<p>
This method fills the given poly-polygon according to the
RenderState's color, the given textures and
poly-polygon's fill rule.<p>
@param xPolyPolygon
The poly-polygon to render.
@param aViewState
The view state to be used when filling this polygon.
@param aRenderState
The render state to be used when filling this polygon.
@param xTextures
A sequence of texture definitions, with which to fill the
polygonal area.
@return a handle to the cached rendering output.
@throws com::sun::star::lang::IllegalArgumentException
if one of the view and render state parameters are outside the
specified range.
@throws VolatileContentDestroyedException
if a texture bitmap was volatile, and the content was
destroyed before the rendering could take place.
*/
XCachedPrimitive fillTexturedPolyPolygon( [in] XPolyPolygon2D xPolyPolygon, [in] ViewState aViewState, [in] RenderState aRenderState, [in] sequence<Texture> xTextures )
raises (com::sun::star::lang::IllegalArgumentException,
VolatileContentDestroyedException);
/** Fill the given poly-polygon with a mapped texture.<p>
This method fills the given poly-polygon according to the
RenderState's color, the given textures and
poly-polygon's fill rule. The texture is mapped to the
poly-polygon's interior via the given texture mapping.<p>
@param xPolyPolygon
The poly-polygon to render.
@param aViewState
The view state to be used when filling this polygon.
@param aRenderState
The render state to be used when filling this polygon.
@param xTextures
A sequence of texture definitions, with which to fill the
polygonal area.
@param xMapping
A bilinear mapping function which defines the warping of the
textures on the output area.
@return a handle to the cached rendering output.
@throws com::sun::star::lang::IllegalArgumentException
if one of the view and render state parameters are outside the
specified range.
@throws VolatileContentDestroyedException
if a texture bitmap was volatile, and the content was
destroyed before the rendering could take place.
*/
XCachedPrimitive fillTextureMappedPolyPolygon( [in] XPolyPolygon2D xPolyPolygon, [in] ViewState aViewState, [in] RenderState aRenderState, [in] sequence<Texture> xTextures, [in] ::com::sun::star::geometry::XMapping2D xMapping )
raises (com::sun::star::lang::IllegalArgumentException,
VolatileContentDestroyedException);
/** Create a suitable font for the specified font description.
@param aFontRequest
@param aExtraFontProperties
Additional font properties to be applied when selecting this
font. Normally, you should not need this parameter. Currently,
the following property is recognized:
- EmphasisMark: long integer that represents the emphasis mark.
@see ::com::sun::star::awt::FontEmphasisMark
@param aFontMatrix
Font-specific transformation matrix, which affects both the
glyphs as well as the advancement.
@returns the requested font, or an invalid reference, if the
request failed.
@throws com::sun::star::lang::IllegalArgumentException
if one of the parameters is not within the allowed range.
*/
XCanvasFont createFont( [in] FontRequest aFontRequest, [in] sequence< ::com::sun::star::beans::PropertyValue > aExtraFontProperties, [in] ::com::sun::star::geometry::Matrix2D aFontMatrix )
raises (com::sun::star::lang::IllegalArgumentException);
/** Query font information, specific to this canvas.<p>
@param aFilter
Filter parameter to reduce the list of returned fonts. Every
member of FontInfo that is not the empty string
or the "don't care" value restricts the list of returned fonts
to contain only those that have the specified attribute.
@param aFontProperties
This interface can provide additional font properties to
filter the list of available fonts against.
@returns the list of fonts matching the filter set.
@throws com::sun::star::lang::IllegalArgumentException
if one of the font properties are invalid or not recognized,
or if one of the FontInfo members is not within
the permitted range.
*/
sequence< FontInfo > queryAvailableFonts( [in] FontInfo aFilter, [in] sequence< ::com::sun::star::beans::PropertyValue > aFontProperties )
raises (com::sun::star::lang::IllegalArgumentException);
/** Draw the text given by the substring of the specified string
with the given font.<p>
The local origin of this output operation is either the left
end of the text baseline, for textDirection equal
LEFT_TO_RIGHT, or the right end of the baseline, for
textDirection equal to RIGHT_TO_LEFT, respectively.<p>
@param aText
The text to output.
@param xFont
The font retrieved from this canvas to be used when drawing
the text.
@param aViewState
The view state to be used when drawing this text.
@param aRenderState
The render state to be used when drawing this text.
@param nTextDirection
A value from the TextDirection collection,
denoting the main writing direction for this string. The main
writing direction determines the origin of the text output,
i.e. the left edge for left-to-right and the right edge for
right-to-left text.
@return a handle to the cached rendering output.
@throws com::sun::star::lang::IllegalArgumentException
if one of the view and render state parameters are outside the
specified range.
*/
XCachedPrimitive drawText( [in] StringContext aText, [in] XCanvasFont xFont, [in] ViewState aViewState, [in] RenderState aRenderState, [in] byte nTextDirection )
raises (com::sun::star::lang::IllegalArgumentException);
/** Draw the formatted text given by the text layout.<p>
The glyphs as represented by the text layout are always output
with the reference position being the leftmost edge of the
layout object's baseline. If the layout contains more than one
baseline, the baseline of the first strong character in
logical order is used here (strong in this context means that
the character can be unambiguously assigned to a Unicode
script).<p>
@param xLayoutetText
An interface to the readily layouted text, obtained from a
XCanvasFont created at this canvas. The text
layout already carries intrinsic font information.
@param aViewState
The view state to be used when drawing this text.
@param aRenderState
The render state to be used when drawing this text.
@return a handle to the cached rendering output.
@throws com::sun::star::lang::IllegalArgumentException
if one of the view and render state parameters are outside the
specified range.
*/
XCachedPrimitive drawTextLayout( [in] XTextLayout xLayoutetText, [in] ViewState aViewState, [in] RenderState aRenderState )
raises (com::sun::star::lang::IllegalArgumentException);
/** Render the given bitmap.<p>
This method renders the bitmap, at a position and shape as
specified by the combined view and render transformations. For
fast render speed, the bitmap should be created by the
corresponding XGraphicDevice's
XGraphicDevice::createCompatibleBitmap()
method.<p>
@param xBitmap
The bitmap to render.
@param aViewState
The view state to be used when drawing this text.
@param aRenderState
The render state to be used when drawing this text.
@return a handle to the cached rendering output.
@throws com::sun::star::lang::IllegalArgumentException
if one of the view and render state parameters are outside the
specified range.
@throws VolatileContentDestroyedException
if a texture bitmap was volatile, and the content was
destroyed before the rendering could take place.
*/
XCachedPrimitive drawBitmap( [in] XBitmap xBitmap, [in] ViewState aViewState, [in] RenderState aRenderState )
raises (com::sun::star::lang::IllegalArgumentException,
VolatileContentDestroyedException);
/** Render the given bitmap, with a global color modulation.<p>
This method renders the bitmap, at a position and shape as
specified by the combined view and render transformations. For
fast render speed, the bitmap should be created by the
corresponding XGraphicDevice's
XGraphicDevice::createCompatibleBitmap()
method. The bitmap's color channel values are multiplied with
the device color values as specified in the render state.<p>
@param xBitmap
The bitmap to render.
@param aViewState
The view state to be used when drawing this text.
@param aRenderState
The render state to be used when drawing this text. The device
color entry in the render state is multiplied with every pixel
color value, and only the result is rendered into the
canvas. If, for example, the bitmap should be rendered with
increased global transparency, set all device color channels
to 1.0, except for the alpha channel, which should be set to
the desired transparency.
@return a handle to the cached rendering output.
@throws com::sun::star::lang::IllegalArgumentException
if one of the view and render state parameters are outside the
specified range.
@throws VolatileContentDestroyedException
if a texture bitmap was volatile, and the content was
destroyed before the rendering could take place.
*/
XCachedPrimitive drawBitmapModulated( [in] XBitmap xBitmap, [in] ViewState aViewState, [in] RenderState aRenderState )
raises (com::sun::star::lang::IllegalArgumentException,
VolatileContentDestroyedException);
/** Request the associated graphic device for this canvas.<p>
A graphic device provides methods specific to the underlying
output device capabilities, which are common for all canvases
rendering to such a device. This includes device resolution,
color space, or bitmap formats.
@return the associated XGraphicDevice.
*/
XGraphicDevice getDevice();
};
}; }; }; };
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|