Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compliant strokes #40

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions projects/MonkVG-iOS/MonkVG-iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@
objects = {

/* Begin PBXBuildFile section */
DA25BC5D192D4DC600A3FFC6 /* arc.c in Sources */ = {isa = PBXBuildFile; fileRef = DA25BC23192D4DC600A3FFC6 /* arc.c */; };
DA25BC5E192D4DC600A3FFC6 /* arc.h in Headers */ = {isa = PBXBuildFile; fileRef = DA25BC24192D4DC600A3FFC6 /* arc.h */; };
DA25BC62192D4DC600A3FFC6 /* bezier.c in Sources */ = {isa = PBXBuildFile; fileRef = DA25BC28192D4DC600A3FFC6 /* bezier.c */; };
DA25BC63192D4DC600A3FFC6 /* bezier.h in Headers */ = {isa = PBXBuildFile; fileRef = DA25BC29192D4DC600A3FFC6 /* bezier.h */; };
DA25BC6A192D4DC600A3FFC6 /* matrix.h in Headers */ = {isa = PBXBuildFile; fileRef = DA25BC32192D4DC600A3FFC6 /* matrix.h */; };
DA25BC6F192D4DC600A3FFC6 /* path_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = DA25BC37192D4DC600A3FFC6 /* path_utils.h */; };
DA25BC78192D4DC600A3FFC6 /* stroker.c in Sources */ = {isa = PBXBuildFile; fileRef = DA25BC41192D4DC600A3FFC6 /* stroker.c */; };
DA25BC79192D4DC600A3FFC6 /* stroker.h in Headers */ = {isa = PBXBuildFile; fileRef = DA25BC42192D4DC600A3FFC6 /* stroker.h */; };
DA25BC7C192D4DC600A3FFC6 /* util_array.h in Headers */ = {isa = PBXBuildFile; fileRef = DA25BC45192D4DC600A3FFC6 /* util_array.h */; };
DA25BC88192D53F500A3FFC6 /* polygon.c in Sources */ = {isa = PBXBuildFile; fileRef = DA25BC87192D53F500A3FFC6 /* polygon.c */; };
FA0F6A14125ECDC600FE3D55 /* priorityq-heap.h in Headers */ = {isa = PBXBuildFile; fileRef = FA9ACCB4121A088200814394 /* priorityq-heap.h */; };
FA0F6A1E125ECE1300FE3D55 /* priorityq.c in Sources */ = {isa = PBXBuildFile; fileRef = FA9ACCB6121A088200814394 /* priorityq.c */; };
FA0F6A1F125ECE1400FE3D55 /* priorityq.h in Headers */ = {isa = PBXBuildFile; fileRef = FA9ACCB7121A088200814394 /* priorityq.h */; };
Expand Down Expand Up @@ -182,6 +192,16 @@

