Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
6e73ed02
Commit
6e73ed02
authored
13 years ago
by
cramakri
Browse files
Options
Downloads
Patches
Plain Diff
LMS-2472 Clean-up of old code, preparation for new code
SVN: 22655
parent
ae09d0a5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test-data/screening/source/python/image-generator.py
+0
-62
0 additions, 62 deletions
test-data/screening/source/python/image-generator.py
test-data/screening/source/python/old-generate-test-images.py
+0
-0
0 additions, 0 deletions
...-data/screening/source/python/old-generate-test-images.py
with
0 additions
and
62 deletions
test-data/screening/source/python/image-generator.py
deleted
100644 → 0
+
0
−
62
View file @
ae09d0a5
#!/usr/bin/python
# image-generator.py
#
# Create bitmap images in python
#
from
Quartz
import
*
from
Cocoa
import
*
from
LaunchServices
import
*
# for kUTTypePNG
import
math
cs
=
CGColorSpaceCreateDeviceRGB
()
def
write_to_file
(
ctx
,
filename
):
image
=
CGBitmapContextCreateImage
(
ctx
)
fileUrl
=
NSURL
.
fileURLWithPath_
(
filename
)
dest
=
CGImageDestinationCreateWithURL
(
fileUrl
,
kUTTypePNG
,
1
,
None
);
CGImageDestinationAddImage
(
dest
,
image
,
None
);
CGImageDestinationFinalize
(
dest
);
def
createBitmap
(
text
,
filename
):
pixelsWide
=
256
pixelsHigh
=
256
bitmapBytesPerRow
=
(
pixelsWide
*
4
);
bitmapByteCount
=
(
bitmapBytesPerRow
*
pixelsHigh
);
# Create an RGB bitmap context, transparent black background, 256x256
ctx
=
CGBitmapContextCreate
(
None
,
pixelsWide
,
pixelsHigh
,
8
,
bitmapBytesPerRow
,
cs
,
kCGImageAlphaPremultipliedLast
)
# Draw a yellow square with a red outline in the center
with
CGSavedGState
(
ctx
):
CGContextSetRGBStrokeColor
(
ctx
,
0
,
0
,
0
,
1
)
# black
CGContextSetRGBFillColor
(
ctx
,
0
,
0
,
0
,
1
)
# black
CGContextAddRect
(
ctx
,
CGRectMake
(
32.5
,
32.5
,
191
,
191
))
CGContextDrawPath
(
ctx
,
kCGPathFillStroke
)
with
CGSavedGState
(
ctx
):
CGContextSetRGBStrokeColor
(
ctx
,
0
,
0
,
0
,
1
)
# black
CGContextSetRGBFillColor
(
ctx
,
1
,
1
,
1
,
1
)
# white
CGContextSetTextMatrix
(
ctx
,
CGAffineTransformIdentity
)
CGContextSelectFont
(
ctx
,
"
Helvetica Neue
"
,
36
,
kCGEncodingMacRoman
)
CGContextSetTextDrawingMode
(
ctx
,
kCGTextFillStroke
)
CGContextShowTextAtPoint
(
ctx
,
40
,
118
,
text
,
len
(
text
))
# Draw some text at an angle (or not)
# c.saveGState()
# c.setRGBStrokeColor(0,0,0,1)
# c.setRGBFillColor(1,1,1,1)
# c.selectFont("Helvetica", 36, kCGEncodingMacRoman)
# c.setTextPosition(40, 118)
# c.setTextDrawingMode(kCGTextFillStroke)
# c.showText(text, len(text))
# c.restoreGState()
# Write the bitmap to disk in PNG format
write_to_file
(
ctx
,
filename
)
createBitmap
(
"
hi!
"
,
"
out.png
"
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test-data/screening/source/python/generate-test-images.py
→
test-data/screening/source/python/
old-
generate-test-images.py
+
0
−
0
View file @
6e73ed02
File moved
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment