Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F98045318
PhutilSprite.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Jan 9, 01:00
Size
1 KB
Mime Type
text/x-php
Expires
Sat, Jan 11, 01:00 (2 d)
Engine
blob
Format
Raw Data
Handle
23501699
Attached To
rPHU libphutil
PhutilSprite.php
View Options
<?php
/**
* NOTE: This is very new and unstable.
*/
final
class
PhutilSprite
extends
Phobject
{
private
$sourceFiles
=
array
();
private
$sourceX
;
private
$sourceY
;
private
$sourceW
;
private
$sourceH
;
private
$targetCSS
;
private
$spriteSheet
;
private
$name
;
public
function
setName
(
$name
)
{
$this
->
name
=
$name
;
return
$this
;
}
public
function
getName
()
{
return
$this
->
name
;
}
public
function
setTargetCSS
(
$target_css
)
{
$this
->
targetCSS
=
$target_css
;
return
$this
;
}
public
function
getTargetCSS
()
{
return
$this
->
targetCSS
;
}
public
function
setSourcePosition
(
$x
,
$y
)
{
$this
->
sourceX
=
$x
;
$this
->
sourceY
=
$y
;
return
$this
;
}
public
function
setSourceSize
(
$w
,
$h
)
{
$this
->
sourceW
=
$w
;
$this
->
sourceH
=
$h
;
return
$this
;
}
public
function
getSourceH
()
{
return
$this
->
sourceH
;
}
public
function
getSourceW
()
{
return
$this
->
sourceW
;
}
public
function
getSourceY
()
{
return
$this
->
sourceY
;
}
public
function
getSourceX
()
{
return
$this
->
sourceX
;
}
public
function
setSourceFile
(
$source_file
,
$scale
=
1
)
{
$this
->
sourceFiles
[
$scale
]
=
$source_file
;
return
$this
;
}
public
function
getSourceFile
(
$scale
)
{
if
(
empty
(
$this
->
sourceFiles
[
$scale
]))
{
throw
new
Exception
(
pht
(
"No source file for scale '%s'!"
,
$scale
));
}
return
$this
->
sourceFiles
[
$scale
];
}
}
Event Timeline
Log In to Comment