/* Begin PBXFileReference section */
AACBBE490F95108600F1A2B1 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
DA25BC23192D4DC600A3FFC6 /* arc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = arc.c; sourceTree = "<group>"; };
DA25BC24192D4DC600A3FFC6 /* arc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = arc.h; sourceTree = "<group>"; };
DA25BC28192D4DC600A3FFC6 /* bezier.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bezier.c; sourceTree = "<group>"; };
DA25BC29192D4DC600A3FFC6 /* bezier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bezier.h; sourceTree = "<group>"; };
DA25BC32192D4DC600A3FFC6 /* matrix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = matrix.h; sourceTree = "<group>"; };
DA25BC37192D4DC600A3FFC6 /* path_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = path_utils.h; sourceTree = "<group>"; };
DA25BC41192D4DC600A3FFC6 /* stroker.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = stroker.c; sourceTree = "<group>"; };
DA25BC42192D4DC600A3FFC6 /* stroker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = stroker.h; sourceTree = "<group>"; };
DA25BC45192D4DC600A3FFC6 /* util_array.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = util_array.h; sourceTree = "<group>"; };
DA25BC87192D53F500A3FFC6 /* polygon.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = polygon.c; sourceTree = "<group>"; };
FA34EB4A13EDC98B006F9CA4 /* glPlatform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = glPlatform.h; sourceTree = "<group>"; };
FA6AEFA4127679FD004079EE /* openvg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = openvg.h; sourceTree = "<group>"; };
FA6AEFA5127679FD004079EE /* vgext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = vgext.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -373,6 +393,23 @@
name = Frameworks;
sourceTree = "<group>";
};
DA25BC14192D4DC600A3FFC6 /* vega */ = {
isa = PBXGroup;
children = (
DA25BC87192D53F500A3FFC6 /* polygon.c */,
DA25BC23192D4DC600A3FFC6 /* arc.c */,
DA25BC24192D4DC600A3FFC6 /* arc.h */,
DA25BC28192D4DC600A3FFC6 /* bezier.c */,
DA25BC29192D4DC600A3FFC6 /* bezier.h */,
DA25BC32192D4DC600A3FFC6 /* matrix.h */,
DA25BC37192D4DC600A3FFC6 /* path_utils.h */,
DA25BC41192D4DC600A3FFC6 /* stroker.c */,
DA25BC42192D4DC600A3FFC6 /* stroker.h */,
DA25BC45192D4DC600A3FFC6 /* util_array.h */,
);
path = vega;
sourceTree = "<group>";
};
FA6AEFA2127679FD004079EE /* include */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -424,6 +461,7 @@
FA9ACCA1121A088200814394 /* opengl */ = {
isa = PBXGroup;
children = (
DA25BC14192D4DC600A3FFC6 /* vega */,
FA9ACCA2121A088200814394 /* glu */,
FA9ACCC8121A088200814394 /* glContext.h */,
FA9ACCC7121A088200814394 /* glContext.cpp */,
Expand Down Expand Up @@ -653,6 +691,7 @@
files = (
FA6AEFAC127679FD004079EE /* openvg.h in Headers */,
FA6AEFAD127679FD004079EE /* vgext.h in Headers */,
DA25BC6A192D4DC600A3FFC6 /* matrix.h in Headers */,
FA6AEFAE127679FD004079EE /* vgplatform.h in Headers */,
FA6AEFAF127679FD004079EE /* vgu.h in Headers */,
FAE282AB121A08BB00823BCB /* mkBaseObject.h in Headers */,
Expand Down Expand Up @@ -683,6 +722,7 @@
FA712FBE13B91A39002E9FDC /* mkBatch.h in Headers */,
FA712FC213B91D36002E9FDC /* glBatch.h in Headers */,
FACFEDD013BAB0E30045C681 /* mkImage.h in Headers */,
DA25BC5E192D4DC600A3FFC6 /* arc.h in Headers */,
FACFEDD413BAB2D40045C681 /* glImage.h in Headers */,
FAA5DB8713BBB00F00326F9D /* mkFont.h in Headers */,
FAA5DB8B13BBB1EE00326F9D /* glFont.h in Headers */,
Expand All @@ -695,6 +735,7 @@
FACCFE2416A8D31700A0E7D9 /* OpenGLES20Implementation.h in Headers */,
FACCFE2616A8D31700A0E7D9 /* OpenGLESState.h in Headers */,
FACCFE2816A8D31700A0E7D9 /* Shader.h in Headers */,
DA25BC7C192D4DC600A3FFC6 /* util_array.h in Headers */,
FACCFE2A16A8D31700A0E7D9 /* ShaderFile.h in Headers */,
FACCFE2C16A8D31700A0E7D9 /* ShaderProgram.h in Headers */,
FACCFE4216A8D31700A0E7D9 /* ShaderSource.h in Headers */,
Expand All @@ -710,6 +751,7 @@
FACCFE5E16A8DC2800A0E7D9 /* lighting.vert.h in Headers */,
FACCFE5F16A8DC2800A0E7D9 /* lightingPerFragment.vert.h in Headers */,
FACCFE6016A8DC2800A0E7D9 /* lightingPerVertex.vert.h in Headers */,
DA25BC79192D4DC600A3FFC6 /* stroker.h in Headers */,
FACCFE6116A8DC2800A0E7D9 /* main.vert.h in Headers */,
FACCFE6216A8DC2800A0E7D9 /* postprocess.vert.h in Headers */,
FACCFE6316A8DC2800A0E7D9 /* texture.vert.h in Headers */,
Expand All @@ -719,6 +761,7 @@
FACCFE7216A8DD4500A0E7D9 /* alphaTest.frag.h in Headers */,
FACCFE7316A8DD4500A0E7D9 /* clipPlane.frag.h in Headers */,
FACCFE7416A8DD4500A0E7D9 /* lighting.frag.h in Headers */,
DA25BC6F192D4DC600A3FFC6 /* path_utils.h in Headers */,
FACCFE7516A8DD4500A0E7D9 /* lightingPerFragment.frag.h in Headers */,
FACCFE7616A8DD4500A0E7D9 /* main.frag.h in Headers */,
FACCFE7716A8DD4500A0E7D9 /* postprocess.frag.h in Headers */,
Expand All @@ -728,6 +771,7 @@
FACCFE7B16A8DD4500A0E7D9 /* texture2.frag.h in Headers */,
FACCFECF16A8DE0000A0E7D9 /* all_shaders.h in Headers */,
FADCBB9116BEEF1F000F5EA7 /* OpenGLESPlatform.h in Headers */,
DA25BC63192D4DC600A3FFC6 /* bezier.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -807,6 +851,7 @@
FAE282DC121A08BB00823BCB /* project.c in Sources */,
FAE282DD121A08BB00823BCB /* registry.c in Sources */,
FAE282DE121A08BB00823BCB /* glContext.cpp in Sources */,
DA25BC5D192D4DC600A3FFC6 /* arc.c in Sources */,
FAE282DF121A08BB00823BCB /* glPaint.cpp in Sources */,
FAE282E0121A08BB00823BCB /* glPath.cpp in Sources */,
FA0F6A1E125ECE1300FE3D55 /* priorityq.c in Sources */,
Expand All @@ -830,10 +875,12 @@
FACCFE2E16A8D31700A0E7D9 /* clipPlane.frag in Sources */,
FACCFE2F16A8D31700A0E7D9 /* clipPlane.vert in Sources */,
FACCFE3016A8D31700A0E7D9 /* lighting.frag in Sources */,
DA25BC78192D4DC600A3FFC6 /* stroker.c in Sources */,
FACCFE3116A8D31700A0E7D9 /* lighting.vert in Sources */,
FACCFE3216A8D31700A0E7D9 /* lightingPerFragment.frag in Sources */,
FACCFE3316A8D31700A0E7D9 /* lightingPerFragment.vert in Sources */,
FACCFE3416A8D31700A0E7D9 /* lightingPerVertex.vert in Sources */,
DA25BC88192D53F500A3FFC6 /* polygon.c in Sources */,
FACCFE3516A8D31700A0E7D9 /* main.frag in Sources */,
FACCFE3616A8D31700A0E7D9 /* main.vert in Sources */,
FACCFE3716A8D31700A0E7D9 /* postprocess.frag in Sources */,
Expand All @@ -843,6 +890,7 @@
FACCFE3B16A8D31700A0E7D9 /* texture0.frag in Sources */,
FACCFE3C16A8D31700A0E7D9 /* texture0.vert in Sources */,
FACCFE3D16A8D31700A0E7D9 /* texture1.frag in Sources */,
DA25BC62192D4DC600A3FFC6 /* bezier.c in Sources */,
FACCFE3E16A8D31700A0E7D9 /* texture1.vert in Sources */,
FACCFE3F16A8D31700A0E7D9 /* texture2.frag in Sources */,
FACCFE4016A8D31700A0E7D9 /* texture2.vert in Sources */,
Expand Down
4 changes: 2 additions & 2 deletions src/Quartz/qzPath.mm
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
if ( _uibezeirpath == nil ) {
_uibezeirpath = [UIBezierPath bezierPath];

vector< VGfloat >::iterator coordsIter = _fcoords->begin();
vector< VGfloat >::iterator coordsIter = _fcoords.begin();
int numCoords = 0;
VGbyte segment = VG_CLOSE_PATH;
VGfloat x = 0.0f, y = 0.0f;
Expand Down Expand Up @@ -129,4 +129,4 @@
_uibezeirpath = nil;
return true;
}
}
}
28 changes: 21 additions & 7 deletions src/mkContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ namespace MonkVG {
, _width( 0 )
, _height( 0 )
, _stroke_line_width( 1.0f )
, _stroke_cap_style(VG_CAP_BUTT)
, _stroke_join_style(VG_JOIN_MITER)
, _stroke_paint( 0 )
, _fill_paint( 0 )
, _active_matrix( &_path_user_to_surface )
Expand All @@ -126,6 +128,7 @@ namespace MonkVG {
, _matrixMode( VG_MATRIX_PATH_USER_TO_SURFACE )
, _currentBatch( 0 )
, _imageMode( VG_DRAW_IMAGE_NORMAL )

{
_path_user_to_surface.setIdentity();
_glyph_user_to_surface.setIdentity();
Expand Down Expand Up @@ -178,6 +181,12 @@ namespace MonkVG {
case VG_IMAGE_MODE:
setImageMode( (VGImageMode)i );
break;
case VG_STROKE_CAP_STYLE:
setStrokeCapStyle( (VGCapStyle) i);
break;
case VG_STROKE_JOIN_STYLE:
setStrokeJoinStyle( (VGJoinStyle) i);
break;
default:
break;
}
Expand Down Expand Up @@ -226,13 +235,18 @@ namespace MonkVG {
case VG_IMAGE_MODE:
i = getImageMode( );
break;
case VG_SURFACE_WIDTH_MNK:
i = getWidth();
break;
case VG_SURFACE_HEIGHT_MNK:
i = getHeight();
break;

case VG_STROKE_CAP_STYLE:
i = getStrokeCapStyle( );
break;
case VG_STROKE_JOIN_STYLE:
i = getStrokeJoinStyle( );
break;
case VG_SURFACE_WIDTH_MNK:
i = getWidth();
break;
case VG_SURFACE_HEIGHT_MNK:
i = getHeight();
break;
default:
break;
}
Expand Down
14 changes: 14 additions & 0 deletions src/mkContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,18 @@ namespace MonkVG {
inline VGfloat getStrokeLineWidth() const {
return _stroke_line_width;
}
inline void setStrokeCapStyle( VGCapStyle s ) {
_stroke_cap_style = s;
}
inline VGCapStyle getStrokeCapStyle() const {
return _stroke_cap_style;
}
inline void setStrokeJoinStyle( VGJoinStyle s ) {
_stroke_join_style = s;
}
inline VGJoinStyle getStrokeJoinStyle() const {
return _stroke_join_style;
}

//// surface properties ////
inline void setClearColor( const VGfloat *c ) {
Expand Down Expand Up @@ -205,6 +217,8 @@ namespace MonkVG {

// stroke properties
VGfloat _stroke_line_width; // VG_STROKE_LINE_WIDTH
VGCapStyle _stroke_cap_style;
VGJoinStyle _stroke_join_style;

// rendering quality
VGRenderingQuality _renderingQuality;
Expand Down
6 changes: 3 additions & 3 deletions src/mkPath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace MonkVG { // Internal Implementation
for( int i = 0; i < numCoords; i++ ) {
switch (_datatype) {
case VG_PATH_DATATYPE_F:
_fcoords->push_back( *(((VGfloat*)(pathData)) + i) );
_fcoords.push_back( *(((VGfloat*)(pathData)) + i) );
break;
default:
// error
Expand All @@ -51,7 +51,7 @@ namespace MonkVG { // Internal Implementation
setNumCoords( src.getNumCoords() );
setNumSegments( src.getNumSegments() );
_segments = src._segments;
*_fcoords = *src._fcoords;
_fcoords = src._fcoords;
}

void IPath::clear( VGbitfield caps ) {
Expand All @@ -62,7 +62,7 @@ namespace MonkVG { // Internal Implementation

switch (_datatype) {
case VG_PATH_DATATYPE_F:
_fcoords->clear();
_fcoords.clear();
break;
default:
// error
Expand Down
31 changes: 5 additions & 26 deletions src/mkPath.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,30 +132,9 @@ namespace MonkVG {
, _minY( VG_MAX_FLOAT )
, _width( -VG_MAX_FLOAT )
, _height( -VG_MAX_FLOAT )
{
switch (_datatype) {
case VG_PATH_DATATYPE_F:
_fcoords = new vector<float>( _numCoords );
break;
default:
// error
break;
}

}

virtual ~IPath() {
switch (_datatype) {
case VG_PATH_DATATYPE_F:
_fcoords->clear();
delete _fcoords;
_fcoords = 0;
break;
default:
// error
break;
}
}
{}

virtual ~IPath() {}

protected:

Expand All @@ -169,7 +148,7 @@ namespace MonkVG {

// data
vector< VGubyte > _segments;
vector< VGfloat > *_fcoords;
vector< VGfloat > _fcoords;
bool _isFillDirty;
bool _isStrokeDirty;

Expand All @@ -183,4 +162,4 @@ namespace MonkVG {

};
}
#endif //__mkPath_h__
#endif //__mkPath_h__
Loading