Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1069)

Unified Diff: src/pdf/SkPDFUtils.cpp

Issue 18585002: Implemented transparent gradients (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Merge new SkPDFResourceDict method names Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/pdf/SkPDFUtils.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFUtils.cpp
diff --git a/src/pdf/SkPDFUtils.cpp b/src/pdf/SkPDFUtils.cpp
index 16abc2f9f252b381a26a4d8c016361018d71c712..d034270e07447f07503e603109868d72e9d252f9 100644
--- a/src/pdf/SkPDFUtils.cpp
+++ b/src/pdf/SkPDFUtils.cpp
@@ -17,6 +17,17 @@
#include "SkString.h"
#include "SkPDFTypes.h"
+//static
+SkPDFArray* SkPDFUtils::RectToArray(const SkRect& rect) {
+ SkPDFArray* result = new SkPDFArray();
+ result->reserve(4);
+ result->appendScalar(rect.fLeft);
+ result->appendScalar(rect.fTop);
+ result->appendScalar(rect.fRight);
+ result->appendScalar(rect.fBottom);
+ return result;
+}
+
// static
SkPDFArray* SkPDFUtils::MatrixToArray(const SkMatrix& matrix) {
SkScalar values[6];
@@ -222,3 +233,17 @@ void SkPDFUtils::ApplyGraphicState(int objectIndex, SkWStream* content) {
objectIndex).c_str());
content->writeText(" gs\n");
}
+
+// static
+void SkPDFUtils::ApplyPattern(int objectIndex, SkWStream* content) {
+ // Select Pattern color space (CS, cs) and set pattern object as current
+ // color (SCN, scn)
+ SkString resourceName = SkPDFResourceDict::getResourceName(
+ SkPDFResourceDict::kPattern_ResourceType,
+ objectIndex);
+ content->writeText("/Pattern CS/Pattern cs/");
+ content->writeText(resourceName.c_str());
+ content->writeText(" SCN/");
+ content->writeText(resourceName.c_str());
+ content->writeText(" scn\n");
+}
« no previous file with comments | « src/pdf/SkPDFUtils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698