127
137
rb_raise (rb_eCairo_InvalidStringError, string);
140
#if CAIRO_CHECK_VERSION(1, 7, 2)
141
case CAIRO_STATUS_FONT_TYPE_MISMATCH:
142
rb_raise (rb_eCairo_FontTypeMismatch, string);
144
case CAIRO_STATUS_USER_FONT_IMMUTABLE:
145
rb_raise (rb_eCairo_UserFontImmutable, string);
147
case CAIRO_STATUS_USER_FONT_ERROR:
148
rb_raise (rb_eCairo_UserFontError, string);
150
case CAIRO_STATUS_NEGATIVE_COUNT:
151
rb_raise (rb_eCairo_NegativeCount, string);
153
case CAIRO_STATUS_INVALID_CLUSTERS:
154
rb_raise (rb_eCairo_InvalidClusters, string);
156
case CAIRO_STATUS_INVALID_SLANT:
157
rb_raise (rb_eCairo_InvalidSlant, string);
159
case CAIRO_STATUS_INVALID_WEIGHT:
160
rb_raise (rb_eCairo_InvalidWeight, string);
167
rb_cairo__exception_to_status (VALUE exception)
169
if (NIL_P (exception))
170
return CAIRO_STATUS_SUCCESS;
171
else if (rb_cairo__is_kind_of (exception, rb_eNoMemError))
172
return CAIRO_STATUS_NO_MEMORY;
173
else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidRestoreError))
174
return CAIRO_STATUS_INVALID_RESTORE;
175
else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidPopGroupError))
176
return CAIRO_STATUS_INVALID_POP_GROUP;
177
else if (rb_cairo__is_kind_of (exception, rb_eCairo_NoCurrentPointError))
178
return CAIRO_STATUS_NO_CURRENT_POINT;
179
else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidMatrixError))
180
return CAIRO_STATUS_INVALID_MATRIX;
181
else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidStatusError))
182
return CAIRO_STATUS_INVALID_STATUS;
183
else if (rb_cairo__is_kind_of (exception, rb_eCairo_NullPointerError))
184
return CAIRO_STATUS_NULL_POINTER;
185
else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidStringError))
186
return CAIRO_STATUS_INVALID_STRING;
187
else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidPathDataError))
188
return CAIRO_STATUS_INVALID_PATH_DATA;
189
else if (rb_cairo__is_kind_of (exception, rb_eCairo_ReadError))
190
return CAIRO_STATUS_READ_ERROR;
191
else if (rb_cairo__is_kind_of (exception, rb_eCairo_WriteError))
192
return CAIRO_STATUS_WRITE_ERROR;
193
else if (rb_cairo__is_kind_of (exception, rb_eCairo_SurfaceFinishedError))
194
return CAIRO_STATUS_SURFACE_FINISHED;
195
else if (rb_cairo__is_kind_of (exception, rb_eCairo_SurfaceTypeMismatchError))
196
return CAIRO_STATUS_SURFACE_TYPE_MISMATCH;
197
else if (rb_cairo__is_kind_of (exception, rb_eCairo_PatternTypeMismatchError))
198
return CAIRO_STATUS_PATTERN_TYPE_MISMATCH;
199
else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidContentError))
200
return CAIRO_STATUS_INVALID_CONTENT;
201
else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidFormatError))
202
return CAIRO_STATUS_INVALID_FORMAT;
203
else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidVisualError))
204
return CAIRO_STATUS_INVALID_VISUAL;
205
else if (rb_cairo__is_kind_of (exception, rb_eCairo_FileNotFoundError))
206
return CAIRO_STATUS_FILE_NOT_FOUND;
207
else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidDashError))
208
return CAIRO_STATUS_INVALID_DASH;
209
else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidDscCommentError))
210
return CAIRO_STATUS_INVALID_DSC_COMMENT;
211
#if CAIRO_CHECK_VERSION(1, 3, 0)
212
else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidIndexError))
213
return CAIRO_STATUS_INVALID_INDEX;
214
else if (rb_cairo__is_kind_of (exception, rb_eCairo_ClipNotRepresentableError))
215
return CAIRO_STATUS_CLIP_NOT_REPRESENTABLE;
217
#if CAIRO_CHECK_VERSION(1, 5, 6)
218
else if (rb_cairo__is_kind_of (exception, rb_eCairo_TempFileError))
219
return CAIRO_STATUS_TEMP_FILE_ERROR;
220
else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidStringError))
221
return CAIRO_STATUS_INVALID_STRIDE;
223
#if CAIRO_CHECK_VERSION(1, 7, 2)
224
else if (rb_cairo__is_kind_of (exception, rb_eCairo_FontTypeMismatch))
225
return CAIRO_STATUS_FONT_TYPE_MISMATCH;
226
else if (rb_cairo__is_kind_of (exception, rb_eCairo_UserFontImmutable))
227
return CAIRO_STATUS_USER_FONT_IMMUTABLE;
228
else if (rb_cairo__is_kind_of (exception, rb_eCairo_UserFontError))
229
return CAIRO_STATUS_USER_FONT_ERROR;
230
else if (rb_cairo__is_kind_of (exception, rb_eCairo_NegativeCount))
231
return CAIRO_STATUS_NEGATIVE_COUNT;
232
else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidClusters))
233
return CAIRO_STATUS_INVALID_CLUSTERS;
234
else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidSlant))
235
return CAIRO_STATUS_INVALID_SLANT;
236
else if (rb_cairo__is_kind_of (exception, rb_eCairo_InvalidWeight))
237
return CAIRO_STATUS_INVALID_WEIGHT;
134
244
Init_cairo_exception ()
208
318
rb_eCairo_Error);
210
320
rb_eCairo_InvalidStrideError =
211
rb_define_class_under (rb_mCairo, "InvalidStrideError",
321
rb_define_class_under (rb_mCairo, "InvalidStrideError",
325
#if CAIRO_CHECK_VERSION(1, 7, 2)
326
rb_eCairo_FontTypeMismatch =
327
rb_define_class_under (rb_mCairo, "FontTypeMismatch",
330
rb_eCairo_UserFontImmutable =
331
rb_define_class_under (rb_mCairo, "UserFontImmutable",
334
rb_eCairo_UserFontError =
335
rb_define_class_under (rb_mCairo, "UserFontError",
338
rb_eCairo_NegativeCount =
339
rb_define_class_under (rb_mCairo, "NegativeCount",
342
rb_eCairo_InvalidClusters =
343
rb_define_class_under (rb_mCairo, "InvalidClusters",
346
rb_eCairo_InvalidSlant =
347
rb_define_class_under (rb_mCairo, "InvalidSlant",
350
rb_eCairo_InvalidWeight =
351
rb_define_class_under (rb_mCairo, "InvalidWeight",